Skip to content

Commit b2b1afa

Browse files
Merge pull request openshift-service-mesh#129 from openshift-service-mesh-bot/none-main-merge_upstream_main-38a843ce
Automator: merge upstream changes to openshift-service-mesh/sail-operator@main
2 parents 3626a8e + f42e722 commit b2b1afa

File tree

10 files changed

+110
-422
lines changed

10 files changed

+110
-422
lines changed

Makefile.core.mk

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ OLD_VARS := $(.VARIABLES)
2020
-include Makefile.vendor.mk
2121

2222
VERSION ?= 0.2.0
23-
MINOR_VERSION := $(shell v='$(VERSION)'; echo "$${v%.*}")
23+
MINOR_VERSION := $(shell echo "${VERSION}" | cut -f1,2 -d'.')
2424

2525
OPERATOR_NAME ?= sailoperator
2626
VERSIONS_YAML_FILE ?= versions.yaml
@@ -268,13 +268,28 @@ uninstall: verify-kubeconfig ## Uninstall CRDs from an existing cluster.
268268
helm-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
280295
deploy: 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
300315
deploy-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
305320
undeploy: 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
366381
gen: 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
487506
bundle: 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

490513
ifeq ($(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
537560
bundle-publish-nightly: TAG=$(MINOR_VERSION)-nightly-$(TODAY)
538561
bundle-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)
545564
opm: $(OPM)
546565
opm: OS=$(shell go env GOOS)

bundle/manifests/servicemeshoperator3.clusterserviceversion.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ metadata:
3333
]
3434
capabilities: Seamless Upgrades
3535
categories: OpenShift Optional, Integration & Delivery, Networking, Security
36-
containerImage: quay.io/maistra-dev/sail-operator:3.0.0-tp-latest
37-
createdAt: "2024-08-21T18:14:55Z"
36+
containerImage: quay.io/maistra-dev/sail-operator:3.0-latest
37+
createdAt: "2024-08-29T15:46:07Z"
3838
description: The OpenShift Service Mesh Operator enables you to install, configure,
3939
and manage an instance of Red Hat OpenShift Service Mesh. OpenShift Service
4040
Mesh is based on the open source Istio project.
@@ -684,7 +684,7 @@ spec:
684684
- --default-profile=openshift
685685
command:
686686
- /manager
687-
image: quay.io/maistra-dev/sail-operator:3.0.0-tp-latest
687+
image: quay.io/maistra-dev/sail-operator:3.0-latest
688688
imagePullPolicy: Always
689689
livenessProbe:
690690
httpGet:

chart/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ csv:
4242
features.operators.openshift.io/cnf: "false"
4343
features.operators.openshift.io/cni: "true"
4444
features.operators.openshift.io/csi: "false"
45-
image: quay.io/maistra-dev/sail-operator:3.0.0-tp-latest
45+
image: quay.io/maistra-dev/sail-operator:3.0-latest
4646
imagePullPolicy: Always
4747

4848
# setting this to true will add resources required to generate the bundle using operator-sdk
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616

1717
set -euo pipefail
1818

19-
: "${CHARTS_DIR:=$1}"
19+
INPUT_FILE="$(go list -m -f '{{.Dir}}' istio.io/istio)/manifests/charts/base/crds/crd-all.gen.yaml"
2020

2121
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
2222
REPO_ROOT=$(dirname "${SCRIPT_DIR}")
2323
OPERATOR_CHART_DIR="${REPO_ROOT}/chart"
2424

2525
function copyCRDs() {
2626
# Split the YAML file into separate CRD files
27-
csplit -s --suppress-matched -f "${OPERATOR_CHART_DIR}/crds/istio-crd" -z "${CHARTS_DIR}/base/crds/crd-all.gen.yaml" '/^---$/' '{*}'
27+
csplit -s --suppress-matched -f "${OPERATOR_CHART_DIR}/crds/istio-crd" -z "${INPUT_FILE}" '/^---$/' '{*}'
2828

29-
# To hide istio CRDs in the OpenShift Console, we add them to the intenral-objects annotation in the CSV
29+
# To hide istio CRDs in the OpenShift Console, we add them to the internal-objects annotation in the CSV
3030
internalObjects=""
3131

3232
# Rename the split files to <api group>_<resource name>.yaml

0 commit comments

Comments
 (0)