Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAPI Schema Validation Errors for imagePullSecrets and hostAliases for CronjobTutorial sample with controller-runtime v0.18.3 and Kubernetes 1.30 #3917

Closed
camilamacedo86 opened this issue May 16, 2024 · 3 comments · Fixed by #3957
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@camilamacedo86
Copy link
Member

What broke? What's expected?

Problem Description

After upgrading the controller-runtime version from v0.17.3 to v0.18.3 (which means upgrade k8s api from 1.29 to 1.30), we encountered validation errors when running make test-book due to changes in Kubernetes 1.30. The issue stems from the addition of the // +listType=atomic marker to the imagePullSecrets and hostAliases fields in the k8s.io/api/batch/v1 API used in the cronjob tutorial. This marker results in OpenAPI schema validation errors when the CRD is generated with x-kubernetes-list-type: atomic.

Kubernetes Issue Reference: kubernetes/kubernetes#124540

See the error faced:

      unable to install CRDs onto control plane: unable to create CRD instances: unable to create CRD "cronjobs.batch.tutorial.kubebuilder.io": CustomResourceDefinition.apiextensions.k8s.io "cronjobs.batch.tutorial.kubebuilder.io" is invalid: [spec.validation.openAPIV3Schema.properties[spec].properties[jobTemplate].properties[spec].properties[template].properties[spec].properties[imagePullSecrets].items.properties[name].default: Required value: this property is in x-kubernetes-list-map-keys, so it must have a default or be a required property, spec.validation.openAPIV3Schema.properties[spec].properties[jobTemplate].properties[spec].properties[template].properties[spec].properties[hostAliases].items.properties[ip].default: Required value: this property is in x-kubernetes-list-map-keys, so it must have a default or be a required property]

Therefore, we commented the test called in the makefile target .PHONY: test-book.
When we be able to update controller-runtime within an upper version that us using a k8s version with the fix we should uncomment the test and ensure that all is fine.

What is required to do here:

  • Upgrade controller-runtime with a newer release > v0.18.2 and with an upper version of k8s
  • Run make generate to update the samples and the tutorial code
  • Uncomment the test to ensure that we will check the cronjob-tutorial
  • Check if make test-book will work fine and the CI test pull-kubebuilder-test will not fail

Reproducing this issue

No response

KubeBuilder (CLI) Version

rc-4.0.0

PROJECT version

master

Plugin versions

No response

Other versions

No response

Extra Labels

No response

@camilamacedo86 camilamacedo86 added kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels May 16, 2024
@camilamacedo86 camilamacedo86 changed the title OpenAPI Schema Validation Errors for imagePullSecrets and hostAliases with controller-runtime v0.18.3 and Kubernetes 1.30 OpenAPI Schema Validation Errors for imagePullSecrets and hostAliases for CronjobTutorial samples with controller-runtime v0.18.3 and Kubernetes 1.30 May 16, 2024
@camilamacedo86 camilamacedo86 changed the title OpenAPI Schema Validation Errors for imagePullSecrets and hostAliases for CronjobTutorial samples with controller-runtime v0.18.3 and Kubernetes 1.30 OpenAPI Schema Validation Errors for imagePullSecrets and hostAliases for CronjobTutorial sample with controller-runtime v0.18.3 and Kubernetes 1.30 May 16, 2024
@camilamacedo86
Copy link
Member Author

For more info see the diff of the PR: https://github.com/kubernetes-sigs/kubebuilder/pull/3912/files

@ManuelMueller1st
Copy link

I get the same error trying to run make install during the tutorial using KubeBuilderVersion:"4.0.0". Is there anything I must do to get the fix applied?

@caffe-in
Copy link

caffe-in commented Jul 1, 2024

I get the same error trying to run make install during the tutorial using KubeBuilderVersion:"4.0.0". Is there anything I must do to get the fix applied?

I upate the controller-runtime to v0.18.3 using "go get sigs.k8s.io/controller-runtime@v0.18.3" in terminal and it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
3 participants