This repository has been archived by the owner on Oct 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
operator: changes to generate olm-catalog for OperatorHub
Used operator-sdk to generate base manifests and olm-catalog files and using kustomize patch the CSV file with specific changes. These files could be pushed to 'community-operators' for publishing pmem-csi-operator on OperatorHub.
- Loading branch information
Showing
10 changed files
with
237 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
/.tox | ||
Manifest | ||
/_build | ||
|
||
/deploy/crd | ||
/deploy/olm-catalog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Project configuration file used by controller-gen and operator-sdk tools | ||
{ | ||
# Kubebuilder configuration version | ||
version: "2", | ||
domain: "pmem-csi.intel.com", | ||
repo: "github.com/intel/pmem-csi/pkg/pmem-csi-operator", | ||
projectName: "pmem-csi-operator" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
deploy/kustomize/olm-catalog/bases/pmem-csi-operator.clusterserviceversion.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
bases: | ||
- ./crd # this would be generated using: make operator-generate-crd | ||
- ../operator | ||
|
||
resources: | ||
- ../../common/pmem-csi.intel.com_v1alpha1_deployment_cr.yaml | ||
|
||
images: | ||
- name: intel/pmem-csi-driver | ||
newTag: X.Y.Z # this should be replaced with real version number | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
OPERATOR_SDK_VERSION=v0.16.0 | ||
OPERATOR_SDK_VERSION=v1.0.0 | ||
|
||
# download operator-sdk binary | ||
_work/bin/operator-sdk-$(OPERATOR_SDK_VERSION): | ||
|
@@ -12,3 +12,48 @@ _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION): | |
# GOROOT is needed because of https://github.com/operator-framework/operator-sdk/issues/1854#issuecomment-525132306 | ||
operator-generate-k8s: _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION) | ||
GOROOT=$(shell $(GO) env GOROOT) _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION) generate k8s | ||
|
||
# find or download if necessary controller-gen | ||
# this make target is copied from Makefile generated | ||
# by operator-sdk init | ||
controller-gen: | ||
ifeq (, $(shell which controller-gen)) | ||
@{ \ | ||
set -e; \ | ||
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\ | ||
cd $$CONTROLLER_GEN_TMP_DIR ;\ | ||
GOPATH=$$($(GO) env GOPATH) ;\ | ||
$(GO) mod init tmp ;\ | ||
$(GO) get sigs.k8s.io/controller-tools/cmd/[email protected] ;\ | ||
rm -rf $$CONTROLLER_GEN_TMP_DIR; \ | ||
} | ||
CONTROLLER_GEN=$(GOPATH)/bin/controller-gen | ||
else | ||
CONTROLLER_GEN=$(shell which controller-gen) | ||
endif | ||
|
||
MANIFESTS_DIR=deploy/kustomize/olm-catalog | ||
CATALOG_DIR=deploy/olm-catalog | ||
SHORT_VERSION=$(shell echo $(VERSION) | cut -f1,2 -d'.') | ||
|
||
# Generate CRD and add kustomizaiton support | ||
operator-generate-crd: controller-gen | ||
@echo "Generating CRD ..." | ||
$(CONTROLLER_GEN) crd:trivialVersions=true,crdVersions=v1beta1 paths=./pkg/apis/... output:dir=$(MANIFESTS_DIR)/crd/ | ||
@echo "resources: [pmem-csi.intel.com_deployments.yaml]" > $(MANIFESTS_DIR)/crd/kustomization.yaml | ||
|
||
# Generate packagemanifests using operator-sdk. | ||
operator-generate-catalog: _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION) _work/kustomize operator-generate-crd | ||
trap '$(MAKE) operator-clean-crd' EXIT | ||
@echo "Generating base catalog ..." | ||
@sed -i -e 's;X.Y.Z;$(VERSION);g' $(MANIFESTS_DIR)/kustomization.yaml | ||
trap "sed -i -e 's;$(VERSION);X.Y.Z;g' $(MANIFESTS_DIR)/kustomization.yaml" EXIT | ||
@_work/kustomize build --load_restrictor=none $(MANIFESTS_DIR) | $< generate packagemanifests --version $(VERSION) \ | ||
--kustomize-dir $(MANIFESTS_DIR) --output-dir $(CATALOG_DIR) | ||
@sed -i -e 's;X.Y.Z;$(VERSION);g' -e 's;X.Y;$(SHORT_VERSION);g' $(CATALOG_DIR)/$(VERSION)/pmem-csi-operator.clusterserviceversion.yaml | ||
|
||
operator-clean-crd: | ||
rm -rf $(MANIFESTS_DIR)/crd | ||
|
||
operator-clean-catalog: | ||
rm -rf $(CATALOG_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.