Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

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 155b61d commit 4b39c6b
Show file tree
Hide file tree
Showing 3 changed files with 439 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
10 changes: 9 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.3.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,17 @@ 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 4b39c6b

Please sign in to comment.