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

schema validation warnings during mvn oc:resource and gradle k8sResource #1934

Closed
sockejr opened this issue Nov 23, 2022 · 2 comments · Fixed by #2010
Closed

schema validation warnings during mvn oc:resource and gradle k8sResource #1934

sockejr opened this issue Nov 23, 2022 · 2 comments · Fixed by #2010
Assignees
Labels
bug Something isn't working
Milestone

Comments

@sockejr
Copy link

sockejr commented Nov 23, 2022

Describe the bug

During mvn builds in the goal oc:resource the following warnings are displayed:
Unknown keyword $module - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword Unknown keyword existingJavaType - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword Unknown keyword javaOmitEmpty - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
This seems to be related to the schema validation, see discussion here:
#1932

Eclipse JKube version

other (please specify in additional context)

Component

OpenShift Maven Plugin

Apache Maven version

3.8.3

Gradle version

7.4.2

Steps to reproduce

in a project just run oc:resource
in a gradle project run k8sResource
see quickstart examples

Expected behavior

no schema validations are shown for keywords $module, existingjavaType, javaOmitEmpty

Runtime

OpenShift

Kubernetes API Server version

other (please specify in additional context)

Environment

Windows

Eclipse JKube Logs

from quickstart examples:$ ./gradlew k8sResource -Djkube.domain=$(minikube ip).nip.io
> Task :k8sResource
k8s: Running generator webapp
k8s: webapp: Using quay.io/jkube/jkube-jetty9:0.0.16 as base image for webapp
k8s: Using resource templates from /home/sunix/github/eclipse/jkube/quickstarts/gradle/webapp-jetty/src/main/jkube
k8s: jkube-controller: Adding a default Deployment
k8s: jkube-service: Adding a default service 'webapp-jetty' with ports [8080]
k8s: jkube-service-discovery: Using first mentioned service port '8080' 
k8s: jkube-revision-history: Adding revision history limit to 2
k8s: validating /home/sunix/github/eclipse/jkube/quickstarts/gradle/webapp-jetty/build/classes/java/main/META-INF/jkube/kubernetes/webapp-jetty-deployment.yml resource
Unknown keyword $module - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
Unknown keyword existingJavaType - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
Unknown keyword javaOmitEmpty - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
k8s: validating /home/sunix/github/eclipse/jkube/quickstarts/gradle/webapp-jetty/build/classes/java/main/META-INF/jkube/kubernetes/webapp-jetty-service.yml resource
k8s: validating /home/sunix/github/eclipse/jkube/quickstarts/gradle/webapp-jetty/build/classes/java/main/META-INF/jkube/kubernetes/webapp-jetty-ingress.yml resource


from mvn oc:resource
Unknown keyword $module - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword Unknown keyword existingJavaType - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword Unknown keyword javaOmitEmpty - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword

Sample Reproducer Project

https://github.com/eclipse/jkube/tree/master/quickstarts/maven/webapp-jetty

Additional context

this is happening for maven and gradle
this is happening when running oc:resource task, k8sResource task possibly (not checked) when running k8s:resource and ocResource.
according to discussion this also is happening for a long time
#1932

@sockejr sockejr added the bug Something isn't working label Nov 23, 2022
@rohanKanojia rohanKanojia self-assigned this Jan 18, 2023
@rohanKanojia
Copy link
Member

looks like it's talking about these keywords in the validation schema:

{
  "$module": "coordination"

This is just a meta field for the Kubernetes model generator module that generated the schema (e.g. kubernetes-model-apps, kubernetes-model-certificates, etc.)

I think we should just add NonValidationKeyword for these in ResourceValidator:

https://github.com/eclipse/jkube/blob/174d1897655b8af31637d79728169768d2cf8004/jkube-kit/common/src/main/java/org/eclipse/jkube/kit/common/util/validator/ResourceValidator.java#L162-L164

@manusa
Copy link
Member

manusa commented Jan 19, 2023

I think we should just add NonValidationKeyword for these in ResourceValidator:

Please, go ahead

rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jan 19, 2023
…in order to avoid schema validation warnings (eclipse-jkube#1934)

Add additional NonValidationKeywords in ResourceValidator's
JsonMetaSchema in order to avoid schema validation warnings about
unknown keywords.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Jan 19, 2023
…in order to avoid schema validation warnings (eclipse-jkube#1934)

Add additional NonValidationKeywords in ResourceValidator's
JsonMetaSchema in order to avoid schema validation warnings about
unknown keywords.

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@manusa manusa added this to the 1.11.0 milestone Jan 20, 2023
manusa pushed a commit that referenced this issue Jan 23, 2023
…in order to avoid schema validation warnings (#1934)

Add additional NonValidationKeywords in ResourceValidator's
JsonMetaSchema in order to avoid schema validation warnings about
unknown keywords.

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
3 participants