Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions api/v1alpha1/kube_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ type Pod struct {
//
// +optional
ExtraVolumes []corev1.Volume `json:"extraVolumes,omitempty"`

// If specified, the pod's PriorityClass. See
// https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podspec-v1-core
// for details
//
// +optional
PriorityClassName *string `json:"priorityClassName,omitempty"`
}

func (in *Pod) GetExtraLabels() map[string]string {
Expand Down Expand Up @@ -415,6 +422,13 @@ func (in *Pod) GetExtraVolumes() []corev1.Volume {
return in.ExtraVolumes
}

func (in *Pod) GetPriorityClassName() *string {
if in == nil {
return nil
}
return in.PriorityClassName
}

type GracefulShutdownSpec struct {
// Enable grace period before shutdown to finish current requests while Envoy health checks fail to e.g. notify external load balancers. *NOTE:* This will not have any effect if you have not defined health checks via the health check filter
//
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6108,6 +6108,12 @@ spec:
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ for
details.
type: object
priorityClassName:
description: |-
If specified, the pod's PriorityClass. See
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podspec-v1-core
for details
type: string
readinessProbe:
description: |-
If specified, the pod's readiness probe. Periodic probe of container service readiness.
Expand Down
1 change: 1 addition & 0 deletions internal/kgateway/deployer/gateway_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ func (k *kgatewayParameters) getValues(gw *gwv1.Gateway, gwParam *v1alpha1.Gatew
gateway.TerminationGracePeriodSeconds = podConfig.GetTerminationGracePeriodSeconds()
gateway.TopologySpreadConstraints = podConfig.GetTopologySpreadConstraints()
gateway.ExtraVolumes = podConfig.GetExtraVolumes()
gateway.PriorityClassName = podConfig.GetPriorityClassName()

// data plane container
if agwConfig := kubeProxyConfig.GetAgentgateway(); ptr.Deref(agwConfig.GetEnabled(), false) {
Expand Down
3 changes: 3 additions & 0 deletions internal/kgateway/helm/envoy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ spec:
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if $gateway.priorityClassName }}
priorityClassName: {{ $gateway.priorityClassName | quote }}
{{- end }}
{{- if $gateway.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ $gateway.terminationGracePeriodSeconds }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions pkg/deployer/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func deepMergePodTemplate(dst, src *v1alpha1.Pod) *v1alpha1.Pod {
dst.LivenessProbe = deepMergeProbe(dst.GetLivenessProbe(), src.GetLivenessProbe())
dst.TopologySpreadConstraints = DeepMergeSlices(dst.GetTopologySpreadConstraints(), src.GetTopologySpreadConstraints())
dst.ExtraVolumes = DeepMergeSlices(dst.GetExtraVolumes(), src.GetExtraVolumes())
dst.PriorityClassName = MergePointers(dst.PriorityClassName, src.PriorityClassName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elsewhere we use MergeComparable for some (all?) *string, but that's semantically nonsensical and MergePointers is correct. (I put up #12978 to clean this up.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I leave it as it is then 👍


return dst
}
Expand Down
1 change: 1 addition & 0 deletions pkg/deployer/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type HelmGateway struct {
GracefulShutdown *v1alpha1.GracefulShutdownSpec `json:"gracefulShutdown,omitempty"`
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
PriorityClassName *string `json:"priorityClassName,omitempty"`

// sds container values
SdsContainer *HelmSdsContainer `json:"sdsContainer,omitempty"`
Expand Down
4 changes: 4 additions & 0 deletions test/deployer/internal_helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func TestRenderHelmChart(t *testing.T) {
Name: "gateway with replicas GWP via GWC",
InputFile: "gwc-with-replicas",
},
{
Name: "gateway with priorityClassName",
InputFile: "priority-class-name",
},
{
Name: "gwparams with omitDefaultSecurityContext via GWC",
InputFile: "omit-default-security-context",
Expand Down
Loading