Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tolerations / nodeselector / affinity to cert-manager #8389

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions inventory/sample/group_vars/k8s_cluster/addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,24 @@ ingress_alb_enabled: false
# Cert manager deployment
cert_manager_enabled: false
# cert_manager_namespace: "cert-manager"
# cert_manager_tolerations:
# - key: node-role.kubernetes.io/master
# effect: NoSchedule
# - key: node-role.kubernetes.io/control-plane
# effect: NoSchedule
# cert_manager_affinity:
# nodeAffinity:
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 100
# preference:
# matchExpressions:
# - key: node-role.kubernetes.io/control-plane
# operator: In
# values:
# - ""
# cert_manager_nodeselector:
# kubernetes.io/os: "linux"

# cert_manager_trusted_internal_ca: |
# -----BEGIN CERTIFICATE-----
# [REPLACE with your CA certificate]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
cert_manager_namespace: "cert-manager"
cert_manager_user: 1001
cert_manager_tolerations: []
cert_manager_affinity: {}
cert_manager_nodeselector: {}
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,18 @@ spec:
fieldPath: metadata.namespace
resources:
{}
{% if cert_manager_tolerations %}
tolerations:
{{ cert_manager_tolerations | to_nice_yaml(indent=2) | indent(width=8) }}
{% endif %}
{% if cert_manager_nodeselector %}
nodeSelector:
{{ cert_manager_nodeselector | to_nice_yaml | indent(width=8) }}
{% endif %}
{% if cert_manager_affinity %}
affinity:
{{ cert_manager_affinity | to_nice_yaml | indent(width=8) }}
{% endif %}
---
{% if cert_manager_trusted_internal_ca is defined %}
apiVersion: v1
Expand Down Expand Up @@ -939,6 +951,18 @@ spec:
fieldPath: metadata.namespace
resources:
{}
{% if cert_manager_tolerations %}
tolerations:
{{ cert_manager_tolerations | to_nice_yaml(indent=2) | indent(width=8) }}
{% endif %}
{% if cert_manager_nodeselector %}
nodeSelector:
{{ cert_manager_nodeselector | to_nice_yaml | indent(width=8) }}
{% endif %}
{% if cert_manager_affinity %}
affinity:
{{ cert_manager_affinity | to_nice_yaml | indent(width=8) }}
{% endif %}
Comment on lines +954 to +965
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this block needs to be moved below the next block, since using both cert_manager_trusted_internal_ca and one of these 3 options causes volumeMounts to become a key under the wrong branch (it should be under containers above).

Just ran into this issue, thought I'd post it here in case anyone wants to check or fix it.

{% if cert_manager_trusted_internal_ca is defined %}
volumeMounts:
- mountPath: /etc/ssl/certs/internal-ca.pem
Expand Down Expand Up @@ -1023,6 +1047,18 @@ spec:
fieldPath: metadata.namespace
resources:
{}
{% if cert_manager_tolerations %}
tolerations:
{{ cert_manager_tolerations | to_nice_yaml(indent=2) | indent(width=8) }}
{% endif %}
{% if cert_manager_nodeselector %}
nodeSelector:
{{ cert_manager_nodeselector | to_nice_yaml | indent(width=8) }}
{% endif %}
{% if cert_manager_affinity %}
affinity:
{{ cert_manager_affinity | to_nice_yaml | indent(width=8) }}
{% endif %}
---
# Source: cert-manager/templates/webhook-mutating-webhook.yaml
apiVersion: admissionregistration.k8s.io/v1
Expand Down