Skip to content

Commit 550c648

Browse files
committed
Fix generation of testdata of memcached-molecule-operator
Signed-off-by: arkadeepsen <[email protected]>
1 parent 9871a1e commit 550c648

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

hack/generate/samples/ansible/constants.go

+19
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,25 @@ const rolesForBaseOperator = `
518518
- watch
519519
#+kubebuilder:scaffold:rules
520520
`
521+
const rolesForProject = `
522+
##
523+
## Apply customize roles related to project.openshift.io
524+
##
525+
- apiGroups:
526+
- project.openshift.io
527+
resources:
528+
- projectrequests
529+
- projects
530+
verbs:
531+
- create
532+
- delete
533+
- get
534+
- list
535+
- patch
536+
- update
537+
- watch
538+
#+kubebuilder:scaffold:rules
539+
`
521540

522541
const customMetricsTest = `
523542
- name: Search for all running pods

hack/generate/samples/ansible/memcached_molecule.go

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ func ImplementMemcachedMolecule(sample sample.Sample, image string) {
5757
err = kbutil.InsertCode(filepath.Join(sample.Dir(), "roles", strings.ToLower(gvk.Kind), "tasks", "main.yml"),
5858
roleFragment, memcachedWithBlackListTask)
5959
pkg.CheckError("replacing in tasks/main.yml", err)
60+
61+
log.Info("adding RBAC permissions for project.openshift.io")
62+
err = kbutil.ReplaceInFile(filepath.Join(sample.Dir(), "config", "rbac", "role.yaml"),
63+
"#+kubebuilder:scaffold:rules", rolesForProject)
64+
pkg.CheckError("replacing in role.yml", err)
6065
}
6166

6267
if gvk.Kind != "Memcached" {

testdata/memcached-molecule-operator/config/rbac/role.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,23 @@ rules:
106106
- update
107107
- watch
108108

109+
##
110+
## Apply customize roles related to project.openshift.io
111+
##
112+
- apiGroups:
113+
- project.openshift.io
114+
resources:
115+
- projectrequests
116+
- projects
117+
verbs:
118+
- create
119+
- delete
120+
- get
121+
- list
122+
- patch
123+
- update
124+
- watch
125+
109126
##
110127
## Apply customize roles for base operator
111128
##
@@ -124,3 +141,4 @@ rules:
124141
- watch
125142
#+kubebuilder:scaffold:rules
126143

144+

0 commit comments

Comments
 (0)