Warn at startup when installed CRDs are stale or missing #6
Reference in New Issue
Block a user
Delete Branch "benvin/crd-version-warning"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The operator strict-decodes CustomResource specs. When the in-cluster CRDs lag the running operator — as just happened, with CRDs pinned to v0.1.0 while the operator ran v0.3.0 — new spec fields fail to decode and the operator gives no signal about the root cause. This adds an advisory startup check so a CRD/operator version mismatch is immediately visible in the operator logs.
Changes
CheckCRDVersions: at startup, GET each owned CRD via the apiextensions clientset and verify it carries a version-sentinel spec field; log a distinct WARNING per problem (missing CRD vs. present-but-stale schema). The check is advisory only — it never returns an error or exits.buckets→managePolicy,objectstoreusers→retainOnDelete,bucketaccesses→rawStatements) so it is easy to extend.apiextensions.k8s.io/customresourcedefinitionsget;listkubebuilder RBAC marker and regenerateconfig/rbac/role.yaml.k8s.io/apiextensions-apiserverto a direct dependency.Verified:
gofmt,go vet ./...,CGO_ENABLED=0 go build ./..., andgo test ./...all pass;make generateproduces no unexpected churn.https://claude.ai/code/session_016CEncETbf8cvy1PhsHfFHM