Skip to content

Commit

Permalink
Change to file-based catalog image
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Rae Kim <[email protected]>
  • Loading branch information
yiraeChristineKim committed Nov 14, 2023
1 parent 9b1ab3c commit 3416d53
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/olm_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
# TODO: Use operator-sdk run bundle and bundle-upgrade commands for
# testing with OLM.
OPERATOR_VERSION=$(awk '/^VERSION \?=/ {print $3}' Makefile)
REPO=localhost:5000
REPO=http://localhost:5000
IMG=${REPO}/gatekeeper-operator:${GITHUB_SHA}
PREV_BUNDLE_INDEX_IMG=quay.io/gatekeeper/gatekeeper-operator-bundle-index:$(make get-replaces-version)
make build-and-push-bundle-images IMG=${IMG} REPO=${REPO} VERSION=${GITHUB_SHA} OPERATOR_VERSION=${OPERATOR_VERSION}
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ ifeq ($(GOOS), darwin)
SED="gsed"
endif

OPERATOR_NAME=gatekeeper-operator

get-replaces-version:
@echo $(REPLACES_VERSION)

Expand Down Expand Up @@ -52,7 +54,7 @@ DOCKER ?= docker
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# gatekeeper.sh/gatekeeper-operator-bundle:$VERSION and gatekeeper.sh/gatekeeper-operator-catalog:$VERSION.
REPO ?= quay.io/gatekeeper
REPO ?= localhost:5000
IMAGE_TAG_BASE ?= $(REPO)/gatekeeper-operator

# BUNDLE_IMG defines the image:tag used for the bundle.
Expand Down Expand Up @@ -109,7 +111,7 @@ ENVTEST = $(LOCAL_BIN)/setup-envtest
GO_BINDATA = $(LOCAL_BIN)/go-bindata
GINKGO = $(LOCAL_BIN)/ginkgo
KUSTOMIZE_VERSION ?= v5.0.1
OPM_VERSION ?= v1.27.0
OPM_VERSION ?= v1.31.0
GO_BINDATA_VERSION ?= v3.1.2+incompatible
BATS_VERSION ?= 1.2.1
OLM_VERSION ?= v0.25.0
Expand Down Expand Up @@ -362,15 +364,19 @@ import-manifests: kustomize
.PHONY: bundle-index-build
bundle-index-build: opm
ifneq ($(REPLACES_VERSION), none)
$(OPM) index add --bundles $(BUNDLE_IMG) --from-index $(PREV_BUNDLE_INDEX_IMG) --tag $(BUNDLE_INDEX_IMG) -c $(DOCKER)
-rm catalog_dir.dockerfile
-$(OPM) generate dockerfile catalog_dir
$(OPM) init $(OPERATOR_NAME) --default-channel=stable --description=./README.md --output --icon=./gatekeeper_logo.svg --output yaml > catalog_dir/index.yaml
$(OPM) render $(BUNDLE_IMG) --output=yaml >> catalog_dir/index.yaml --use-http
$(DOCKER) build . -f catalog_dir.Dockerfile -t $(BUNDLE_INDEX_IMG)
else
$(OPM) index add --bundles $(BUNDLE_IMG) --tag $(BUNDLE_INDEX_IMG) -c $(DOCKER)
endif

# Generate and push bundle image and bundle index image
# Note: OPERATOR_VERSION is an arbitrary number and does not need to match any official versions
.PHONY: build-and-push-bundle-images
build-and-push-bundle-images: docker-build docker-push
build-and-push-bundle-images: # docker-build docker-push
$(MAKE) bundle VERSION=$(OPERATOR_VERSION)
$(MAKE) bundle-build
$(MAKE) docker-push IMG=$(BUNDLE_IMG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ spec:
env:
- name: RELATED_IMAGE_GATEKEEPER
value: openpolicyagent/gatekeeper:v3.11.1
image: quay.io/gatekeeper/gatekeeper-operator:v3.11.1
image: localhost:5000/gatekeeper-operator:v3.11.1
imagePullPolicy: Always
livenessProbe:
httpGet:
Expand Down
6 changes: 6 additions & 0 deletions catalog_dir/channel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
schema: olm.channel
package: gatekeeper-operator
name: stable
entries:
- name: gatekeeper-operator.v3.11.1
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/gatekeeper/gatekeeper-operator
newName: localhost:5000/gatekeeper-operator
newTag: v3.11.1
1 change: 1 addition & 0 deletions gatekeeper_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3416d53

Please sign in to comment.