Skip to content

Commit cdc32c3

Browse files
committed
Move service operator RBAC from runtime bindata to OLM bundle
Instead of applying service operator ClusterRoles, ClusterRoleBindings, Roles, RoleBindings, and ServiceAccounts at runtime via bindata, generate them during sync-bindata.sh and stage them into the OLM bundle at bundle build time. This removes the need for the openstack-operator to hold wildcard clusterrole/clusterrolebinding permissions and narrows the remaining role/rolebinding RBAC to specific verbs.
1 parent 71886ab commit cdc32c3

206 files changed

Lines changed: 6528 additions & 7560 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Makefile‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and
161161
.PHONY: bindata
162162
bindata: export LOCAL_BINARIES=$(LOCALBIN)
163163
bindata: kustomize yq ## Call sync bindata script
164-
mkdir -p bindata/crds bindata/rbac bindata/operator
164+
mkdir -p bindata/crds bindata/operator
165165
$(KUSTOMIZE) build config/crd > bindata/crds/crds.yaml
166166
$(KUSTOMIZE) build config/default > bindata/operator/operator.yaml
167167
sed -i bindata/operator/operator.yaml -e "s|replicas:.*|replicas: {{ .OpenStackOperator.Deployment.Replicas }}|"
@@ -170,7 +170,6 @@ bindata: kustomize yq ## Call sync bindata script
170170
sed -i bindata/operator/operator.yaml -e "/customRequests/c\\ cpu: {{ .OpenStackOperator.Deployment.Manager.Resources.Requests.CPU }}\n memory: {{ .OpenStackOperator.Deployment.Manager.Resources.Requests.Memory }}"
171171
sed -i bindata/operator/operator.yaml -e "/customTolerations/c\\ tolerations:\n{{- range .OpenStackOperator.Deployment.Tolerations }}\n - key: \"{{ .Key }}\"\n{{- if .Operator }}\n operator: \"{{ .Operator }}\"\n{{- end }}\n{{- if .Value }}\n value: \"{{ .Value }}\"\n{{- end }}\n{{- if .Effect }}\n effect: \"{{ .Effect }}\"\n{{- end }}\n{{- if .TolerationSeconds }}\n tolerationSeconds: {{ .TolerationSeconds }}\n{{- end }}\n{{- end }}"
172172
cp config/operator/managers.yaml bindata/operator/
173-
$(KUSTOMIZE) build config/rbac > bindata/rbac/rbac.yaml
174173
/bin/bash hack/sync-bindata.sh
175174

176175
.PHONY: fmt
@@ -406,11 +405,14 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada
406405
$(KUSTOMIZE) edit set image controller=$(IMG) && \
407406
$(KUSTOMIZE) edit add patch --kind Deployment --name openstack-operator-controller-init --namespace system --patch "[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/env/0\", \"value\": {\"name\": \"OPENSTACK_RELEASE_VERSION\", \"value\": \"$(OPENSTACK_RELEASE_VERSION)\"}}]" && \
408407
$(KUSTOMIZE) edit add patch --kind Deployment --name openstack-operator-controller-init --namespace system --patch "[{\"op\": \"replace\", \"path\": \"/spec/template/spec/containers/0/env/1\", \"value\": {\"name\": \"OPERATOR_IMAGE_URL\", \"value\": \"$(IMG)\"}}]"
408+
rm -rf bundle/manifests bundle/metadata
409409
$(KUSTOMIZE) build config/operator --load-restrictor='LoadRestrictionsNone' | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
410410
ifneq ($(REPLACES),)
411411
@echo "Adding replaces: $(REPLACES) to CSV"
412412
sed -i "/^ name: openstack-operator.v$(VERSION)/a\ replaces: $(REPLACES)" bundle/manifests/openstack-operator.clusterserviceversion.yaml
413413
endif
414+
@echo "Staging service operator RBAC into bundle manifests"
415+
cp config/operator/bundle-rbac/*.yaml bundle/manifests/
414416
$(OPERATOR_SDK) bundle validate ./bundle
415417

416418
.PHONY: bundle-build

‎bindata/rbac/barbican-operator-rbac.yaml‎

Lines changed: 0 additions & 362 deletions
This file was deleted.

0 commit comments

Comments
 (0)