Skip to content

Commit

Permalink
[2.18] cert-manager: Backport cert-manager leader election namespace …
Browse files Browse the repository at this point in the history
…fixes from master

- cert-manager: Fix incorrect leader election namespace lead to insufficient permission (kubernetes-sigs#8433)
- cert-manager: Allow to change leader election namespace for GKE Autopilot support (kubernetes-sigs#8424)
  • Loading branch information
rtsp committed Apr 4, 2022
1 parent f091b1c commit 0b42623
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions inventory/sample/group_vars/k8s_cluster/addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ cert_manager_enabled: false
# -----BEGIN CERTIFICATE-----
# [REPLACE with your CA certificate]
# -----END CERTIFICATE-----
# cert_manager_leader_election_namespace: kube-system

# MetalLB deployment
metallb_enabled: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
cert_manager_namespace: "cert-manager"
cert_manager_user: 1001

## Change leader election namespace when deploying on GKE Autopilot that forbid the changes on kube-system namespace.
## See https://github.com/jetstack/cert-manager/issues/3717
cert_manager_leader_election_namespace: kube-system
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: cert-manager-cainjector:leaderelection
namespace: {{ cert_manager_namespace }}
namespace: {{ cert_manager_leader_election_namespace }}
labels:
app: cainjector
app.kubernetes.io/name: cainjector
Expand Down Expand Up @@ -664,7 +664,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: cert-manager:leaderelection
namespace: {{ cert_manager_namespace }}
namespace: {{ cert_manager_leader_election_namespace }}
labels:
app: cert-manager
app.kubernetes.io/name: cert-manager
Expand Down Expand Up @@ -719,7 +719,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: cert-manager-cainjector:leaderelection
namespace: {{ cert_manager_namespace }}
namespace: {{ cert_manager_leader_election_namespace }}
labels:
app: cainjector
app.kubernetes.io/name: cainjector
Expand All @@ -742,7 +742,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: cert-manager:leaderelection
namespace: {{ cert_manager_namespace }}
namespace: {{ cert_manager_leader_election_namespace }}
labels:
app: cert-manager
app.kubernetes.io/name: cert-manager
Expand Down Expand Up @@ -866,7 +866,7 @@ spec:
imagePullPolicy: {{ k8s_image_pull_policy }}
args:
- --v=2
- --leader-election-namespace=kube-system
- --leader-election-namespace={{ cert_manager_leader_election_namespace }}
env:
- name: POD_NAMESPACE
valueFrom:
Expand Down Expand Up @@ -928,7 +928,7 @@ spec:
args:
- --v=2
- --cluster-resource-namespace=$(POD_NAMESPACE)
- --leader-election-namespace=kube-system
- --leader-election-namespace={{ cert_manager_leader_election_namespace }}
ports:
- containerPort: 9402
protocol: TCP
Expand Down

0 comments on commit 0b42623

Please sign in to comment.