From e2bd90f6e20d242900fb412eb8f94e5aec391f95 Mon Sep 17 00:00:00 2001 From: Jeremy Ary Date: Wed, 6 Oct 2021 15:35:22 -0500 Subject: [PATCH] set up for iterative catalog version --- Makefile | 39 +++++++++++++-- .../dbaas-operator.clusterserviceversion.yaml | 10 ++-- config/manager/kustomization.yaml | 2 +- config/manager/manager.yaml | 1 + .../dbaas-operator.clusterserviceversion.yaml | 3 +- config/samples/catalog-source.yaml | 2 +- .../quarkus-crunchydata-sample-app.yaml | 50 +++++++++++++++++++ .../samples/quarkus-mongodb-sample-app.yaml | 49 ++++++++++++++++++ 8 files changed, 145 insertions(+), 11 deletions(-) create mode 100644 config/samples/quarkus-crunchydata-sample-app.yaml create mode 100644 config/samples/quarkus-mongodb-sample-app.yaml diff --git a/Makefile b/Makefile index 0e835088..3794e040 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,27 @@ # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= 0.1.1 +VERSION ?= 0.1.2 + +# OLD_BUNDLE_VERSIONS defines the comma separated list of versions of old bundles to add to the index. +# +# This is NOT required if you are incrementally building the catalog index. If you need to increment on +# a catalog that already HAS old bundles, such as when building/pushing the official release, then you do NOT +# need to uncomment & add the old bundles - the existing "from-index" catalog already has those. +# +# If you are developing and pushing against your OWN quay for testing, you likely need to uncomment +#OLD_BUNDLE_VERSIONS ?= 0.1.0,0.1.1 + +# CATALOG_VERSION defines the version of the index image. +CATALOG_VERSION ?= 0.1 + +# QUAY_ORG indicates the organization that docker images will be build for & pushed to +# CHANGE THIS TO YOUR OWN QUAY USERNAME FOR DEV/TESTING/PUSHING +QUAY_ORG ?= ecosystem-appeng + +# CATALOG_BASE_IMG defines an existing catalog version to build on & add bundles to +CATALOG_BASE_IMG ?= quay.io/$(QUAY_ORG)/dbaas-operator-catalog:v$(CATALOG_VERSION) + export OPERATOR_CONDITION_NAME=dbaas-operator.v$(VERSION) # CHANNELS define the bundle channels used in the bundle. @@ -30,12 +50,19 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) # # For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both # redhat.com/dbaas-operator-bundle:$VERSION and redhat.com/dbaas-operator-catalog:$VERSION. -IMAGE_TAG_BASE ?= quay.io/ecosystem-appeng/dbaas-operator +IMAGE_TAG_BASE ?= quay.io/$(QUAY_ORG)/dbaas-operator # BUNDLE_IMG defines the image:tag used for the bundle. # You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=/:) BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION) +# OLD_BUNDLE_IMGS defines the comma separated list of old bundles to add to the index. +COMMA := , +EMPTY := +SPACE := $(EMPTY) $(EMPTY) +OLD_BUNDLE_IMG_TAG_BASE ?= $(IMAGE_TAG_BASE)-bundle +OLD_BUNDLE_IMGS ?= $(patsubst %$(COMMA),%$(EMPTY),$(subst $(SPACE),$(EMPTY),$(foreach ver,$(subst $(COMMA),$(SPACE),$(OLD_BUNDLE_VERSIONS)),$(OLD_BUNDLE_IMG_TAG_BASE):v$(ver),))) + # Image URL to use all building/pushing image targets IMG ?= $(IMAGE_TAG_BASE):v$(VERSION) # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) @@ -94,7 +121,7 @@ test: manifests generate fmt vet ## Run tests. source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out ##@ Build -release-build: build generate bundle docker-build bundle-build catalog-build ## Build operator docker, bundle, catalog images +release-build: build generate bundle docker-build bundle-build bundle-push catalog-build ## Build operator docker, bundle, catalog images build: generate fmt vet ## Build manager binary. go build -o bin/manager main.go @@ -213,10 +240,14 @@ endif # A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMGS=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0). # These images MUST exist in a registry and be pull-able. +ifeq ($(OLD_BUNDLE_IMGS),) BUNDLE_IMGS ?= $(BUNDLE_IMG) +else +BUNDLE_IMGS ?= $(BUNDLE_IMG),$(OLD_BUNDLE_IMGS) +endif # The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0). -CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(VERSION) +CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(CATALOG_VERSION) # Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image. ifneq ($(origin CATALOG_BASE_IMG), undefined) diff --git a/bundle/manifests/dbaas-operator.clusterserviceversion.yaml b/bundle/manifests/dbaas-operator.clusterserviceversion.yaml index c93de01a..25c471cc 100644 --- a/bundle/manifests/dbaas-operator.clusterserviceversion.yaml +++ b/bundle/manifests/dbaas-operator.clusterserviceversion.yaml @@ -114,7 +114,7 @@ metadata: ] capabilities: Basic Install categories: Database - containerImage: quay.io/ecosystem-appeng/dbaas-operator:latest + containerImage: quay.io/ecosystem-appeng/dbaas-operator:v0.1.2 description: Discover & connect with database instances hosted on 3rd-party ISV cloud platforms. operatorframework.io/suggested-namespace: openshift-dbaas-operator @@ -123,7 +123,7 @@ metadata: operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/RHEcosystemAppEng/dbaas-operator support: dbaas-alpha-support@redhat.com - name: dbaas-operator.v0.1.1 + name: dbaas-operator.v0.1.2 namespace: placeholder spec: apiservicedefinitions: {} @@ -438,7 +438,8 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - image: quay.io/ecosystem-appeng/dbaas-operator:v0.1.1 + image: quay.io/ecosystem-appeng/dbaas-operator:v0.1.2 + imagePullPolicy: Always livenessProbe: httpGet: path: /healthz @@ -525,7 +526,8 @@ spec: provider: name: Red Hat url: https://www.redhat.com - version: 0.1.1 + replaces: dbaas-operator.v0.1.1 + version: 0.1.2 webhookdefinitions: - admissionReviewVersions: - v1 diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 50bc10a4..8a9e0464 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -13,4 +13,4 @@ kind: Kustomization images: - name: controller newName: quay.io/ecosystem-appeng/dbaas-operator - newTag: v0.1.1 + newTag: v0.1.2 diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index dd206c62..cca5c374 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -33,6 +33,7 @@ spec: - --leader-elect image: controller:latest name: manager + imagePullPolicy: Always securityContext: allowPrivilegeEscalation: false livenessProbe: diff --git a/config/manifests/bases/dbaas-operator.clusterserviceversion.yaml b/config/manifests/bases/dbaas-operator.clusterserviceversion.yaml index 07a62585..6a68962e 100644 --- a/config/manifests/bases/dbaas-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/dbaas-operator.clusterserviceversion.yaml @@ -5,7 +5,7 @@ metadata: alm-examples: '[]' capabilities: Basic Install categories: Database - containerImage: quay.io/ecosystem-appeng/dbaas-operator:latest + containerImage: quay.io/ecosystem-appeng/dbaas-operator:v0.1.2 description: Discover & connect with database instances hosted on 3rd-party ISV cloud platforms. operatorframework.io/suggested-namespace: openshift-dbaas-operator @@ -138,4 +138,5 @@ spec: provider: name: Red Hat url: https://www.redhat.com + replaces: dbaas-operator.v0.1.1 version: 0.0.0 diff --git a/config/samples/catalog-source.yaml b/config/samples/catalog-source.yaml index d34b4bbf..15ac0d46 100644 --- a/config/samples/catalog-source.yaml +++ b/config/samples/catalog-source.yaml @@ -5,5 +5,5 @@ metadata: namespace: openshift-marketplace spec: sourceType: grpc - image: quay.io/ecosystem-appeng/dbaas-operator-catalog:v0.0.7 + image: quay.io/ecosystem-appeng/dbaas-operator-catalog:v0.1 displayName: DBaaS Operator \ No newline at end of file diff --git a/config/samples/quarkus-crunchydata-sample-app.yaml b/config/samples/quarkus-crunchydata-sample-app.yaml new file mode 100644 index 00000000..24bbf788 --- /dev/null +++ b/config/samples/quarkus-crunchydata-sample-app.yaml @@ -0,0 +1,50 @@ +apiVersion: v1 +kind: List +items: + - kind: Deployment + apiVersion: apps/v1 + metadata: + name: postgresql-orm-quarkus + spec: + replicas: 1 + selector: + matchLabels: + name: postgresql-orm-quarkus + template: + metadata: + labels: + name: postgresql-orm-quarkus + spec: + containers: + - name: postgresql-orm-quarkus + # Replace this with the built image name + image: quay.io/ecosystem-appeng/postgresql-orm-quarkus:v0.1 + imagePullPolicy: Always + ports: + - containerPort: 8080 + protocol: TCP + - kind: Service + apiVersion: v1 + metadata: + name: postgresql-orm-quarkus + labels: + name: postgresql-orm-quarkus + spec: + ports: + - port: 8080 + protocol: TCP + targetPort: 8080 + selector: + name: postgresql-orm-quarkus + - kind: Route + apiVersion: route.openshift.io/v1 + metadata: + name: postgresql-orm-quarkus + labels: + name: postgresql-orm-quarkus + spec: + port: + targetPort: 8080 + to: + kind: Service + name: postgresql-orm-quarkus \ No newline at end of file diff --git a/config/samples/quarkus-mongodb-sample-app.yaml b/config/samples/quarkus-mongodb-sample-app.yaml new file mode 100644 index 00000000..ef004350 --- /dev/null +++ b/config/samples/quarkus-mongodb-sample-app.yaml @@ -0,0 +1,49 @@ +apiVersion: v1 +kind: List +items: + - kind: Deployment + apiVersion: apps/v1 + metadata: + name: fruit-shop + spec: + replicas: 1 + selector: + matchLabels: + name: fruit-shop + template: + metadata: + labels: + name: fruit-shop + spec: + containers: + - name: fruit-shop + image: quay.io/ecosystem-appeng/mongo-quickstart:0.0.1-SNAPSHOT + imagePullPolicy: Always + ports: + - containerPort: 8080 + protocol: TCP + - kind: Service + apiVersion: v1 + metadata: + name: fruit-shop + labels: + name: fruit-shop + spec: + ports: + - port: 8080 + protocol: TCP + targetPort: 8080 + selector: + name: fruit-shop + - kind: Route + apiVersion: route.openshift.io/v1 + metadata: + name: fruit-shop + labels: + name: fruit-shop + spec: + port: + targetPort: 8080 + to: + kind: Service + name: fruit-shop \ No newline at end of file