Skip to content

Commit 64c916b

Browse files
Fix#38 (#39)
* fix #30 Signed-off-by: raffaelespazzoli <raffaele.spazzoli@gmail.com> * fix #38 Signed-off-by: raffaelespazzoli <raffaele.spazzoli@gmail.com>
1 parent 988e3bf commit 64c916b

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

config/rbac/role.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ rules:
4949
- get
5050
- list
5151
- watch
52+
- apiGroups:
53+
- authentication.k8s.io
54+
resources:
55+
- '*'
56+
verbs:
57+
- impersonate
5258
- apiGroups:
5359
- redhatcop.redhat.io
5460
resources:

controllers/customresourcedefinition_controller.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ func (r *CustomResourceDefinitionReconciler) setModels(openapiModels openapi.Mod
6969
}
7070

7171
//+kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch
72-
//+kubebuilder:rbac:groups="",resources=users;groups;serviceaccounts,verbs=impersonate
7372

7473
// Reconcile is part of the main kubernetes reconciliation loop which aims to
7574
// move the current state of the cluster closer to the desired state.

controllers/patch_controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ type PatchReconciler struct {
4949
//+kubebuilder:rbac:groups="",resources=events,verbs=get;list;watch;create;patch
5050
//+kubebuilder:rbac:groups="",resources=serviceaccounts;secrets,verbs=get;list;watch
5151

52-
// needed by the pacth webhook
52+
// needed by the patch webhook
5353
//+kubebuilder:rbac:groups="*",resources="*",verbs=get;list;watch
54+
//+kubebuilder:rbac:groups="",resources=users;groups;serviceaccounts,verbs=impersonate
55+
//+kubebuilder:rbac:groups="authentication.k8s.io",resources=*,verbs=impersonate
5456

5557
// Reconcile is part of the main kubernetes reconciliation loop which aims to
5658
// move the current state of the cluster closer to the desired state.

readme.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ The patch operator helps with defining patches in a declarative way. This operat
1818
- [Creation-time patch injection](#creation-time-patch-injection)
1919
- [Security Considerations](#security-considerations)
2020
- [Installing the creation time webhook](#installing-the-creation-time-webhook)
21+
- [Enabling creation time time webhook (OLM)](#enabling-creation-time-time-webhook-olm)
22+
- [Enabling creation time time webhook (Helm)](#enabling-creation-time-time-webhook-helm)
23+
- [Webhook rules](#webhook-rules)
2124
- [Runtime patch enforcement](#runtime-patch-enforcement)
2225
- [Patch Controller Security Considerations](#patch-controller-security-considerations)
2326
- [Patch Controller Performance Considerations](#patch-controller-performance-considerations)
@@ -188,9 +191,7 @@ spec:
188191
targetObjectRef:
189192
apiVersion: admissionregistration.k8s.io/v1
190193
kind: MutatingWebhookConfiguration
191-
labelSelector:
192-
matchLabels:
193-
redhat-cop.redhat.io/patch-operator: "true"
194+
name: patch-operator-inject
194195
patchTemplate: '[{"op": "replace", "path": "/webhooks/0/clientConfig/caBundle", "value":"{{ (index (index . 1).data "olmCAKey") }}"}]'
195196
patchType: application/json-patch+json
196197
sourceObjectRefs:
@@ -210,8 +211,6 @@ apiVersion: admissionregistration.k8s.io/v1
210211
kind: MutatingWebhookConfiguration
211212
metadata:
212213
name: patch-operator-inject
213-
labels:
214-
redhat-cop.redhat.io/patch-operator: "true"
215214
webhooks:
216215
- admissionReviewVersions:
217216
- v1

0 commit comments

Comments
 (0)