- Production configuration -
config/manager/kustomization.yamluses the latest release tag (v0.1.0) - Production bundle -
bundle/contains manifests for the latest release - Dev overlay -
config/dev/contains kustomize overlay for development testing
- Bundle manifests are regenerated at release time by GitHub Actions
- Dev testing temporarily modifies files (don't commit these changes)
Run the operator on your local machine - no container images needed:
# Install CRDs
make install
# Run operator locally
make runPros: Instant iteration, no image builds
Cons: Doesn't test containerization
Deploy to cluster without OLM - uses kustomize dev overlay:
./install-dev-local.shThis:
- Builds amd64 image
- Pushes to quay.io
- Deploys using
kubectl apply -k config/dev
Pros: Tests containerization, fast feedback
Cons: Doesn't test OLM installation
Test the full OLM installation workflow:
./test-install-dev.shThis:
- Builds amd64 operator image
- Generates bundle (temporarily modifies files)
- Builds bundle image
- Installs via
operator-sdk run bundle
Pros: Tests complete user experience
Cons: Slower, modifies source files
Important: After OLM testing, restore production config:
git restore bundle/ config/manager/kustomization.yaml| Platform | Architecture | Notes |
|---|---|---|
| Apple Silicon Mac | arm64 | Your build machine |
| OpenShift/Linux servers | amd64/x86_64 | Target cluster |
Always build for amd64 when deploying to OpenShift:
# Manual build
podman build --platform linux/amd64 -t image:tag .
# Or use Makefile
make docker-build-amd64 IMG=image:tag| Tag Type | Pull Policy | Use Case |
|---|---|---|
v0.1.0 |
IfNotPresent |
Production - immutable tags |
:latest |
Always |
Auto-set by Kubernetes |
:dev |
Always |
Dev - mutable tag needs this |
The dev overlay automatically sets imagePullPolicy: Always.
-
Ensure tests pass:
make test -
Create and push tag:
git tag v0.2.0 git push origin v0.2.0
-
GitHub Actions automatically:
- Builds amd64 container image
- Generates bundle with versioned image
- Creates GitHub release with artifacts
- Pushes bundle and catalog images
The release workflow (.github/workflows/release.yml):
-
Builds amd64 operator image:
platforms: linux/amd64
-
Generates bundle:
make bundle IMG=quay.io/mathianasj/virt-git-sync:v0.2.0
-
Creates artifacts:
- Operator:
quay.io/mathianasj/virt-git-sync:v0.2.0 - Bundle:
quay.io/mathianasj/virt-git-sync-bundle:v0.2.0 - Catalog:
quay.io/mathianasj/virt-git-sync-catalog:v0.2.0
- Operator:
- Bundle manifests with
:devtag config/manager/kustomization.yamlwithnewTag: dev- Temporary build artifacts
- Bundle manifests with release tags (via GitHub Actions)
config/manager/kustomization.yamlwithnewTag: v0.x.y- Source code changes
- Test updates
- Documentation
# Restore production configuration
git restore bundle/ config/manager/kustomization.yaml
# Or reset everything
git reset --hard origin/masterconfig/
├── default/ # Base production config
│ └── kustomization.yaml
├── dev/ # Development overlay
│ ├── kustomization.yaml
│ └── README.md
├── manager/
│ ├── kustomization.yaml # Image tag set here
│ └── manager.yaml
└── ...
Production:
kubectl apply -k config/defaultDevelopment:
kubectl apply -k config/devCustom:
kustomize build config/dev | kubectl apply -f -- Modify
api/v1alpha1/*_types.go - Regenerate:
make generate make manifests
- Update CRD in cluster:
make install
- Add kubebuilder markers in controller
- Regenerate:
make manifests
# All tests
make test
# Specific package
go test ./internal/controller/... -v
# With coverage
make test
go tool cover -html=cover.outmake docker-buildx IMG=quay.io/mathianasj/virt-git-sync:v0.2.0This builds for multiple platforms and pushes to registry.
Cause: Image architecture doesn't match cluster
Fix: Rebuild for amd64: make docker-build-amd64 IMG=...
Cause: make bundle modified files
Fix: git restore bundle/ config/manager/kustomization.yaml
Cause: Repository not public on quay.io
Fix: Set repository to public in quay.io settings
Check: kubectl get installplan -A
Logs: kubectl logs -n olm pod-name
Reset: operator-sdk cleanup virt-git-sync
- Use local dev (
make run) for iteration - fastest feedback - Test with local install before OLM - catches container issues
- Always restore after OLM testing - keep source clean
- Build for target architecture - amd64 for OpenShift
- Use dev overlay for cluster testing - automatic imagePullPolicy