Skip to content

Commit

Permalink
Align the podAntiAfiinity rule of envoy
Browse files Browse the repository at this point in the history
Signed-off-by: Lubron Zhan <lubronzhan@gmail.com>
  • Loading branch information
lubronzhan committed Feb 1, 2024
1 parent 6225b42 commit e59d515
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
13 changes: 6 additions & 7 deletions examples/deployment/03-envoy-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ spec:
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- envoy
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app: envoy
topologyKey: "kubernetes.io/hostname"
weight: 100
containers:
- command:
- /bin/contour
Expand Down
13 changes: 6 additions & 7 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9142,14 +9142,13 @@ spec:
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- envoy
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app: envoy
topologyKey: "kubernetes.io/hostname"
weight: 100
containers:
- command:
- /bin/contour
Expand Down
3 changes: 2 additions & 1 deletion internal/provisioner/objects/dataplane/dataplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ func desiredDeployment(contour *model.Contour, contourImage, envoyImage string)
Spec: corev1.PodSpec{
Affinity: &corev1.Affinity{
PodAntiAffinity: &corev1.PodAntiAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{
PreferredDuringSchedulingIgnoredDuringExecution: []corev1.WeightedPodAffinityTerm{
Weight: int32(100),

Check failure on line 437 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / CodeQL-Build

undefined: Weight

Check failure on line 437 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / CodeQL-Build

cannot use int32(100) (constant 100 of type int32) as "k8s.io/api/core/v1".WeightedPodAffinityTerm value in array or slice literal

Check failure on line 437 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / lint

undefined: Weight

Check failure on line 437 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / lint

cannot use int32(100) (constant 100 of type int32) as "k8s.io/api/core/v1".WeightedPodAffinityTerm value in array or slice literal

Check failure on line 437 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / lint

undefined: Weight

Check failure on line 437 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / lint

cannot use int32(100) (constant 100 of type int32) as "k8s.io/api/core/v1".WeightedPodAffinityTerm value in array or slice literal
{
LabelSelector: EnvoyPodSelector(contour),

Check failure on line 439 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / CodeQL-Build

unknown field LabelSelector in struct literal of type struct{Weight int32 "json:\"weight\" protobuf:\"varint,1,opt,name=weight\""; PodAffinityTerm "k8s.io/api/core/v1".PodAffinityTerm "json:\"podAffinityTerm\" protobuf:\"bytes,2,opt,name=podAffinityTerm\""}

Check failure on line 439 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / lint

unknown field LabelSelector in struct literal of type struct{Weight int32 "json:\"weight\" protobuf:\"varint,1,opt,name=weight\""; PodAffinityTerm "k8s.io/api/core/v1".PodAffinityTerm "json:\"podAffinityTerm\" protobuf:\"bytes,2,opt,name=podAffinityTerm\""}

Check failure on line 439 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / lint

unknown field LabelSelector in struct literal of type struct{Weight int32 "json:\"weight\" protobuf:\"varint,1,opt,name=weight\""; PodAffinityTerm "k8s.io/api/core/v1".PodAffinityTerm "json:\"podAffinityTerm\" protobuf:\"bytes,2,opt,name=podAffinityTerm\""}
TopologyKey: "kubernetes.io/hostname",

Check failure on line 440 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / CodeQL-Build

unknown field TopologyKey in struct literal of type struct{Weight int32 "json:\"weight\" protobuf:\"varint,1,opt,name=weight\""; PodAffinityTerm "k8s.io/api/core/v1".PodAffinityTerm "json:\"podAffinityTerm\" protobuf:\"bytes,2,opt,name=podAffinityTerm\""}

Check failure on line 440 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / lint

unknown field TopologyKey in struct literal of type struct{Weight int32 "json:\"weight\" protobuf:\"varint,1,opt,name=weight\""; PodAffinityTerm "k8s.io/api/core/v1".PodAffinityTerm "json:\"podAffinityTerm\" protobuf:\"bytes,2,opt,name=podAffinityTerm\""}) (typecheck)

Check failure on line 440 in internal/provisioner/objects/dataplane/dataplane.go

View workflow job for this annotation

GitHub Actions / lint

unknown field TopologyKey in struct literal of type struct{Weight int32 "json:\"weight\" protobuf:\"varint,1,opt,name=weight\""; PodAffinityTerm "k8s.io/api/core/v1".PodAffinityTerm "json:\"podAffinityTerm\" protobuf:\"bytes,2,opt,name=podAffinityTerm\""}) (typecheck)
Expand Down
3 changes: 2 additions & 1 deletion internal/provisioner/objects/dataplane/dataplane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ func checkEnvoyDeploymentHasAffinity(t *testing.T, d *appsv1.Deployment, contour
if apiequality.Semantic.DeepEqual(*d.Spec.Template.Spec.Affinity,
corev1.Affinity{
PodAntiAffinity: &corev1.PodAntiAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []corev1.PodAffinityTerm{
PreferredDuringSchedulingIgnoredDuringExecution: []corev1.WeightedPodAffinityTerm{
Weight: int32(100),
{
LabelSelector: EnvoyPodSelector(contour),
TopologyKey: "kubernetes.io/hostname",
Expand Down

0 comments on commit e59d515

Please sign in to comment.