operator-sdk
operator-sdk copied to clipboard
Add support for IngressClass CR
Summary
Whenever we add IngressClass
CR manifet into our bundle/manifests
directory we get an error:
$ operator-sdk bundle validate ./bundle
ERRO[0000] Error: Value networking.k8s.io/v1, Kind=IngressClass: unsupported media type registry+v1 for bundle object
Context
Required tools:
- operator-sdk binary
- opm binary
- GNU make
- yq
- git binary
- kustomize binary
Setup
git clone https://gitlab.com/gitlab-org/cloud-native/gitlab-operator.git
cd gitlab-operator
git checkout 281-list-in-operatorhub-io
make build_operator
make build_test_cr
( cd config/scorecard; kustomize build ) > .build/scorecard.yaml
yq eval . .build/openshift_resources.yaml .build/operator.yaml .build/test_cr.yaml .build/scorecard.yaml | operator-sdk generate bundle -q --overwrite --extra-service-accounts gitlab-manager,gitlab-nginx-ingress,gitlab-app --version 0.2.0 --default-channel=stable --channels=stable,unstable --package=gitlab-operator-kubernetes
yq eval '.metadata.name="gitlab-nginx"' /home/dmytro.makovey/work/gitlab-operator.281-list-in-operatorhub-io/config/rbac/nginx_ingressclass.yaml > bundle/manifests/gitlab-nginx-ingressclass.yaml
operator-sdk bundle validate ./bundle
Additional Notes
Whenever validation step is skipped, produced bundle also "crashes" in OLM as it refuses to instantiate Operator upon submission of Subscription with errors like:
{"level":"error","ts":1642021519.11281,"logger":"controllers.operatorcondition","msg":"Error ensuring OperatorCondition Deployment EnvVars","request":"gitlab-system/gitlab-operator-kubernetes.v0.2.0","error":"Deployment.apps \"gitlab-controller-manager\" not found","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:311\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227"}
{"level":"error","ts":1642021519.11285,"logger":"controller.operatorcondition","msg":"Reconciler error","reconciler group":"operators.coreos.com","reconciler kind":"OperatorCondition","name":"gitlab-operator-kubernetes.v0.2.0","namespace":"gitlab-system","error":"Deployment.apps \"gitlab-controller-manager\" not found","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227"}
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen
.
If this issue is safe to close now please do so with /close
.
/lifecycle stale
/remove-lifecycle stale
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen
.
If this issue is safe to close now please do so with /close
.
/lifecycle stale
/remove-lifecycle stale