Skip to content

Commit

Permalink
Add config for webhook-cert-manager tolerations (#712)
Browse files Browse the repository at this point in the history
* Add webhookCertManager.tolerations setting

* Add tolerations to webhook cert template

* Add bats test for setting tolerations

* Update CHANGELOG

* Set PR number in CHANGELOG

* Add short desc to webhookCertManager

* Update charts/consul/values.yaml

Co-authored-by: Kyle Schochenmaier <[email protected]>

Co-authored-by: Kyle Schochenmaier <[email protected]>
  • Loading branch information
Thomas Eckert and kschoche committed Sep 17, 2021
1 parent a5820ba commit caea40a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ IMPROVEMENTS:
* Add readiness, liveness and startup probes to the connect inject deployment. [[GH-626](https://github.com/hashicorp/consul-k8s/pull/626)][[GH-701](https://github.com/hashicorp/consul-k8s/pull/701)]
* Add support for setting container security contexts on client and server Pods. [[GH-620](https://github.com/hashicorp/consul-k8s/pull/620)]
* Update Envoy image to 1.18.4 [[GH-699](https://github.com/hashicorp/consul-k8s/pull/699)]
* Add configuration for webhook-cert-manager tolerations [[GH-712](https://github.com/hashicorp/consul-k8s/pull/712)]
* Control Plane
* Add health endpoint to the connect inject webhook that will be healthy when webhook certs are present and not empty. [[GH-626](https://github.com/hashicorp/consul-k8s/pull/626)]
* Catalog Sync: Fix issue registering NodePort services with wrong IPs when a node has multiple IP addresses. [[GH-619](https://github.com/hashicorp/consul-k8s/pull/619)]
Expand Down
5 changes: 5 additions & 0 deletions charts/consul/templates/webhook-cert-manager-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ spec:
- name: config
configMap:
name: {{ template "consul.fullname" . }}-webhook-cert-manager-config
{{- if .Values.webhookCertManager.tolerations }}
tolerations:
{{ tpl .Values.webhookCertManager.tolerations . | indent 8 | trim }}
{{- end}}

{{- end }}
23 changes: 23 additions & 0 deletions charts/consul/test/unit/webhook-cert-manager-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,26 @@ load _helpers
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

@test "webhookCertManager/Deployment: no tolerations by default" {
cd `chart_dir`
local actual=$(helm template \
-s templates/webhook-cert-manager-deployment.yaml \
--set 'controller.enabled=true' \
--set 'connectInject.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.tolerations' | tee /dev/stderr)
[ "${actual}" = "null" ]
}

@test "webhookCertManager/Deployment: tolerations can be set" {
cd `chart_dir`
local actual=$(helm template \
-s templates/webhook-cert-manager-deployment.yaml \
--set 'controller.enabled=true' \
--set 'connectInject.enabled=true' \
--set 'webhookCertManager.tolerations=- key: value' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.tolerations[0].key' | tee /dev/stderr)
[ "${actual}" = "value" ]
}
10 changes: 10 additions & 0 deletions charts/consul/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2240,6 +2240,16 @@ terminatingGateways:
gateways:
- name: terminating-gateway

# Configuration settings for the webhook-cert-manager
# `webhook-cert-manager` ensures that cert bundles are up to date for the mutating webhook.
webhookCertManager:

# Toleration Settings
# This should be a multi-line string matching the Toleration array
# in a PodSpec.
# @type: string
tolerations: null

# Configures a demo Prometheus installation.
prometheus:
# When true, the Helm chart will install a demo Prometheus server instance
Expand Down

0 comments on commit caea40a

Please sign in to comment.