Skip to content

Commit

Permalink
Fix ServiceAccountName in the OLM bundle
Browse files Browse the repository at this point in the history
The bundle generated by operator-sdk v0.17.0 contains incorrect cluster
permission service account name. This issue is fixed in v0.19.0.
Patch using yq with the correct value.

Refer: operator-framework/operator-sdk#3610

Processing the CSV file via yq changes the indentations, resulting in
unrelated changes to the file.
  • Loading branch information
darkowlzz committed Nov 5, 2020
1 parent fe4ac52 commit 31976c6
Show file tree
Hide file tree
Showing 3 changed files with 440 additions and 430 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ build/_output
build/_test
build/operator-sdk
build/yq
build/yq3
build/golangci-lint
deploy/test
/olm
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ BUNDLE_DIR = $(PWD)/bundle
# Current bundle version is the next release version.
# Bundle generation requires the current version number of the operator.
CURRENT_BUNDLE_VERSION = "2.4.0"
SERVICE_ACCOUNT_NAME = $(shell $(YQ3) r deploy/operator.yaml spec.template.spec.serviceAccountName)
SERVICE_ACCOUNT_PATH = "spec.install.spec.clusterPermissions[0].serviceAccountName"
CSV_FILE = "bundle/manifests/storageosoperator.clusterserviceversion.yaml"

# Set the new version before running the release target.
NEW_VERSION ?= v2.3.0
Expand Down Expand Up @@ -238,12 +241,18 @@ metadata-zip: ## Generate OLM metadata-zip bundle (in package manifest format)
deploy/olm/storageos/storageosnfsserver.crd.yaml \
deploy/olm/csv-rhel/storageos.v*.clusterserviceversion.yaml

bundle: operator-sdk ## Generate operator metadata in bundle format.
bundle: operator-sdk yq3 ## Generate operator metadata in bundle format.
$(OPERATOR_SDK) generate csv \
--update-crds \
--csv-version=$(CURRENT_BUNDLE_VERSION) \
--operator-name=$(OPERATOR_NAME) \
--output-dir=$(BUNDLE_DIR)
# Fix the cluster permission service account name in the generated
# bundle.
# Refer: https://github.com/operator-framework/operator-sdk/pull/3610
# The fix isn't available for operator-sdk < v0.19.0.
$(YQ3) w -i $(CSV_FILE) $(SERVICE_ACCOUNT_PATH) $(SERVICE_ACCOUNT_NAME)


# Generates a single manifest for installing the operator.
install-manifest: yq3 ## Generate operator install manifest file.
Expand Down

0 comments on commit 31976c6

Please sign in to comment.