Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick support for envoy pod affinity and tolerations #7

Merged
merged 1 commit into from
Jul 10, 2023
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
8 changes: 8 additions & 0 deletions api/config/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ type KubernetesPodSpec struct {
//
// +optional
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`

// If specified, the pod's scheduling constraints.
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`

// If specified, the pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
}

// KubernetesContainerSpec defines the desired state of the Kubernetes container resource.
Expand Down
12 changes: 12 additions & 0 deletions api/config/v1alpha1/zz_generated.deepcopy.go

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

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/latest/api/config_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ _Appears in:_
| --- | --- |
| `annotations` _object (keys:string, values:string)_ | Annotations are the annotations that should be appended to the pods. By default, no pod annotations are appended. |
| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#podsecuritycontext-v1-core)_ | SecurityContext holds pod-level security attributes and common container settings. Optional: Defaults to empty. See type description for default values of each field. |
| `affinity` _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | If specified, the pod's scheduling constraints. |
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | If specified, the pod's tolerations. |


## KubernetesServiceSpec
Expand Down
14 changes: 14 additions & 0 deletions internal/gatewayapi/testdata/envoyproxy-valid.in.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ envoyproxy:
annotations:
key1: val1
key2: val2
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: cloud.google.com/gke-nodepool
operator: In
values:
- router-node
tolerations:
- effect: NoSchedule
key: node-type
operator: Exists
value: "router"
securityContext:
runAsUser: 1000
runAsGroup: 3000
Expand Down
14 changes: 14 additions & 0 deletions internal/gatewayapi/testdata/envoyproxy-valid.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ infraIR:
annotations:
key1: val1
key2: val2
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: cloud.google.com/gke-nodepool
operator: In
values:
- router-node
tolerations:
- effect: NoSchedule
key: node-type
operator: Exists
value: "router"
securityContext:
runAsUser: 1000
runAsGroup: 3000
Expand Down
2 changes: 2 additions & 0 deletions internal/infrastructure/kubernetes/proxy_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ func (i *Infra) expectedProxyDeployment(infra *ir.Infra) (*appsv1.Deployment, er
RestartPolicy: corev1.RestartPolicyAlways,
SchedulerName: "default-scheduler",
SecurityContext: deploymentConfig.Pod.SecurityContext,
Affinity: deploymentConfig.Pod.Affinity,
Tolerations: deploymentConfig.Pod.Tolerations,
Volumes: []corev1.Volume{
{
Name: "certs",
Expand Down
2 changes: 2 additions & 0 deletions internal/infrastructure/kubernetes/ratelimit_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ func (i *Infra) expectedRateLimitDeployment(infra *ir.RateLimitInfra) *appsv1.De
RestartPolicy: corev1.RestartPolicyAlways,
SchedulerName: "default-scheduler",
SecurityContext: rateLimitDeployment.Pod.SecurityContext,
Affinity: rateLimitDeployment.Pod.Affinity,
Tolerations: rateLimitDeployment.Pod.Tolerations,
Volumes: []corev1.Volume{
{
Name: rateLimitInfraName,
Expand Down
2 changes: 0 additions & 2 deletions tools/make/teleport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ teleport-push: teleport-build push
.PHONY: teleport-build-multiarch
teleport-build-multiarch: go.build.multiarch image-multiarch

teleport-helm-%: RELEASE_VERSION

.PHONY: teleport-helm-package
teleport-helm-package: ## Package envoy gateway helm chart with teleprot specific overrides.
teleport-helm-package: helm-package
Expand Down