This document describes how to publish kubernetes-nmstate to OperatorHub using GitHub Actions.
The kubernetes-nmstate operator can be published to two OperatorHub repositories:
We provide two GitHub Actions workflows for publishing:
publish-operatorhub.yml - Triggered manually for testing or specific versionspublish-operatorhub-on-release.yml - Triggered automatically when a release is publishedThe workflows require a GitHub secret named OPERATORHUB_TOKEN with permissions to:
To set up the token:
repo and workflow scopesOPERATORHUB_TOKEN:
OPERATORHUB_TOKENBefore publishing, ensure that the operator and handler images are built and pushed to the registry:
# Build and push handler image
IMAGE_REGISTRY=quay.io IMAGE_REPO=nmstate HANDLER_IMAGE_TAG=v0.88.0 make push-handler
# Build and push operator image
IMAGE_REGISTRY=quay.io IMAGE_REPO=nmstate OPERATOR_IMAGE_TAG=v0.88.0 make push-operator
Images should be publicly accessible at:
quay.io/nmstate/kubernetes-nmstate-handler:v<VERSION>quay.io/nmstate/kubernetes-nmstate-operator:v<VERSION>The automatic workflow triggers when a GitHub release is published.
# Tag the release
git tag v0.88.0
git push origin v0.88.0
gh CLI:
gh release create v0.88.0 --title "v0.88.0" --notes "Release notes here"
community-operators (for all releases)community-operators-prod (for stable releases only, not pre-releases)community-operators (operatorhub.io)community-operators-prod (OpenShift)
v0.88.0-rc1) are NOT published to productionYou can also manually trigger the automatic workflow:
gh workflow run publish-operatorhub-on-release.yml -f tag=v0.88.0
Use the manual workflow for testing or when you need fine-grained control.
version: Operator version (e.g., 0.88.0 - without the ‘v’ prefix)operator_hub_repo: Choose the target repository
community-operators - For operatorhub.iocommunity-operators-prod - For OpenShiftcreate_pr: Enable/disable PR creation (disable for testing)# Publish to community-operators
gh workflow run publish-operatorhub.yml \
-f version=0.88.0 \
-f operator_hub_repo=community-operators \
-f create_pr=true
# Publish to community-operators-prod (OpenShift)
gh workflow run publish-operatorhub.yml \
-f version=0.88.0 \
-f operator_hub_repo=community-operators-prod \
-f create_pr=true
# Test bundle generation without creating a PR
gh workflow run publish-operatorhub.yml \
-f version=0.88.0 \
-f operator_hub_repo=community-operators \
-f create_pr=false
make bundleThe generated bundle follows the Operator Framework format:
operators/kubernetes-nmstate-operator/<version>/
├── manifests/
│ ├── kubernetes-nmstate-operator.clusterserviceversion.yaml
│ ├── nmstate.io_nmstates.yaml
│ ├── nmstate.io_nodenetworkconfigurationenactments.yaml
│ ├── nmstate.io_nodenetworkconfigurationpolicies.yaml
│ └── nmstate.io_nodenetworkstates.yaml
├── metadata/
│ └── annotations.yaml
└── bundle.Dockerfile
The workflows ensure that:
quay.io/nmstate/kubernetes-nmstate-handler:v<VERSION>quay.io/nmstate/kubernetes-nmstate-operator:v<VERSION>IfNotPresent (production setting)After the workflow creates a PR:
Common CI checks include:
# Locally test bundle generation
make bundle VERSION=0.88.0 \
HANDLER_IMAGE_TAG=v0.88.0 \
OPERATOR_IMAGE_TAG=v0.88.0 \
HANDLER_PULL_POLICY=IfNotPresent \
OPERATOR_PULL_POLICY=IfNotPresent
# Validate the bundle
make bundle VERSION=0.88.0
Ensure images are built and pushed:
# Check if images exist
podman pull quay.io/nmstate/kubernetes-nmstate-handler:v0.88.0
podman pull quay.io/nmstate/kubernetes-nmstate-operator:v0.88.0
OPERATORHUB_TOKEN has correct permissionsThe workflows expect semantic versioning:
0.88.0, 1.0.0, 0.88.1v0.88.0, 0.88, latestFor release tags, use the v prefix (e.g., v0.88.0), but for the workflow version input, omit it.
To test bundle generation locally before running the workflow:
# Set variables
export VERSION=0.88.0
export HANDLER_IMAGE_TAG=v0.88.0
export OPERATOR_IMAGE_TAG=v0.88.0
# Generate bundle
make bundle VERSION=$VERSION \
HANDLER_IMAGE_TAG=$HANDLER_IMAGE_TAG \
OPERATOR_IMAGE_TAG=$OPERATOR_IMAGE_TAG \
HANDLER_PULL_POLICY=IfNotPresent \
OPERATOR_PULL_POLICY=IfNotPresent
# Inspect generated files
ls -la bundle/
cat bundle/manifests/kubernetes-nmstate-operator.clusterserviceversion.yaml