Skip to content

Commit

Permalink
Makefile: default CHANNELS
Browse files Browse the repository at this point in the history
doc/development.md: channels doc on custom bundle section

Signed-off-by: Eguzki Astiz Lezaun <eastizle@redhat.com>
  • Loading branch information
eguzki committed Sep 24, 2024
1 parent 3475a1e commit 4aa9abb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 41 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ VERSION ?= 0.0.0
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
ifneq ($(origin CHANNELS), undefined)

CHANNELS ?= alpha
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif

# DEFAULT_CHANNEL defines the default channel used in the bundle.
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
Expand Down
40 changes: 24 additions & 16 deletions doc/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,16 @@ bundle and a custom catalog including the custom bundle.

The `make bundle` target accepts the following variables:

| **Makefile Variable** | **Description** | **Default value** | **Notes** |
|---------------------------------|-------------------------------|-----------------------------------------------------|----------------------------------------------------------------------------------------------------|
| `IMG` | Kuadrant operator image URL | `quay.io/kuadrant/kuadrant-operator:latest` | `TAG` var could be use to build this URL, defaults to _latest_ if not provided |
| `VERSION` | Bundle version | `0.0.0` | |
| `LIMITADOR_OPERATOR_BUNDLE_IMG` | Limitador operator bundle URL | `quay.io/kuadrant/limitador-operator-bundle:latest` | `LIMITADOR_OPERATOR_VERSION` var could be used to build this, defaults to _latest_ if not provided |
| `AUTHORINO_OPERATOR_BUNDLE_IMG` | Authorino operator bundle URL | `quay.io/kuadrant/authorino-operator-bundle:latest` | `AUTHORINO_OPERATOR_VERSION` var could be used to build this, defaults to _latest_ if not provided |
| `DNS_OPERATOR_BUNDLE_IMG` | DNS operator bundle URL | `quay.io/kuadrant/dns-operator-bundle:latest` | `DNS_OPERATOR_BUNDLE_IMG` var could be used to build this, defaults to _latest_ if not provided |
| `RELATED_IMAGE_WASMSHIM` | WASM shim image URL | `oci://quay.io/kuadrant/wasm-shim:latest` | `WASM_SHIM_VERSION` var could be used to build this, defaults to _latest_ if not provided |
| **Makefile Variable** | **Description** | **Default value** | **Notes** |
|---------------------------------|------------------------------------------------------|-----------------------------------------------------|----------------------------------------------------------------------------------------------------|
| `IMG` | Kuadrant operator image URL | `quay.io/kuadrant/kuadrant-operator:latest` | `TAG` var could be use to build this URL, defaults to _latest_ if not provided |
| `VERSION` | Bundle version | `0.0.0` | |
| `LIMITADOR_OPERATOR_BUNDLE_IMG` | Limitador operator bundle URL | `quay.io/kuadrant/limitador-operator-bundle:latest` | `LIMITADOR_OPERATOR_VERSION` var could be used to build this, defaults to _latest_ if not provided |
| `AUTHORINO_OPERATOR_BUNDLE_IMG` | Authorino operator bundle URL | `quay.io/kuadrant/authorino-operator-bundle:latest` | `AUTHORINO_OPERATOR_VERSION` var could be used to build this, defaults to _latest_ if not provided |
| `DNS_OPERATOR_BUNDLE_IMG` | DNS operator bundle URL | `quay.io/kuadrant/dns-operator-bundle:latest` | `DNS_OPERATOR_BUNDLE_IMG` var could be used to build this, defaults to _latest_ if not provided |
| `RELATED_IMAGE_WASMSHIM` | WASM shim image URL | `oci://quay.io/kuadrant/wasm-shim:latest` | `WASM_SHIM_VERSION` var could be used to build this, defaults to _latest_ if not provided |
| `CHANNELS` | Bundle channels used in the bundle, comma separated | `alpha` | |
| `DEFAULT_CHANNEL` | The default channel used in the bundle | `alpha` | |

* Build the bundle manifests

Expand All @@ -129,7 +131,9 @@ make bundle [IMG=quay.io/kuadrant/kuadrant-operator:latest] \
[LIMITADOR_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/limitador-operator-bundle:latest] \
[AUTHORINO_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/authorino-operator-bundle:latest] \
[DNS_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/dns-operator-bundle:latest] \
[RELATED_IMAGE_WASMSHIM=oci://quay.io/kuadrant/wasm-shim:latest]
[RELATED_IMAGE_WASMSHIM=oci://quay.io/kuadrant/wasm-shim:latest] \
[CHANNELS=alpha] \
[DEFAULT_CHANNEL=alpha]
```

* Build the bundle image from the manifests
Expand Down Expand Up @@ -179,18 +183,22 @@ Make sure all the required bundles are pushed to the registry. It is required by

The `make catalog` target accepts the following variables:

| **Makefile Variable** | **Description** | **Default value** |
|---------------------------------|------------------------------------|-----------------------------------------------------|
| `BUNDLE_IMG` | Kuadrant operator bundle image URL | `quay.io/kuadrant/kuadrant-operator-bundle:latest` |
| `LIMITADOR_OPERATOR_BUNDLE_IMG` | Limitador operator bundle URL | `quay.io/kuadrant/limitador-operator-bundle:latest` |
| `AUTHORINO_OPERATOR_BUNDLE_IMG` | Authorino operator bundle URL | `quay.io/kuadrant/authorino-operator-bundle:latest` |
| `DNS_OPERATOR_BUNDLE_IMG` | DNS operator bundle URL | `quay.io/kuadrant/dns-operator-bundle:latest` |
| **Makefile Variable** | **Description** | **Default value** |
|---------------------------------|--------------------------------------------------------|-----------------------------------------------------|
| `BUNDLE_IMG` | Kuadrant operator bundle image URL | `quay.io/kuadrant/kuadrant-operator-bundle:latest` |
| `LIMITADOR_OPERATOR_BUNDLE_IMG` | Limitador operator bundle URL | `quay.io/kuadrant/limitador-operator-bundle:latest` |
| `AUTHORINO_OPERATOR_BUNDLE_IMG` | Authorino operator bundle URL | `quay.io/kuadrant/authorino-operator-bundle:latest` |
| `DNS_OPERATOR_BUNDLE_IMG` | DNS operator bundle URL | `quay.io/kuadrant/dns-operator-bundle:latest` |
| `CHANNELS` | Bundle channels used in the bundle, comma separated | `alpha` |
| `DEFAULT_CHANNEL` | Catalog default channel | `alpha` |

```sh
make catalog [BUNDLE_IMG=quay.io/kuadrant/kuadrant-operator-bundle:latest] \
[LIMITADOR_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/limitador-operator-bundle:latest] \
[AUTHORINO_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/authorino-operator-bundle:latest] \
[DNS_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/dns-operator-bundle:latest]
[DNS_OPERATOR_BUNDLE_IMG=quay.io/kuadrant/dns-operator-bundle:latest] \
[CHANNELS=alpha] \
[DEFAULT_CHANNEL=alpha]
```

* Build the catalog image from the manifests
Expand Down
18 changes: 8 additions & 10 deletions make/catalog.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,23 @@ $(CATALOG_DOCKERFILE): $(OPM)
cd $(PROJECT_PATH)/catalog && $(OPM) generate dockerfile kuadrant-operator-catalog -l quay.expires-after=$(QUAY_IMAGE_EXPIRY)
catalog-dockerfile: $(CATALOG_DOCKERFILE) ## Generate catalog dockerfile.

CHANNELS ?= preview

$(CATALOG_FILE): $(OPM) $(YQ)
@echo "************************************************************"
@echo Build kuadrant operator catalog
@echo
@echo BUNDLE_IMG = $(BUNDLE_IMG)
@echo REPLACES_VERSION = $(REPLACES_VERSION)
@echo LIMITADOR_OPERATOR_BUNDLE_IMG = $(LIMITADOR_OPERATOR_BUNDLE_IMG)
@echo AUTHORINO_OPERATOR_BUNDLE_IMG = $(AUTHORINO_OPERATOR_BUNDLE_IMG)
@echo DNS_OPERATOR_BUNDLE_IMG = $(DNS_OPERATOR_BUNDLE_IMG)
@echo CHANNELS = $(CHANNELS)
@echo CATALOG_FILE = $@
@echo BUNDLE_IMG = $(BUNDLE_IMG)
@echo REPLACES_VERSION = $(REPLACES_VERSION)
@echo LIMITADOR_OPERATOR_BUNDLE_IMG = $(LIMITADOR_OPERATOR_BUNDLE_IMG)
@echo AUTHORINO_OPERATOR_BUNDLE_IMG = $(AUTHORINO_OPERATOR_BUNDLE_IMG)
@echo DNS_OPERATOR_BUNDLE_IMG = $(DNS_OPERATOR_BUNDLE_IMG)
@echo CHANNEL = $(DEFAULT_CHANNEL)
@echo CATALOG_FILE = $@
@echo "************************************************************"
@echo
@echo Please check this matches your expectations and override variables if needed.
@echo
$(PROJECT_PATH)/utils/generate-catalog.sh $(OPM) $(YQ) $(BUNDLE_IMG) $(REPLACES_VERSION)\
$(LIMITADOR_OPERATOR_BUNDLE_IMG) $(AUTHORINO_OPERATOR_BUNDLE_IMG) $(DNS_OPERATOR_BUNDLE_IMG) $(CHANNELS) $@
$(LIMITADOR_OPERATOR_BUNDLE_IMG) $(AUTHORINO_OPERATOR_BUNDLE_IMG) $(DNS_OPERATOR_BUNDLE_IMG) $(DEFAULT_CHANNEL) $@

.PHONY: catalog
catalog: $(OPM) ## Generate catalog content and validate.
Expand Down
26 changes: 13 additions & 13 deletions utils/generate-catalog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ REPLACES_VERSION="${4?:Error \$REPLACES_VERSION not set. Bye}"
LIMITADOR_OPERATOR_BUNDLE_IMG="${5?:Error \$LIMITADOR_OPERATOR_BUNDLE_IMG not set. Bye}"
AUTHORINO_OPERATOR_BUNDLE_IMG="${6?:Error \$AUTHORINO_OPERATOR_BUNDLE_IMG not set. Bye}"
DNS_OPERATOR_BUNDLE_IMG="${7?:Error \$DNS_OPERATOR_BUNDLE_IMG not set. Bye}"
CHANNELS="${8?:Error \$CHANNELS not set. Bye}"
CHANNEL="${8?:Error \$CHANNEL not set. Bye}"
CATALOG_FILE="${9?:Error \$CATALOG_FILE not set. Bye}"

CATALOG_FILE_BASEDIR="$( cd "$( dirname "$(realpath ${CATALOG_FILE})" )" && pwd )"
Expand Down Expand Up @@ -58,49 +58,49 @@ touch ${CATALOG_FILE}
# Limitador Operator
###
# Add the package
${OPM} init limitador-operator --default-channel=${CHANNELS} --output yaml >> ${CATALOG_FILE}
${OPM} init limitador-operator --default-channel=${CHANNEL} --output yaml >> ${CATALOG_FILE}
# Add a bundles to the Catalog
cat ${TMP_DIR}/limitador-operator-bundle.yaml >> ${CATALOG_FILE}
# Add a channel entry for the bundle
V=`${YQ} eval '.name' ${TMP_DIR}/limitador-operator-bundle.yaml` \
CHANNELS=${CHANNELS} \
${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/limitador-operator-channel-entry.yaml >> ${CATALOG_FILE}
CHANNEL=${CHANNEL} \
${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNEL))' ${CATALOG_BASEDIR}/limitador-operator-channel-entry.yaml >> ${CATALOG_FILE}

###
# Authorino Operator
###
# Add the package
${OPM} init authorino-operator --default-channel=${CHANNELS} --output yaml >> ${CATALOG_FILE}
${OPM} init authorino-operator --default-channel=${CHANNEL} --output yaml >> ${CATALOG_FILE}
# Add a bundles to the Catalog
cat ${TMP_DIR}/authorino-operator-bundle.yaml >> ${CATALOG_FILE}
# Add a channel entry for the bundle
V=`${YQ} eval '.name' ${TMP_DIR}/authorino-operator-bundle.yaml` \
CHANNELS=${CHANNELS} \
${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/authorino-operator-channel-entry.yaml >> ${CATALOG_FILE}
CHANNEL=${CHANNEL} \
${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNEL))' ${CATALOG_BASEDIR}/authorino-operator-channel-entry.yaml >> ${CATALOG_FILE}

###
# DNS Operator
###
# Add the package
${OPM} init dns-operator --default-channel=${CHANNELS} --output yaml >> ${CATALOG_FILE}
${OPM} init dns-operator --default-channel=${CHANNEL} --output yaml >> ${CATALOG_FILE}
# Add a bundles to the Catalog
cat ${TMP_DIR}/dns-operator-bundle.yaml >> ${CATALOG_FILE}
# Add a channel entry for the bundle
V=`${YQ} eval '.name' ${TMP_DIR}/dns-operator-bundle.yaml` \
CHANNELS=${CHANNELS} \
${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/dns-operator-channel-entry.yaml >> ${CATALOG_FILE}
CHANNEL=${CHANNEL} \
${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNEL))' ${CATALOG_BASEDIR}/dns-operator-channel-entry.yaml >> ${CATALOG_FILE}

###
# Kuadrant Operator
###
# Add the package
${OPM} init kuadrant-operator --default-channel=${CHANNELS} --output yaml >> ${CATALOG_FILE}
${OPM} init kuadrant-operator --default-channel=${CHANNEL} --output yaml >> ${CATALOG_FILE}
# Add a bundles to the Catalog
cat ${TMP_DIR}/kuadrant-operator-bundle.yaml >> ${CATALOG_FILE}
# Add a channel entry for the bundle
NAME=`${YQ} eval '.name' ${TMP_DIR}/kuadrant-operator-bundle.yaml` \
REPLACES=kuadrant-operator.v${REPLACES_VERSION} \
CHANNELS=${CHANNELS} \
${YQ} eval '(.entries[0].name = strenv(NAME)) | (.entries[0].replaces = strenv(REPLACES)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/kuadrant-operator-channel-entry.yaml >> ${CATALOG_FILE}
CHANNEL=${CHANNEL} \
${YQ} eval '(.entries[0].name = strenv(NAME)) | (.entries[0].replaces = strenv(REPLACES)) | (.name = strenv(CHANNEL))' ${CATALOG_BASEDIR}/kuadrant-operator-channel-entry.yaml >> ${CATALOG_FILE}

rm -rf $TMP_DIR

0 comments on commit 4aa9abb

Please sign in to comment.