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

Resource Validation is done before resources are generated by k8s:resource #2008

Closed
rohanKanojia opened this issue Jan 19, 2023 · 0 comments · Fixed by #2009
Closed

Resource Validation is done before resources are generated by k8s:resource #2008

rohanKanojia opened this issue Jan 19, 2023 · 0 comments · Fixed by #2009
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rohanKanojia
Copy link
Member

Describe the bug

I observed this while working on #1934

On a fresh build project, k8s:resource does not perform any resource validation:

$ mvn clean install k8s:resource

However, if you've already run k8s:resource before, you'd see validation on the second run. This behavior is due to validation method invoked before resource files are actually written:

https://github.com/eclipse/jkube/blob/174d1897655b8af31637d79728169768d2cf8004/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/ResourceMojo.java#L216-L217

Gradle Plugins don't seem to affected by this issue. They're correctly invoking validation after resource generation:
https://github.com/eclipse/jkube/blob/174d1897655b8af31637d79728169768d2cf8004/gradle-plugin/kubernetes/src/main/java/org/eclipse/jkube/gradle/plugin/task/KubernetesResourceTask.java#L91-L92

Eclipse JKube version

1.10.0

Component

Kubernetes Maven Plugin

Apache Maven version

3.8.5

Gradle version

None

Steps to reproduce

Run mvn clean install k8s:resource , no validation would be performed

Expected behavior

Validation should be performed after resource generation. Lines 216 and 127 should be swapped in ResourceMojo.java

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3

Environment

Linux

Eclipse JKube Logs

No response

Sample Reproducer Project

No response

Additional context

No response

@rohanKanojia rohanKanojia added the bug Something isn't working label Jan 19, 2023
@rohanKanojia rohanKanojia self-assigned this Jan 19, 2023
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jan 19, 2023
…sources are generated by `k8s:resource` (eclipse-jkube#2008)

Resource validation should be done after resources are written.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jan 19, 2023
…sources are generated by `k8s:resource` (eclipse-jkube#2008)

Resource validation should be done after resources are written.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jan 23, 2023
…sources are generated by `k8s:resource` (eclipse-jkube#2008)

Resource validation should be done after resources are written.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@manusa manusa added this to the 1.11.0 milestone Jan 23, 2023
manusa pushed a commit that referenced this issue Jan 23, 2023
…sources are generated by `k8s:resource` (#2008)

Resource validation should be done after resources are written.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants