Skip to content

Commit

Permalink
fix nodeSelector, afinity and toleration bug of apigateway
Browse files Browse the repository at this point in the history
  • Loading branch information
modoulo committed Jul 6, 2023
1 parent e42ccca commit ea0c3b6
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,9 @@ spec:
fieldPath: metadata.name
ports:
- containerPort: 8080
hostPort: 80
name: http
protocol: TCP
- containerPort: 8443
hostPort: 443
name: https
protocol: TCP
readinessProbe:
Expand Down
53 changes: 23 additions & 30 deletions deploy/helm/data-plane/templates/gateway/contour-internal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ spec:
targetPort: 8443
selector:
app: envoy
type: LoadBalancer
type: ClusterIP

---
kind: GatewayClass
Expand All @@ -404,17 +404,6 @@ spec:
allowedRoutes:
namespaces:
from: All
- name: https
protocol: HTTPS
port: 443
allowedRoutes:
namespaces:
from: All
tls:
certificateRefs:
- kind: Secret
group: ""
name: cno-apigateway-internal-tls
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -442,19 +431,23 @@ spec:
labels:
app: contour
spec:
nodeSelector:
{{- if hasKey .Values.cnoApiGateway "nodeSelector" -}}
{{- toYaml .Values.cnoApiGateway.nodeSelector | nindent 8 -}}
{{- end }}
affinity:
podAntiAffinity:
{{- if hasKey .Values.cnoApiGateway "podAntiAffinity" -}}
{{- toYaml .Values.cnoApiGateway.podAntiAffinity | nindent 10 -}}
{{- end }}
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: {{ .Values.cnoApiGateway.nodeSelector }}
operator: Exists
topologyKey: kubernetes.io/hostname
nodeSelector:
{{ .Values.cnoApiGateway.nodeSelector }}: ""
tolerations:
{{- if hasKey .Values.cnoApiGateway "tolerations" -}}
{{- toYaml .Values.cnoApiGateway.tolerations | nindent 8 -}}
{{- end }}
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
value: "reserved"
effect: "NoSchedule"
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
value: "reserved"
effect: "NoExecute"
containers:
- args:
- serve
Expand Down Expand Up @@ -550,13 +543,15 @@ spec:
app: envoy
spec:
nodeSelector:
{{- if hasKey .Values.cnoApiGateway "nodeSelector" -}}
{{- toYaml .Values.cnoApiGateway.nodeSelector | nindent 8 -}}
{{- end }}
{{ .Values.cnoApiGateway.nodeSelector }}: ""
tolerations:
{{- if hasKey .Values.cnoApiGateway "tolerations" -}}
{{- toYaml .Values.cnoApiGateway.tolerations | nindent 8 -}}
{{- end }}
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
value: "reserved"
effect: "NoSchedule"
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
value: "reserved"
effect: "NoExecute"

containers:
- command:
- /bin/contour
Expand Down Expand Up @@ -606,11 +601,9 @@ spec:
fieldPath: metadata.name
ports:
- containerPort: 8080
hostPort: 80
name: http
protocol: TCP
- containerPort: 8443
hostPort: 443
name: https
protocol: TCP
readinessProbe:
Expand Down
39 changes: 22 additions & 17 deletions deploy/helm/data-plane/templates/gateway/contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ spec:
targetPort: 8443
selector:
app: envoy
type: LoadBalancer
type: ClusterIP

---
kind: GatewayClass
Expand Down Expand Up @@ -523,19 +523,23 @@ spec:
labels:
app: contour
spec:
nodeSelector:
{{- if hasKey .Values.cnoApiGateway "nodeSelector" -}}
{{- toYaml .Values.cnoApiGateway.nodeSelector | nindent 8 -}}
{{- end }}
affinity:
podAntiAffinity:
{{- if hasKey .Values.cnoApiGateway "podAntiAffinity" -}}
{{- toYaml .Values.cnoApiGateway.podAntiAffinity | nindent 10 -}}
{{- end }}
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: {{ .Values.cnoApiGateway.nodeSelector }}
operator: Exists
topologyKey: kubernetes.io/hostname
nodeSelector:
{{ .Values.cnoApiGateway.nodeSelector }}: ""
tolerations:
{{- if hasKey .Values.cnoApiGateway "tolerations" -}}
{{- toYaml .Values.cnoApiGateway.tolerations | nindent 8 -}}
{{- end }}
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
value: "reserved"
effect: "NoSchedule"
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
value: "reserved"
effect: "NoExecute"
containers:
- args:
- serve
Expand Down Expand Up @@ -631,13 +635,14 @@ spec:
app: envoy
spec:
nodeSelector:
{{- if hasKey .Values.cnoApiGateway "nodeSelector" -}}
{{- toYaml .Values.cnoApiGateway.nodeSelector | nindent 8 -}}
{{- end }}
{{ .Values.cnoApiGateway.nodeSelector }}: ""
tolerations:
{{- if hasKey .Values.cnoApiGateway "tolerations" -}}
{{- toYaml .Values.cnoApiGateway.tolerations | nindent 8 -}}
{{- end }}
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
value: "reserved"
effect: "NoSchedule"
- key: {{ .Values.cnoApiGateway.tolerationsKey }}
value: "reserved"
effect: "NoExecute"
containers:
- command:
- /bin/contour
Expand Down
21 changes: 2 additions & 19 deletions deploy/helm/data-plane/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,5 @@ monitoring:

cnoApiGateway:
type: loadBalancer

podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: node-role.kubernetes.io/ingress-cno
operator: Exists
topologyKey: kubernetes.io/hostname

tolerations:
- key: "ingress-cno"
value: "reserved"
effect: "NoSchedule"
- key: "ingress-cno"
value: "reserved"
effect: "NoExecute"

nodeSelector:
node-role.kubernetes.io/ingress-cno: ""
nodeSelector: node-role.kubernetes.io/ingress-cno
tolerationsKey: ingress-cno
Binary file modified docs/cno-agent-v2.0.2.tgz
Binary file not shown.

0 comments on commit ea0c3b6

Please sign in to comment.