Skip to content

Unable to generate CRD with min/max validation for field with int32 alias type #1269

@erikgb

Description

@erikgb

While working on upgrading cert-manager to K8s 1.34, I had to fix an issue in upstream kubernetes-sigs/gateway-api#4044. Now that my PR is merged, but not yet released, I upgraded to a pseudo-version of gateway-api. This last bump introduced commits adding a lot of new markers to API types as part of adopting https://github.com/kubernetes-sigs/kube-api-linter in gateway-api.

And now I am unable to generate the cert-manager CRDs, which include the reuse of upstream Go types from gateway-api.

/root/.prow_go_mod_cache/sigs.k8s.io/[email protected]/apis/v1/shared_types.go:155:2: must apply maximum to a numeric value, found 
/root/.prow_go_mod_cache/sigs.k8s.io/[email protected]/apis/v1/shared_types.go:155:2: must apply minimum to a numeric value, found 
Error: not all generators ran successfully
run `controller-gen crd paths=./cmd/... paths=./deploy/... paths=./design/... paths=./docs/... paths=./gcb/... paths=./hack/... paths=./internal/... paths=./logo/... paths=./pkg/... paths=./test/... paths=./third_party/... paths=./tools/... output:crd:artifacts:config=_bin/scratch/crds -w` to see all available markers, or `controller-gen crd paths=./cmd/... paths=./deploy/... paths=./design/... paths=./docs/... paths=./gcb/... paths=./hack/... paths=./internal/... paths=./logo/... paths=./pkg/... paths=./test/... paths=./third_party/... paths=./tools/... output:crd:artifacts:config=_bin/scratch/crds -h` for usage
make[1]: *** [make/_shared_new/helm/crds.mk:61: generate-crds] Error 1

This error can be seen in our CI logs for my WIP PR.

The field causing this issue in gateway-api: https://github.com/kubernetes-sigs/gateway-api/blob/180e20fd1ea1de1cfd06d64d9892af2ae54f83de/apis/v1/shared_types.go#L151-L155

Issue discussed with @sbueringer on Kubernetes Slack (thread).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions