Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
Clean opm output and fix developer.md (#154)
Browse files Browse the repository at this point in the history
* clean opm output, fix developer.md

* fix pr.yaml

* Update docs/developer.md

Co-authored-by: Armel Soro <[email protected]>

* quickfix pr.yaml

* Update Makefile

Co-authored-by: Nick Boldt <[email protected]>

* Update docs/developer.md

Co-authored-by: Nick Boldt <[email protected]>

* Update Makefile

---------

Co-authored-by: Armel Soro <[email protected]>
Co-authored-by: Nick Boldt <[email protected]>
  • Loading branch information
3 people authored Jan 19, 2024
1 parent 7c97d2d commit 81e7506
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

strategy:
matrix:
# See ../Makefile for value of single arch PLATFORM used with target operator-build
# See ../Makefile for value of single arch PLATFORM used with target image-build
# NOTE: to build multiple arches, see ../Makefile and use target docker-buildx with PLATFORMS
# only run this with docker since we have podman builds in pr-container-build.yaml
# TODO: do we really even need this check?
Expand All @@ -42,4 +42,4 @@ jobs:
go-version-file: 'go.mod'
- name: ${{ matrix.engine }} build
run: |
CONTAINER_ENGINE=${{ matrix.engine }} make operator-build
CONTAINER_ENGINE=${{ matrix.engine }} make image-build
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ __debug_bin*
.scripts/
.DS_Store
database/
index.Dockerfile
docker/index.Dockerfile
27 changes: 16 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ PLATFORM ?= linux/amd64
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/

.PHONY: operator-build
operator-build: test ## Build docker image with the manager using docker.
.PHONY: image-build
image-build: test ## Build docker image with the manager using docker.
$(CONTAINER_ENGINE) build --platform $(PLATFORM) -f docker/Dockerfile -t $(IMG) --label $(LABEL) .

.PHONY: operator-push
operator-push: ## Push IMG image to registry
.PHONY: image-push
image-push: ## Push IMG image to registry
$(CONTAINER_ENGINE) push $(IMG)

# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
Expand Down Expand Up @@ -296,7 +296,7 @@ bundle-build: ## Build the bundle image.

.PHONY: bundle-push
bundle-push: ## Push bundle image to registry
$(MAKE) operator-push IMG=$(BUNDLE_IMG)
$(MAKE) image-push IMG=$(BUNDLE_IMG)

# 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.
Expand All @@ -315,18 +315,19 @@ endif
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
.PHONY: catalog-build
catalog-build: bundle-push opm ## Generate operator-catalog dockerfile using the operator-bundle image built and published above; then build catalog image
$(OPM) index add --container-tool $(CONTAINER_ENGINE) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) --generate
$(CONTAINER_ENGINE) build --platform $(PLATFORM) -f index.Dockerfile -t $(CATALOG_IMG) --label $(LABEL) .
## [GA] added '-d docker/index.Dockerfile' to avoid generating in the root
$(OPM) index add --container-tool $(CONTAINER_ENGINE) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) --generate -d docker/index.Dockerfile
$(CONTAINER_ENGINE) build --platform $(PLATFORM) -f docker/index.Dockerfile -t $(CATALOG_IMG) --label $(LABEL) .

.PHONY: catalog-push
catalog-push: ## Push catalog image to registry
$(MAKE) operator-push IMG=$(CATALOG_IMG)
$(MAKE) image-push IMG=$(CATALOG_IMG)

.PHONY:
release-build: bundle operator-build bundle-build catalog-build ## Build operator, bundle + catalog images
release-build: bundle image-build bundle-build catalog-build ## Build operator, bundle + catalog images

.PHONY:
release-push: operator-push bundle-push catalog-push ## Push operator, bundle + catalog images
release-push: image-push bundle-push catalog-push ## Push operator, bundle + catalog images

.PHONY: deploy-olm
deploy-olm: ## Deploy the operator with OLM
Expand All @@ -342,5 +343,9 @@ undeploy-olm: ## Un-deploy the operator with OLM
DEFAULT_OLM_NAMESPACE ?= openshift-marketplace
.PHONY: catalog-update
catalog-update: ## Update catalog source in the default namespace for catalogsource
-kubectl delete catalogsource backstage-operator -n $(DEFAULT_OLM_NAMESPACE)
kubectl delete catalogsource backstage-operator -n $(DEFAULT_OLM_NAMESPACE)
sed "s/{{CATALOG_IMG}}/$(subst /,\/,$(CATALOG_IMG))/g" config/samples/catalog-source-template.yaml | kubectl apply -n $(DEFAULT_OLM_NAMESPACE) -f -

.PHONY: deploy-openshift
deploy-openshift: release-build release-push catalog-update ## Deploy the operator on openshift cluster

9 changes: 7 additions & 2 deletions docs/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ You can use [minikube](https://kubernetes.io/docs/tasks/tools/#minikube) or [kin

- Build and push your image to the location specified by `IMG`:
```sh
make docker-build docker-push IMG=<your-registry>/backstage-operator:tag
make image-build image-push IMG=<your-registry>/backstage-operator:tag
```

- Install the CRDs into the local cluster (minikube is installed and running):
Expand Down Expand Up @@ -84,11 +84,16 @@ make catalog-update
```sh
make deploy-olm
```
4. To undeloy the operator with OLM
5. To undeploy the operator with OLM
```sh
make undeploy-olm
```

6. To deploy the operator to Openshift with OLM
```sh
make deploy-openshift [IMAGE_TAG_BASE=<your-registry>/backstage-operator]
```

### Modifying the API definitions
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
```sh
Expand Down

0 comments on commit 81e7506

Please sign in to comment.