@@ -20,7 +20,7 @@ OLD_VARS := $(.VARIABLES)
2020-include Makefile.vendor.mk
2121
2222VERSION ?= 0.2.0
23- MINOR_VERSION := $(shell v=' $( VERSION ) '; echo "$${v % . * }" )
23+ MINOR_VERSION := $(shell echo "${VERSION}" | cut -f1,2 -d'.' )
2424
2525OPERATOR_NAME ?= sailoperator
2626VERSIONS_YAML_FILE ?= versions.yaml
@@ -268,13 +268,28 @@ uninstall: verify-kubeconfig ## Uninstall CRDs from an existing cluster.
268268helm-package : helm operator-chart # # Package the helm chart.
269269 $(HELM ) package chart --destination $(REPO_ROOT ) /out
270270
271- .PHONY : helm-publish
272- helm-publish : helm-package # # Create a GitHub release and upload the helm charts package to it.
271+ # optional flags for 'gh release create' cmd
272+ GH_RELEASE_ADDITIONAL_FLAGS =
273+ # set to true to label the GH release as non-production ready
274+ GH_PRE_RELEASE ?= false
275+ ifeq ($(GH_PRE_RELEASE ) ,true)
276+ GH_RELEASE_ADDITIONAL_FLAGS += --prerelease
277+ endif
278+
279+ # create a draft by default to avoid creating real GH release by accident
280+ GH_RELEASE_DRAFT ?= true
281+ ifeq ($(GH_RELEASE_DRAFT ) ,true)
282+ GH_RELEASE_ADDITIONAL_FLAGS += --draft
283+ endif
284+
285+ .PHONY : create-gh-release
286+ create-gh-release : helm-package # # Create a GitHub release and upload the helm charts package to it.
273287 export GITHUB_TOKEN=$(GITHUB_TOKEN )
274288 gh release create $(VERSION ) $(REPO_ROOT ) /out/sail-operator-$(VERSION ) .tgz \
275289 --target release-$(MINOR_VERSION ) \
276- --title " sail-operator $( VERSION) " \
277- --generate-notes
290+ --title " Sail Operator $( VERSION) " \
291+ --generate-notes \
292+ $(GH_RELEASE_ADDITIONAL_FLAGS )
278293
279294.PHONY : deploy
280295deploy : verify-kubeconfig helm # # Deploy controller to an existing cluster.
@@ -299,7 +314,7 @@ deploy-yaml-openshift: verify-kubeconfig helm ## Output YAML manifests used by `
299314.PHONY : deploy-olm
300315deploy-olm : verify-kubeconfig bundle bundle-build bundle-push # # Build and push the operator OLM bundle and deploy the operator using OLM.
301316 kubectl create ns ${NAMESPACE} || echo " namespace ${NAMESPACE} already exists"
302- $(OPERATOR_SDK ) run bundle $(BUNDLE_IMG ) -n ${NAMESPACE}
317+ $(OPERATOR_SDK ) run bundle $(BUNDLE_IMG ) -n ${NAMESPACE} --skip-tls
303318
304319.PHONY : undeploy
305320undeploy : verify-kubeconfig # # Undeploy controller from an existing cluster.
@@ -359,8 +374,8 @@ gen-charts: ## Pull charts from istio repository.
359374 @# update the urn:alm:descriptor:com.tectonic.ui:select entries in istio_types.go to match the supported versions of the Helm charts
360375 @hack/update-version-list.sh
361376
362- @# calls copy-crds.sh with the version specified in the .crdSourceVersion field in versions.yaml
363- @hack/copy- crds.sh "resources/$$(yq eval '.crdSourceVersion' $(VERSIONS_YAML_FILE))/charts"
377+ @# extract the Istio CRD YAMLs from the istio.io/istio dependency in go.mod into ./chart/crds
378+ @hack/extract-istio- crds.sh
364379
365380.PHONY : gen
366381gen : gen-all-except-bundle bundle # # Generate everything.
@@ -483,9 +498,17 @@ gitleaks: $(GITLEAKS) ## Download gitleaks to bin directory.
483498$(GITLEAKS ) : $(LOCALBIN )
484499 @test -s $(LOCALBIN ) /gitleaks || GOBIN=$(LOCALBIN ) go install github.com/zricethezav/gitleaks/v8@${GITLEAKS_VERSION}
485500
501+ # Openshift Platform flag
502+ # If is set to true will add `--set platform=openshift` to the helm template command
503+ OPENSHIFT_PLATFORM ?= true
504+
486505.PHONY : bundle
487506bundle : gen-all-except-bundle helm operator-sdk # # Generate bundle manifests and metadata, then validate generated files.
488- $(HELM ) template chart chart $(HELM_TEMPL_DEF_FLAGS ) --set image=' $(IMAGE)' --set platform=openshift --set bundleGeneration=true | $(OPERATOR_SDK ) generate bundle $(BUNDLE_GEN_FLAGS )
507+ @TEMPL_FLAGS=" $( HELM_TEMPL_DEF_FLAGS) " ; \
508+ if [ " $( OPENSHIFT_PLATFORM) " = " true" ]; then \
509+ TEMPL_FLAGS=" $$ TEMPL_FLAGS --set platform=openshift" ; \
510+ fi ; \
511+ $(HELM ) template chart chart $$ TEMPL_FLAGS --set image=' $(IMAGE)' --set bundleGeneration=true | $(OPERATOR_SDK ) generate bundle $(BUNDLE_GEN_FLAGS )
489512
490513ifeq ($(GENERATE_RELATED_IMAGES ) , true)
491514 @hack/patch-csv.sh bundle/manifests/$(OPERATOR_NAME).clusterserviceversion.yaml
@@ -537,10 +560,6 @@ bundle-publish-nightly: OPERATOR_VERSION=$(VERSION)-nightly-$(TODAY) ## Publish
537560bundle-publish-nightly : TAG=$(MINOR_VERSION ) -nightly-$(TODAY )
538561bundle-publish-nightly : bundle-nightly bundle-publish
539562
540- .PHONY : patch-istio-crd
541- patch-istio-crd : # # Update Istio CRD's openAPIV3Schema values.
542- @hack/patch-istio-crd.sh
543-
544563.PHONY : opm $(OPM )
545564opm : $(OPM )
546565opm : OS=$(shell go env GOOS)
0 commit comments