Skip to content

Commit

Permalink
Add nodeSelector, affinity and tolerations support (#456)
Browse files Browse the repository at this point in the history
* Add nodeSelector support to deployment template
* Add affinity support to daemonset and deployment templates
* Tolerations changed to be more flexible. Can now be used in
deployments and daemonsets that are not deployed on IBM icp
* Increment helm chart version
* Update helm readme with affinities, tolerations
* Fix icp-values.yaml formatting


Signed-off-by: Dean Coakley <[email protected]>
  • Loading branch information
Dean-Coakley authored Dec 4, 2018
1 parent 9c87d48 commit aef7fa3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deployments/helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: nginx-ingress
version: 0.2.0
version: 0.3.0
appVersion: edge
description: NGINX Ingress Controller
sources:
Expand Down
3 changes: 2 additions & 1 deletion deployments/helm-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ Parameter | Description | Default
`controller.defaultTLS.secret` | The secret with a TLS certificate and key for the default HTTPS server. The value must follow the following format: `<namespace>/<name>`. Used as an alternative to specifiying a certifcate and key using `controller.defaultTLS.cert` and `controller.defaultTLS.key` parameters. | None
`controller.nodeSelector` | The node selector for pod assignment for the Ingress controller pods. | { }
`controller.terminationGracePeriodSeconds` | The termination grace period of the Ingress controller pod. | 30
`controller.tolerations` | The tolerations required for the IBM Cloud Private installation. | None
`controller.tolerations` | The tolerations of the Ingress controller pods. | []
`controller.affinity` | The affinity of the Ingress controller pods. | { }
`controller.replicaCount` | The number of replicas of the Ingress controller deployment. | 1
`controller.service.create` | Creates a service to expose the Ingress controller pods. | true
`controller.service.type` | The type of service to create for the Ingress controller. | LoadBalancer
Expand Down
12 changes: 6 additions & 6 deletions deployments/helm-chart/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ spec:
nodeSelector:
{{ toYaml .Values.controller.nodeSelector | indent 8 }}
{{- end }}
{{- if eq .Values.controller.tolerations "icp" }}
{{- if .Values.controller.tolerations }}
tolerations:
- key: "dedicated"
operator: "Exists"
effect: "NoSchedule"
- key: "CriticalAddonsOnly"
operator: "Exists"
{{ toYaml .Values.controller.tolerations | indent 6 }}
{{- end }}
{{- if .Values.controller.affinity }}
affinity:
{{ toYaml .Values.controller.affinity | indent 8 }}
{{- end }}
hostNetwork: {{ .Values.controller.hostNetwork }}
containers:
Expand Down
12 changes: 12 additions & 0 deletions deployments/helm-chart/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ spec:
prometheus.io/port: "{{ .Values.prometheus.port }}"
{{- end }}
spec:
{{- if .Values.controller.nodeSelector }}
nodeSelector:
{{ toYaml .Values.controller.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.controller.tolerations }}
tolerations:
{{ toYaml .Values.controller.tolerations | indent 6 }}
{{- end }}
{{- if .Values.controller.affinity }}
affinity:
{{ toYaml .Values.controller.affinity | indent 8 }}
{{- end }}
serviceAccountName: {{ .Values.controller.serviceAccount.name }}
hostNetwork: {{ .Values.controller.hostNetwork }}
containers:
Expand Down
12 changes: 9 additions & 3 deletions deployments/helm-chart/values-icp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ controller:
image:
repository: mycluster.icp:8500/kube-system/nginx-plus-ingress
tag: "edge"
nodeSelector: { beta.kubernetes.io/arch: "amd64",
proxy: "true" }
nodeSelector:
beta.kubernetes.io/arch: "amd64"
proxy: true
terminationGracePeriodSeconds: 60
tolerations: "icp"
tolerations:
- key: "dedicated"
operator: "Exists"
effect: "NoSchedule"
- key: "CriticalAddonsOnly"
operator: "Exists"
3 changes: 2 additions & 1 deletion deployments/helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ controller:
# secret: <namespace>/<secret_name>
nodeSelector: {}
terminationGracePeriodSeconds: 30
tolerations: ""
tolerations: []
affinity: {}
replicaCount: 1
ingressClass: nginx
useIngressClassOnly: false
Expand Down

0 comments on commit aef7fa3

Please sign in to comment.