Skip to content

Commit 44e8671

Browse files
committed
tweak roles to fix permission errors
There are two issues here; first, there was a missing permission to create events in the lease namespace, which would lead to failures like the below: ```text E0827 11:25:35.882363 1 event.go:359] "Server rejected event (will not retry!)" err="events is forbidden: User \"system:serviceaccount:venafi:cert-manager-istio-csr\" cannot create resource \"events\" in API group \"\" in the namespace \"asd\"" event="&Event{ObjectMeta:{istio-csr.17ef92345b7ae172 asd 0 0001-01-01 00:00:00 +0000 UTC <nil> <nil> map[] map[] [] [] []},InvolvedObject:ObjectReference{Kind:Lease,Na mespace:asd,Name:istio-csr,UID:ec187de6-fca5-4bb6-accb-ce601cefafb5,APIVersion:coordination.k8s.io/v1,ResourceVersion:245173,FieldPath:,},Reason:LeaderElection,Message:cert-manager-istio-csr-65f98db858-966lz_68e 4de58-2685-42fc-90a4-ae5ee49e2472 became leader,Source:EventSource{Component:cert-manager-istio-csr-65f98db858-966lz_68e4de58-2685-42fc-90a4-ae5ee49e2472,Host:,},FirstTimestamp:2024-08-27 11:25:35.876923762 +0000 U TC m=+15.995353297,LastTimestamp:2024-08-27 11:25:35.876923762 +0000 UTC m=+15.995353297,Count:1,Type:Normal,EventTime:0001-01-01 00:00:00 +0000 UTC,Series:nil,Action:,Related:nil,ReportingController:cert-manager-i stio-csr-65f98db858-966lz_68e4de58-2685-42fc-90a4-ae5ee49e2472,ReportingInstance:,}" ``` Second, the permissions for creating the dynamic istiod cert were tied to the wrong namespace. Signed-off-by: Ashley Davis <[email protected]>
1 parent 824884f commit 44e8671

File tree

4 files changed

+41
-14
lines changed

4 files changed

+41
-14
lines changed

deploy/charts/istio-csr/templates/role.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,3 @@ rules:
2626
verbs: ["get", "list", "watch"]
2727
resourceNames: [{{ . | quote }}]
2828
{{- end }}
29-
{{- if eq (toString .Values.app.tls.istiodCertificateEnable) "dynamic" }}
30-
- apiGroups:
31-
- "cert-manager.io"
32-
resources:
33-
- "certificates"
34-
verbs:
35-
- "get"
36-
- "create"
37-
- "update"
38-
- "delete"
39-
- "watch"
40-
- "list"
41-
{{- end }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- if eq (toString .Values.app.tls.istiodCertificateEnable) "dynamic" }}
2+
kind: Role
3+
apiVersion: rbac.authorization.k8s.io/v1
4+
metadata:
5+
labels:
6+
{{- include "cert-manager-istio-csr.labels" . | nindent 4 }}
7+
name: {{ include "cert-manager-istio-csr.name" . }}-dynamic-istiod
8+
namespace: {{ .Values.app.istio.namespace }}
9+
rules:
10+
- apiGroups:
11+
- "cert-manager.io"
12+
resources:
13+
- "certificates"
14+
verbs:
15+
- "get"
16+
- "create"
17+
- "update"
18+
- "delete"
19+
- "watch"
20+
- "list"
21+
{{- end }}
22+

deploy/charts/istio-csr/templates/role_leases.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ rules:
1616
- "update"
1717
- "watch"
1818
- "list"
19-
19+
- apiGroups: [""]
20+
resources: ["events"]
21+
verbs: ["create"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
kind: RoleBinding
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
metadata:
4+
name: {{ include "cert-manager-istio-csr.name" . }}-dynamic-istiod
5+
namespace: {{ .Values.app.istio.namespace }}
6+
labels:
7+
{{- include "cert-manager-istio-csr.labels" . | nindent 4 }}
8+
roleRef:
9+
apiGroup: rbac.authorization.k8s.io
10+
kind: Role
11+
name: {{ include "cert-manager-istio-csr.name" . }}-dynamic-istiod
12+
subjects:
13+
- kind: ServiceAccount
14+
name: {{ include "cert-manager-istio-csr.name" . }}
15+
namespace: {{ .Release.Namespace }}
16+

0 commit comments

Comments
 (0)