Skip to content

Commit f169bb4

Browse files
author
Per Goncalves da Silva
committed
Update experimental manifest and code generation
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 87b9da5 commit f169bb4

File tree

7 files changed

+101
-7
lines changed

7 files changed

+101
-7
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) #EXHELP Generate WebhookConfiguration,
150150
# Generate CRDs via our own generator
151151
hack/tools/update-crds.sh
152152
# Generate the remaining operator-controller manifests
153-
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/operator-controller/..." output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)
153+
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/operator-controller/..." output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)/standard
154+
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS),experimental rbac:roleName=manager-role paths="./internal/operator-controller/..." output:rbac:artifacts:config=$(KUSTOMIZE_OPCON_RBAC_DIR)/experimental
154155
# Generate the remaining catalogd manifests
155156
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=manager-role paths="./internal/catalogd/..." output:rbac:artifacts:config=$(KUSTOMIZE_CATD_RBAC_DIR)
156157
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=$(KUSTOMIZE_CATD_WEBHOOKS_DIR)
@@ -164,7 +165,7 @@ manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) #EXHELP Generate WebhookConfiguration,
164165
.PHONY: generate
165166
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
166167
@find . -name "zz_generated.deepcopy.go" -delete # Need to delete the files for them to be generated properly
167-
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) object:headerFile="hack/boilerplate.go.txt" paths="./..."
168+
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS),experimental object:headerFile="hack/boilerplate.go.txt" paths="./..."
168169

169170
.PHONY: verify
170171
verify: k8s-pin kind-verify-versions fmt generate manifests crd-ref-docs generate-test-data #HELP Verify all generated code is up-to-date. Runs k8s-pin instead of just tidy.
@@ -380,7 +381,7 @@ BINARIES=operator-controller catalogd
380381

381382
.PHONY: $(BINARIES)
382383
$(BINARIES):
383-
go build $(GO_BUILD_FLAGS) $(GO_BUILD_EXTRA_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@
384+
go build $(GO_BUILD_FLAGS) $(GO_BUILD_EXTRA_FLAGS) -tags '$(GO_BUILD_TAGS),experimental' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@
384385

385386
.PHONY: build-deps
386387
build-deps: manifests generate fmt
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resources:
2+
- role.yaml

config/base/operator-controller/rbac/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ resources:
44
# if your manager will use a service account that exists at
55
# runtime. Be sure to update RoleBinding and ClusterRoleBinding
66
# subjects if changing service account names.
7+
- standard
78
- service_account.yaml
8-
- role.yaml
99
- role_binding.yaml
1010
- leader_election_role.yaml
1111
- leader_election_role_binding.yaml
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resources:
2+
- role.yaml
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: manager-role
6+
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- serviceaccounts/token
11+
verbs:
12+
- create
13+
- apiGroups:
14+
- apiextensions.k8s.io
15+
resources:
16+
- customresourcedefinitions
17+
verbs:
18+
- get
19+
- apiGroups:
20+
- olm.operatorframework.io
21+
resources:
22+
- clustercatalogs
23+
verbs:
24+
- get
25+
- list
26+
- watch
27+
- apiGroups:
28+
- olm.operatorframework.io
29+
resources:
30+
- clusterextensions
31+
verbs:
32+
- get
33+
- list
34+
- patch
35+
- update
36+
- watch
37+
- apiGroups:
38+
- olm.operatorframework.io
39+
resources:
40+
- clusterextensions/finalizers
41+
verbs:
42+
- update
43+
- apiGroups:
44+
- olm.operatorframework.io
45+
resources:
46+
- clusterextensions/status
47+
verbs:
48+
- patch
49+
- update
50+
- apiGroups:
51+
- rbac.authorization.k8s.io
52+
resources:
53+
- clusterrolebindings
54+
- clusterroles
55+
- rolebindings
56+
- roles
57+
verbs:
58+
- list
59+
- watch
60+
---
61+
apiVersion: rbac.authorization.k8s.io/v1
62+
kind: Role
63+
metadata:
64+
name: manager-role
65+
namespace: system
66+
rules:
67+
- apiGroups:
68+
- ""
69+
resources:
70+
- secrets
71+
verbs:
72+
- create
73+
- delete
74+
- deletecollection
75+
- get
76+
- list
77+
- patch
78+
- update
79+
- watch
80+
- apiGroups:
81+
- ""
82+
resources:
83+
- serviceaccounts
84+
verbs:
85+
- get
86+
- list
87+
- watch

hack/tools/update-crds.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ set -e
77
# The names of the generated CRDs
88
CE="olm.operatorframework.io_clusterextensions.yaml"
99
CC="olm.operatorframework.io_clustercatalogs.yaml"
10+
CR="olm.operatorframework.io_clusterextensionrevisions.yaml"
1011

1112
# order for modules and crds must match
1213
# each item in crds must be unique, and should be associated with a module
13-
modules=("operator-controller" "catalogd")
14-
crds=("${CE}" "${CC}")
14+
modules=("operator-controller" "catalogd" "operator-controller")
15+
crds=("${CE}" "${CC}" "${CR}")
1516

1617
# Channels must much those in the generator
1718
channels=("standard" "experimental")
@@ -38,7 +39,8 @@ done
3839
# Copy the generated files
3940
for b in ${!modules[@]}; do
4041
for c in ${channels[@]}; do
41-
cp ${CRD_TMP}/${c}/${crds[${b}]} config/base/${modules[${b}]}/crd/${c}
42+
SRC="${CRD_TMP}/${c}/${crds[${b}]}"
43+
[[ -e "${SRC}" ]] && cp "${SRC}" config/base/${modules[${b}]}/crd/${c}
4244
done
4345
done
4446

0 commit comments

Comments
 (0)