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

chore: fix unit tests #20

Closed
wants to merge 1 commit into from

Conversation

eddycharly
Copy link
Contributor

This PR fixes unit tests.

One thing though, creating a pod with a container that has no image is valid.
@alexzielenski It looks like we are patching the schema to make image a required field ?

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 5, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: eddycharly
Once this PR has been reviewed and has the lgtm label, please assign apelisse for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 5, 2023
@apelisse apelisse mentioned this pull request May 5, 2023
@alexzielenski
Copy link
Contributor

ah did not see this before I opened my own. Im thinking maybe we should close this in favor of #21, since I changed some things to support the patches in the tests.

since the OpenAPI schema for native types is incomplete, part of the kubectl-validate project is to work on upstream types to improve the quality of the schemas, and back port the changes to earlier k8s schemas via patching

@eddycharly
Copy link
Contributor Author

@alexzielenski no problem to close it.

Still, creating pods with containers having no image is valid, we should at least make the patching optional.

@alexzielenski
Copy link
Contributor

Still, creating pods with containers having no image is valid, we should at least make the patching optional.

Do you have a source/example of this? When I try to apply the case to my cluster I get the expected error, and in the source for Container validation there is logic to throw this error:

https://github.com/kubernetes/kubernetes/blob/3f8c4794eadf8aadd8a5bcb0b875bf0af5c2020b/pkg/apis/core/validation/validation.go#L3220-L3222

$ kubectl apply -f testcases/manifests/error_missing_image.yaml
The Pod "nginx-pod" is invalid: spec.containers[0].image: Required value

$ kubectl apply -f testcases/manifests/error_missing_image.yaml --server-side=true
The Pod "nginx-pod" is invalid: spec.containers[0].image: Required value

@alexzielenski
Copy link
Contributor

/close

in favor of #21

@k8s-ci-robot
Copy link
Contributor

@alexzielenski: Closed this PR.

In response to this:

/close

in favor of #21

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@eddycharly
Copy link
Contributor Author

Hmmm maybe it’s just on openshift ?
It’s used with image streams iirc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants