-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File based catalog #201
Merged
Merged
File based catalog #201
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7b6b6f9
[git] Ignoring built catalogs
didierofrivia e3a3a14
[make] Removing catalog creation targets
didierofrivia fe6e62e
[make] Adding file based catalog generation targets and scripts
didierofrivia 4a62d3f
[workflow] Using the new file based catalog target
didierofrivia 802ca2c
[manifests] For olm catalog installation target
didierofrivia d3a5cbe
[make] Using `PROJECT_DIR` instead of `PROJECT_PATH`
didierofrivia 6dee91e
[make] Fixing kustomize target
didierofrivia a291874
[catalog] Setting `stable` as default channel
didierofrivia 26630ea
[script] Removing realpath
didierofrivia 5d37da2
[manifests] Replacing namespace and default channel
didierofrivia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,6 @@ | ||
--- | ||
schema: olm.channel | ||
package: authorino-operator | ||
name: stable | ||
entries: | ||
- name: authorino-operator.v0.0.0 |
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,9 @@ | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: CatalogSource | ||
metadata: | ||
name: authorino-operator-catalog | ||
spec: | ||
sourceType: grpc | ||
image: quay.io/kuadrant/authorino-operator-catalog:local-testing-dd | ||
displayName: Authorino Operator | ||
publisher: grpc |
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 @@ | ||
# Adds namespace to all resources. | ||
namespace: authorino-operator | ||
|
||
resources: | ||
- namespace.yaml | ||
- operatorgroup.yaml | ||
- catalogsource.yaml | ||
- subscription.yaml |
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,6 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
labels: | ||
control-plane: controller-manager | ||
name: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: operators.coreos.com/v1 | ||
kind: OperatorGroup | ||
metadata: | ||
name: kuadrant |
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,10 @@ | ||
--- | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: kuadrant | ||
spec: | ||
source: authorino-operator-catalog | ||
sourceNamespace: authorino-operator | ||
name: authorino-operator | ||
channel: "stable" |
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,52 @@ | ||
##@ Operator Catalog | ||
|
||
# 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:$(IMAGE_TAG) | ||
|
||
CATALOG_FILE = $(PROJECT_DIR)/catalog/authorino-operator-catalog/operator.yaml | ||
CATALOG_DOCKERFILE = $(PROJECT_DIR)/catalog/authorino-operator-catalog.Dockerfile | ||
|
||
$(CATALOG_DOCKERFILE): $(OPM) | ||
-mkdir -p $(PROJECT_DIR)/catalog/authorino-operator-catalog | ||
cd $(PROJECT_DIR)/catalog && $(OPM) generate dockerfile authorino-operator-catalog | ||
catalog-dockerfile: $(CATALOG_DOCKERFILE) ## Generate catalog dockerfile. | ||
|
||
$(CATALOG_FILE): $(OPM) $(YQ) | ||
@echo "************************************************************" | ||
@echo Build authorino operator catalog | ||
@echo | ||
@echo BUNDLE_IMG = $(BUNDLE_IMG) | ||
@echo CHANNELS = $(CHANNELS) | ||
@echo "************************************************************" | ||
@echo | ||
@echo Please check this matches your expectations and override variables if needed. | ||
@echo | ||
$(PROJECT_DIR)/utils/generate-catalog.sh $(OPM) $(YQ) $(BUNDLE_IMG) $@ $(CHANNELS) | ||
|
||
.PHONY: catalog | ||
catalog: $(OPM) ## Generate catalog content and validate. | ||
# Initializing the Catalog | ||
-rm -rf $(PROJECT_DIR)/catalog/authorino-operator-catalog | ||
-rm -rf $(PROJECT_DIR)/catalog/authorino-operator-catalog.Dockerfile | ||
$(MAKE) $(CATALOG_DOCKERFILE) | ||
$(MAKE) $(CATALOG_FILE) BUNDLE_IMG=$(BUNDLE_IMG) | ||
cd $(PROJECT_DIR)/catalog && $(OPM) validate authorino-operator-catalog | ||
|
||
# Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'. | ||
# Ref https://olm.operatorframework.io/docs/tasks/creating-a-catalog/#catalog-creation-with-raw-file-based-catalogs | ||
.PHONY: catalog-build | ||
catalog-build: ## Build a catalog image. | ||
# Build the Catalog | ||
docker build $(PROJECT_DIR)/catalog -f $(PROJECT_DIR)/catalog/authorino-operator-catalog.Dockerfile -t $(CATALOG_IMG) | ||
|
||
# Push the catalog image. | ||
.PHONY: catalog-push | ||
catalog-push: ## Push a catalog image. | ||
$(MAKE) docker-push IMG=$(CATALOG_IMG) | ||
|
||
deploy-catalog: $(KUSTOMIZE) $(YQ) ## Deploy operator to the K8s cluster specified in ~/.kube/config using OLM catalog image. | ||
didierofrivia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
V="$(CATALOG_IMG)" $(YQ) eval '.spec.image = strenv(V)' -i config/deploy/olm/catalogsource.yaml | ||
$(KUSTOMIZE) build config/deploy/olm | kubectl apply -f - | ||
|
||
undeploy-catalog: $(KUSTOMIZE) ## Undeploy controller from the K8s cluster specified in ~/.kube/config using OLM catalog image. | ||
$(KUSTOMIZE) build config/deploy/olm | kubectl delete -f - |
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,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Generate OLM catalog file | ||
|
||
set -euo pipefail | ||
|
||
### CONSTANTS | ||
# Used as well in the subscription object | ||
DEFAULT_CHANNEL=stable | ||
### | ||
|
||
OPM="${1?:Error \$OPM not set. Bye}" | ||
YQ="${2?:Error \$YQ not set. Bye}" | ||
BUNDLE_IMG="${3?:Error \$BUNDLE_IMG not set. Bye}" | ||
CATALOG_FILE="${4?:Error \$CATALOG_FILE not set. Bye}" | ||
CHANNELS="${5:-$DEFAULT_CHANNEL}" | ||
|
||
CATALOG_FILE_BASEDIR="$( cd "$( dirname ${CATALOG_FILE} )" && pwd )" | ||
CATALOG_BASEDIR="$( cd "$( dirname ${CATALOG_FILE_BASEDIR} )" && pwd )" | ||
|
||
TMP_DIR=$(mktemp -d) | ||
|
||
${OPM} render ${BUNDLE_IMG} --output=yaml >> ${TMP_DIR}/authorino-operator-bundle.yaml | ||
|
||
mkdir -p ${CATALOG_FILE_BASEDIR} | ||
touch ${CATALOG_FILE} | ||
|
||
### | ||
# Authorino Operator | ||
### | ||
# Add the package | ||
${OPM} init authorino-operator --default-channel=${CHANNELS} --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} | ||
|
||
rm -rf $TMP_DIR |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not related to this PR, but I do not think that catalog image needs to be multi-platform. It's just a single yaml file!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could pulling the image from a different platform fail if only amd64 is available (despite being just a single yaml inside)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The image is being pulled by OLM. So, not being entirely sure, this needs to be checked first 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From OS docs:
Which not sure if it could be interpreted to also the actual catalog yaml img that it's delivered