Skip to content

Commit ea0c3b6

Browse files
committed
fix nodeSelector, afinity and toleration bug of apigateway
1 parent e42ccca commit ea0c3b6

File tree

5 files changed

+47
-68
lines changed

5 files changed

+47
-68
lines changed

Diff for: deploy/helm/data-plane/templates/gateway/contour-internal-LB.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -673,11 +673,9 @@ spec:
673673
fieldPath: metadata.name
674674
ports:
675675
- containerPort: 8080
676-
hostPort: 80
677676
name: http
678677
protocol: TCP
679678
- containerPort: 8443
680-
hostPort: 443
681679
name: https
682680
protocol: TCP
683681
readinessProbe:

Diff for: deploy/helm/data-plane/templates/gateway/contour-internal.yaml

+23-30
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ spec:
379379
targetPort: 8443
380380
selector:
381381
app: envoy
382-
type: LoadBalancer
382+
type: ClusterIP
383383

384384
---
385385
kind: GatewayClass
@@ -404,17 +404,6 @@ spec:
404404
allowedRoutes:
405405
namespaces:
406406
from: All
407-
- name: https
408-
protocol: HTTPS
409-
port: 443
410-
allowedRoutes:
411-
namespaces:
412-
from: All
413-
tls:
414-
certificateRefs:
415-
- kind: Secret
416-
group: ""
417-
name: cno-apigateway-internal-tls
418407
---
419408
apiVersion: apps/v1
420409
kind: Deployment
@@ -442,19 +431,23 @@ spec:
442431
labels:
443432
app: contour
444433
spec:
445-
nodeSelector:
446-
{{- if hasKey .Values.cnoApiGateway "nodeSelector" -}}
447-
{{- toYaml .Values.cnoApiGateway.nodeSelector | nindent 8 -}}
448-
{{- end }}
449434
affinity:
450435
podAntiAffinity:
451-
{{- if hasKey .Values.cnoApiGateway "podAntiAffinity" -}}
452-
{{- toYaml .Values.cnoApiGateway.podAntiAffinity | nindent 10 -}}
453-
{{- end }}
436+
requiredDuringSchedulingIgnoredDuringExecution:
437+
- labelSelector:
438+
matchExpressions:
439+
- key: {{ .Values.cnoApiGateway.nodeSelector }}
440+
operator: Exists
441+
topologyKey: kubernetes.io/hostname
442+
nodeSelector:
443+
{{ .Values.cnoApiGateway.nodeSelector }}: ""
454444
tolerations:
455-
{{- if hasKey .Values.cnoApiGateway "tolerations" -}}
456-
{{- toYaml .Values.cnoApiGateway.tolerations | nindent 8 -}}
457-
{{- end }}
445+
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
446+
value: "reserved"
447+
effect: "NoSchedule"
448+
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
449+
value: "reserved"
450+
effect: "NoExecute"
458451
containers:
459452
- args:
460453
- serve
@@ -550,13 +543,15 @@ spec:
550543
app: envoy
551544
spec:
552545
nodeSelector:
553-
{{- if hasKey .Values.cnoApiGateway "nodeSelector" -}}
554-
{{- toYaml .Values.cnoApiGateway.nodeSelector | nindent 8 -}}
555-
{{- end }}
546+
{{ .Values.cnoApiGateway.nodeSelector }}: ""
556547
tolerations:
557-
{{- if hasKey .Values.cnoApiGateway "tolerations" -}}
558-
{{- toYaml .Values.cnoApiGateway.tolerations | nindent 8 -}}
559-
{{- end }}
548+
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
549+
value: "reserved"
550+
effect: "NoSchedule"
551+
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
552+
value: "reserved"
553+
effect: "NoExecute"
554+
560555
containers:
561556
- command:
562557
- /bin/contour
@@ -606,11 +601,9 @@ spec:
606601
fieldPath: metadata.name
607602
ports:
608603
- containerPort: 8080
609-
hostPort: 80
610604
name: http
611605
protocol: TCP
612606
- containerPort: 8443
613-
hostPort: 443
614607
name: https
615608
protocol: TCP
616609
readinessProbe:

Diff for: deploy/helm/data-plane/templates/gateway/contour.yaml

+22-17
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ spec:
460460
targetPort: 8443
461461
selector:
462462
app: envoy
463-
type: LoadBalancer
463+
type: ClusterIP
464464

465465
---
466466
kind: GatewayClass
@@ -523,19 +523,23 @@ spec:
523523
labels:
524524
app: contour
525525
spec:
526-
nodeSelector:
527-
{{- if hasKey .Values.cnoApiGateway "nodeSelector" -}}
528-
{{- toYaml .Values.cnoApiGateway.nodeSelector | nindent 8 -}}
529-
{{- end }}
530526
affinity:
531527
podAntiAffinity:
532-
{{- if hasKey .Values.cnoApiGateway "podAntiAffinity" -}}
533-
{{- toYaml .Values.cnoApiGateway.podAntiAffinity | nindent 10 -}}
534-
{{- end }}
528+
requiredDuringSchedulingIgnoredDuringExecution:
529+
- labelSelector:
530+
matchExpressions:
531+
- key: {{ .Values.cnoApiGateway.nodeSelector }}
532+
operator: Exists
533+
topologyKey: kubernetes.io/hostname
534+
nodeSelector:
535+
{{ .Values.cnoApiGateway.nodeSelector }}: ""
535536
tolerations:
536-
{{- if hasKey .Values.cnoApiGateway "tolerations" -}}
537-
{{- toYaml .Values.cnoApiGateway.tolerations | nindent 8 -}}
538-
{{- end }}
537+
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
538+
value: "reserved"
539+
effect: "NoSchedule"
540+
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
541+
value: "reserved"
542+
effect: "NoExecute"
539543
containers:
540544
- args:
541545
- serve
@@ -631,13 +635,14 @@ spec:
631635
app: envoy
632636
spec:
633637
nodeSelector:
634-
{{- if hasKey .Values.cnoApiGateway "nodeSelector" -}}
635-
{{- toYaml .Values.cnoApiGateway.nodeSelector | nindent 8 -}}
636-
{{- end }}
638+
{{ .Values.cnoApiGateway.nodeSelector }}: ""
637639
tolerations:
638-
{{- if hasKey .Values.cnoApiGateway "tolerations" -}}
639-
{{- toYaml .Values.cnoApiGateway.tolerations | nindent 8 -}}
640-
{{- end }}
640+
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
641+
value: "reserved"
642+
effect: "NoSchedule"
643+
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
644+
value: "reserved"
645+
effect: "NoExecute"
641646
containers:
642647
- command:
643648
- /bin/contour

Diff for: deploy/helm/data-plane/values.yaml

+2-19
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,5 @@ monitoring:
8484

8585
cnoApiGateway:
8686
type: loadBalancer
87-
88-
podAntiAffinity:
89-
requiredDuringSchedulingIgnoredDuringExecution:
90-
- labelSelector:
91-
matchExpressions:
92-
- key: node-role.kubernetes.io/ingress-cno
93-
operator: Exists
94-
topologyKey: kubernetes.io/hostname
95-
96-
tolerations:
97-
- key: "ingress-cno"
98-
value: "reserved"
99-
effect: "NoSchedule"
100-
- key: "ingress-cno"
101-
value: "reserved"
102-
effect: "NoExecute"
103-
104-
nodeSelector:
105-
node-role.kubernetes.io/ingress-cno: ""
87+
nodeSelector: node-role.kubernetes.io/ingress-cno
88+
tolerationsKey: ingress-cno

Diff for: docs/cno-agent-v2.0.2.tgz

-47 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)