fix: remove unrecognized int format from CRD schemas#1399
fix: remove unrecognized int format from CRD schemas#1399fl-sean03 wants to merge 1 commit intokagent-dev:mainfrom
Conversation
Remove `format: int32` and `format: int64` annotations from CRD OpenAPI schemas. These format values are not recognized by the Kubernetes API server and produce warnings during `helm install`: Warning: unrecognized format "int64" Warning: unrecognized format "int32" The format annotations are automatically added by controller-gen from Go types (int32/int64) but serve no purpose in the Kubernetes CRD validation schema. This change: 1. Adds a post-processing step to `make manifests` that strips these format lines from generated CRD YAML files 2. Updates the current CRD files in both go/config/crd/bases/ and helm/kagent-crds/templates/ Fixes kagent-dev#1318 Signed-off-by: Sean <sean@opspawn.com> Signed-off-by: fl-sean03 <jmhbh@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses Kubernetes API server warnings emitted during helm install by removing unsupported format: int32 / format: int64 entries from CRD OpenAPI schemas, and ensuring regenerated CRDs have those fields stripped post-controller-gen.
Changes:
- Add a
make manifestspost-processing step to deleteformat: int32/format: int64from generated CRDs. - Remove
format: int32/format: int64entries from CRD YAMLs undergo/config/crd/bases/. - Remove the same
formatentries from the Helm CRD chart templates underhelm/kagent-crds/templates/.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| go/Makefile | Adds a post-generation cleanup step to strip unsupported integer format fields from CRDs. |
| go/config/crd/bases/kagent.dev_agents.yaml | Removes format: int32/int64 from schema fields to avoid install warnings. |
| go/config/crd/bases/kagent.dev_memories.yaml | Removes format: int64 entries from schema fields. |
| go/config/crd/bases/kagent.dev_modelconfigs.yaml | Removes format: int64 entries from schema fields. |
| go/config/crd/bases/kagent.dev_modelproviderconfigs.yaml | Removes format: int64 entries from schema fields. |
| go/config/crd/bases/kagent.dev_remotemcpservers.yaml | Removes format: int64 entries from schema fields. |
| go/config/crd/bases/kagent.dev_toolservers.yaml | Removes format: int64 entries from schema fields. |
| helm/kagent-crds/templates/kagent.dev_agents.yaml | Mirrors CRD schema cleanup in Helm CRD chart templates. |
| helm/kagent-crds/templates/kagent.dev_memories.yaml | Mirrors CRD schema cleanup in Helm CRD chart templates. |
| helm/kagent-crds/templates/kagent.dev_modelconfigs.yaml | Mirrors CRD schema cleanup in Helm CRD chart templates. |
| helm/kagent-crds/templates/kagent.dev_modelproviderconfigs.yaml | Mirrors CRD schema cleanup in Helm CRD chart templates. |
| helm/kagent-crds/templates/kagent.dev_remotemcpservers.yaml | Mirrors CRD schema cleanup in Helm CRD chart templates. |
| helm/kagent-crds/templates/kagent.dev_toolservers.yaml | Mirrors CRD schema cleanup in Helm CRD chart templates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @# Remove format: int32/int64 from CRD schemas to avoid Kubernetes API server warnings | ||
| @# See https://github.com/kagent-dev/kagent/issues/1318 | ||
| @for f in config/crd/bases/*.yaml; do \ | ||
| sed -i '/^[[:space:]]*format: int\(32\|64\)$$/d' "$$f"; \ |
There was a problem hiding this comment.
sed -i without a backup extension is GNU-sed specific; on macOS/BSD sed this will fail and break make manifests (and anything depending on it, e.g. make run). Consider making the in-place edit portable (e.g., use a backup suffix and remove it, or detect GNU vs BSD sed and set a SED_INPLACE variable accordingly).
| sed -i '/^[[:space:]]*format: int\(32\|64\)$$/d' "$$f"; \ | |
| sed -i.bak '/^[[:space:]]*format: int\(32\|64\)$$/d' "$$f"; \ | |
| rm "$$f.bak"; \ |
|
Closing as duplicate of #1352 which addresses the same issue. Apologies for the noise. |
Summary
Fixes #1318
When running
helm install kagent-crds oci://ghcr.io/kagent-dev/kagent/helm/kagent-crds, warnings are emitted:These warnings come from
format: int32andformat: int64annotations in the CRD OpenAPI schemas. While controller-gen adds these annotations from Go types (int32/int64), the Kubernetes API server does not recognize them as valid OpenAPI format values.Changes
go/Makefile: Added a post-processing step tomake manifeststhat stripsformat: int32andformat: int64lines from generated CRD YAML files after controller-gen runsgo/config/crd/bases/andhelm/kagent-crds/templates/This is a standard approach used by many Kubernetes operators to suppress these warnings. The integer type information (
type: integer) is preserved — only the unrecognizedformatannotation is removed.Test plan
go/config/crd/bases/andhelm/kagent-crds/templates/are in synchelm install kagent-crdsno longer produces int format warnings