Skip to content
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

release: Document release process #58

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ IMAGE_TAG_BASE ?= quay.io/kuadrant/dns-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=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:latest

# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
Expand Down Expand Up @@ -235,6 +235,20 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/deploy/local | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -

.PHONY: install-olm
install-olm: operator-sdk
$(OPERATOR_SDK) olm install

.PHONY: uninstall-olm
uninstall-olm: operator-sdk
$(OPERATOR_SDK) olm uninstall

deploy-catalog: kustomize yq ## Deploy operator to the K8s cluster specified in ~/.kube/config using OLM catalog image.
$(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 -

##@ Build Dependencies

## Location to install dependencies to
Expand Down Expand Up @@ -347,6 +361,10 @@ bundle-ignore-createdAt:
.PHONY: bundle-post-generate
bundle-post-generate:
$(YQ) -i '.annotations."com.redhat.openshift.versions" = "v4.12-v4.14"' bundle/metadata/annotations.yaml
V="$(CATALOG_IMG)" $(YQ) eval '.spec.image = strenv(V)' -i config/deploy/olm/catalogsource.yaml
@if [ "$(CHANNELS)" != "" ]; then\
V="$(CHANNELS)" $(YQ) eval '.spec.channel = strenv(V)' -i config/deploy/olm/subscription.yaml; \
fi

.PHONY: bundle-build
bundle-build: ## Build the bundle image.
Expand Down Expand Up @@ -378,7 +396,7 @@ endif
BUNDLE_IMGS ?= $(BUNDLE_IMG)

# 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:latest

# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
ifneq ($(origin CATALOG_BASE_IMG), undefined)
Expand All @@ -403,8 +421,11 @@ catalog-push: ## Push a catalog image.

.PHONY: prepare-release
RELEASE_FILE = $(shell pwd)/make/release.mk
prepare-release: IMG_TAG=v$(VERSION)
prepare-release: ## Generates a makefile that will override environment variables for a specific release and runs bundle.
echo -e "#Release default values\\nIMG=$(IMG)\nCHANNELS=$(CHANNELS)\nVERSION=$(VERSION)\nREPLACES_VERSION=$(REPLACES_VERSION)" > $(RELEASE_FILE)
echo -e "#Release default values\\nIMG=$(IMAGE_TAG_BASE):$(IMG_TAG)\nBUNDLE_IMG=$(IMAGE_TAG_BASE)-bundle:$(IMG_TAG)\n\
CATALOG_IMG=$(IMAGE_TAG_BASE)-catalog:$(IMG_TAG)\nCHANNELS=$(CHANNELS)\nBUNDLE_CHANNELS=--channels=$(CHANNELS)\n\
VERSION=$(VERSION)\nREPLACES_VERSION=$(REPLACES_VERSION)" > $(RELEASE_FILE)
$(MAKE) bundle

# Include last to avoid changing MAKEFILE_LIST used above
Expand Down
9 changes: 9 additions & 0 deletions config/deploy/olm/catalogsource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: dns-operator-catalog
spec:
sourceType: grpc
image: quay.io/kuadrant/dns-operator-catalog:latest
displayName: DNS Operators
publisher: grpc
8 changes: 8 additions & 0 deletions config/deploy/olm/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Adds namespace to all resources.
namespace: dns-operator-system

resources:
- namespace.yaml
- operatorgroup.yaml
- catalogsource.yaml
- subscription.yaml
6 changes: 6 additions & 0 deletions config/deploy/olm/namespace.yaml
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: system
4 changes: 4 additions & 0 deletions config/deploy/olm/operatorgroup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: dns-operator
9 changes: 9 additions & 0 deletions config/deploy/olm/subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: dns-operator
spec:
source: dns-operator-catalog
sourceNamespace: dns-operator-system
name: dns-operator
channel: "alpha"
96 changes: 96 additions & 0 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
## Release

### New Major.Minor version

1. Create a new minor release branch from the HEAD of main:
```sh
git checkout -b release-0.2
```
2. Run prepare release:
```sh
make prepare-release IMG_TAG=release-0.2 VERSION=0.2.0-dev CHANNELS=alpha REPLACES_VERSION=0.1.0
```
3. Verify local changes, commit and push:
```sh
git add .
git commit -m "prepare-release: release-0.2"
git push upstream release-0.2
```
4. Verify that the build [image workflow](https://github.com/Kuadrant/dns-operator/actions/workflows/build-images.yaml) is triggered and completes for the new branch

5. Do any final testing and bug fixing against the release branch, see [Verify OLM Deployment](#verify-olm-deployment)

6. Run prepare release for final version
```sh
make prepare-release VERSION=0.2.0 CHANNELS=stable REPLACES_VERSION=0.1.0
```
7. Verify local changes, commit, push and tag:
```sh
git add .
git commit -m "prepare-release: v0.2.0"
git tag v0.2.0
git push upstream release-0.2
git push upstream v0.2.0
```
8. Verify that the build [image workflow](https://github.com/Kuadrant/dns-operator/actions/workflows/build-images.yaml) is triggered and completes for the new tag

9. Verify the new version can be installed from the catalog image, see [Verify OLM Deployment](#verify-olm-deployment)

10. Release to the [community operator index catalogs](#community-operator-index-catalogs).

### New Patch version

1. Checkout minor release branch:
```sh
git checkout release-0.2
```
2. Run prepare release:
```sh
make prepare-release VERSION=0.2.1 CHANNELS=stable REPLACES_VERSION=0.2.0
```
3. Verify local changes, commit and push:
```sh
git add .
git commit -m "prepare-release: v0.2.1"
git tag v0.2.1
git push upstream release-0.2
git push upstream v0.2.1
```
4. Verify that the build [image workflow](https://github.com/Kuadrant/dns-operator/actions/workflows/build-images.yaml) is triggered and completes for the new tag

5. Verify the new version can be installed from the catalog image, see [Verify OLM Deployment](#verify-olm-deployment)

6. Release to the [community operator index catalogs](#community-operator-index-catalogs).

### Verify OLM Deployment

1. Deploy the OLM catalog image:
```sh
make local-setup install-olm deploy-catalog
```

2. Wait for deployment:
```sh
kubectl -n dns-operator-system wait --timeout=60s --for=condition=Available deployments --all
deployment.apps/dns-operator-controller-manager condition met
```

3. Check the logs:
```sh
kubectl -n dns-operator-system logs -f deployment/dns-operator-controller-manager
```

4. Check the version:
```sh
$ kubectl -n dns-operator-system get deployment dns-operator-controller-manager --show-labels
NAME READY UP-TO-DATE AVAILABLE AGE LABELS
dns-operator-controller-manager 1/1 1 1 5m42s app.kubernetes.io/component=manager,app.kubernetes.io/created-by=dns-operator,
app.kubernetes.io/instance=controller-manager,app.kubernetes.io/managed-by=kustomize,app.kubernetes.io/name=deployment,app.kubernetes.io/part-of=dns-operator,
control-plane=dns-operator-controller-manager,olm.deployment-spec-hash=1jPe8AuMpSKHh51nnDs4j25ZgoUrKhF45EP0Wa,olm.managed=true,olm.owner.kind=ClusterServiceVersion,
olm.owner.namespace=dns-operator-system,olm.owner=dns-operator.v0.2.0-dev,operators.coreos.com/dns-operator.dns-operator-system=
```

### Community Operator Index Catalogs

- [Operatorhub Community Operators](https://github.com/k8s-operatorhub/community-operators/tree/main/operators/dns-operator)
- [Openshift Community Operators](https://github.com/redhat-openshift-ecosystem/community-operators-prod/tree/main/operators/dns-operator)
Loading