Skip to content

Commit fcd54b3

Browse files
authored
fix(rbac)[ISSUE-17]: fix rbac for argocd-rbac-cm (#20)
* fix(rbac)[ISSUE-17]: fix rbac for argocd-rbac-cm Signed-off-by: Georgy Khromov <[email protected]> * bump image version Signed-off-by: Georgy Khromov <[email protected]> --------- Signed-off-by: Georgy Khromov <[email protected]>
1 parent 00fcbc1 commit fcd54b3

File tree

11 files changed

+71
-57
lines changed

11 files changed

+71
-57
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# VERSION defines the project version for the bundle.
22
# Update this value when you upgrade the version of your project.
3-
VERSION ?= 0.1.5
3+
VERSION ?= 0.1.6
44

55
# Try to detect Docker or Podman
66
CONTAINER_TOOL := $(shell command -v docker 2> /dev/null)
@@ -148,11 +148,13 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
148148
.PHONY: deploy
149149
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
150150
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
151-
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
151+
$(KUSTOMIZE) build config/default | $(KUBECTL) apply --server-side=true -f -
152+
$(KUSTOMIZE) build config/cm-role | $(KUBECTL) apply --server-side=true -f -
152153

153154
.PHONY: undeploy
154155
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
155156
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
157+
$(KUSTOMIZE) build config/cm-role | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
156158

157159
##@ Dependencies
158160

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Go Report Card](https://goreportcard.com/badge/github.com/argoproj-labs/argocd-rbac-operator)](https://goreportcard.com/report/github.com/argoproj-labs/argocd-rbac-operator)
44
[![go.mod Go version](https://img.shields.io/github/go-mod/go-version/argoproj-labs/argocd-rbac-operator)](https://github.com/argoproj-labs/argocd-rbac-operator)
5-
[![GitHub Release](https://img.shields.io/github/v/release/argoproj-labs/argocd-rbac-operator)](https://github.com/argoproj-labs/argocd-rbac-operator/releases/tag/v0.1.5)
5+
[![GitHub Release](https://img.shields.io/github/v/release/argoproj-labs/argocd-rbac-operator)](https://github.com/argoproj-labs/argocd-rbac-operator/releases/tag/v0.1.6)
66

77
Kubernetes Operator for Argo CD RBAC Management.
88

config/cm-role/kustomization.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Value of this field is prepended to the
2+
# names of all resources, e.g. a deployment named
3+
# "wordpress" becomes "alices-wordpress".
4+
# Note that it should also match with the prefix (text before '-') of the namespace
5+
# field above.
6+
namePrefix: argocd-rbac-operator-
7+
8+
resources:
9+
- role.yaml
10+
- role_binding.yaml

config/cm-role/role.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: Role
3+
metadata:
4+
name: manager-role
5+
namespace: argocd
6+
rules:
7+
- apiGroups:
8+
- ""
9+
resourceNames:
10+
- argocd-rbac-cm
11+
resources:
12+
- configmaps
13+
verbs:
14+
- get
15+
- list
16+
- patch
17+
- update
18+
- watch

config/cm-role/role_binding.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: RoleBinding
3+
metadata:
4+
labels:
5+
app.kubernetes.io/name: argocd-rbac-operator
6+
app.kubernetes.io/managed-by: kustomize
7+
name: manager-rolebinding
8+
namespace: argocd
9+
roleRef:
10+
apiGroup: rbac.authorization.k8s.io
11+
kind: Role
12+
name: manager-role
13+
subjects:
14+
- kind: ServiceAccount
15+
name: argocd-rbac-operator-controller-manager
16+
namespace: argocd-rbac-operator-system

config/default/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,4 @@ resources:
144144
# options:
145145
# delimiter: '.'
146146
# index: 1
147-
# create: true
147+
# create: true

config/manager/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ kind: Kustomization
55
images:
66
- name: controller
77
newName: quay.io/argoprojlabs/argocd-rbac-operator
8-
newTag: v0.1.5
8+
newTag: v0.1.6

config/rbac/role.yaml

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,52 @@ kind: ClusterRole
44
metadata:
55
name: manager-role
66
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- configmaps
11+
verbs:
12+
- list
713
- apiGroups:
814
- rbac-operator.argoproj-labs.io
915
resources:
1016
- argocdrolebindings
1117
verbs:
18+
- '*'
1219
- get
1320
- list
14-
- update
15-
- watch
1621
- apiGroups:
1722
- rbac-operator.argoproj-labs.io
1823
resources:
1924
- argocdrolebindings/finalizers
2025
verbs:
21-
- update
26+
- '*'
2227
- apiGroups:
2328
- rbac-operator.argoproj-labs.io
2429
resources:
2530
- argocdrolebindings/status
2631
verbs:
27-
- get
28-
- patch
29-
- update
32+
- '*'
3033
- apiGroups:
3134
- rbac-operator.argoproj-labs.io
3235
resources:
3336
- argocdroles
3437
verbs:
38+
- '*'
3539
- get
3640
- list
37-
- update
38-
- watch
3941
- apiGroups:
4042
- rbac-operator.argoproj-labs.io
4143
resources:
4244
- argocdroles/finalizers
4345
verbs:
44-
- update
46+
- '*'
4547
- apiGroups:
4648
- rbac-operator.argoproj-labs.io
4749
resources:
4850
- argocdroles/status
4951
verbs:
52+
- '*'
5053
- get
5154
- patch
5255
- update
53-
---
54-
apiVersion: rbac.authorization.k8s.io/v1
55-
kind: Role
56-
metadata:
57-
name: manager-role
58-
namespace: argocd
59-
rules:
60-
- apiGroups:
61-
- ""
62-
resourceNames:
63-
- argocd-rbac-cm
64-
resources:
65-
- configmaps
66-
verbs:
67-
- get
68-
- list
69-
- patch
70-
- update
71-
- watch

config/rbac/role_binding.yaml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,6 @@ roleRef:
1010
kind: ClusterRole
1111
name: manager-role
1212
subjects:
13-
- kind: ServiceAccount
14-
name: controller-manager
15-
namespace: system
16-
---
17-
apiVersion: rbac.authorization.k8s.io/v1
18-
kind: RoleBinding
19-
metadata:
20-
labels:
21-
app.kubernetes.io/name: argocd-rbac-operator
22-
app.kubernetes.io/managed-by: kustomize
23-
name: manager-rolebinding
24-
roleRef:
25-
apiGroup: rbac.authorization.k8s.io
26-
kind: Role
27-
name: manager-role
28-
subjects:
2913
- kind: ServiceAccount
3014
name: controller-manager
3115
namespace: system

internal/controller/argocdrole_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ type ArgoCDRoleReconciler struct {
4242
Scheme *runtime.Scheme
4343
}
4444

45-
// +kubebuilder:rbac:groups=rbac-operator.argoproj-labs.io,resources=argocdroles,verbs=get;list;watch;update
46-
// +kubebuilder:rbac:groups=rbac-operator.argoproj-labs.io,resources=argocdroles/status,verbs=get;update;patch
47-
// +kubebuilder:rbac:groups=rbac-operator.argoproj-labs.io,resources=argocdroles/finalizers,verbs=update
45+
// +kubebuilder:rbac:groups=rbac-operator.argoproj-labs.io,resources=argocdroles,verbs=*
46+
// +kubebuilder:rbac:groups=rbac-operator.argoproj-labs.io,resources=argocdroles/status,verbs=*
47+
// +kubebuilder:rbac:groups=rbac-operator.argoproj-labs.io,resources=argocdroles/finalizers,verbs=*
4848
// +kubebuilder:rbac:groups=rbac-operator.argoproj-labs.io,resources=argocdrolebindings,verbs=get;list
49-
// +kubebuilder:rbac:groups=core,resources=configmaps,resourceNames=argocd-rbac-cm,namespace=argocd,verbs=get;list;watch;update;patch
49+
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=list
5050

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

0 commit comments

Comments
 (0)