eclipse-jkube / jkube

Build and Deploy java applications on Kubernetes
https://www.eclipse.dev/jkube/
Eclipse Public License 2.0
774 stars 521 forks source link

re-apply fails on CRD (using traefik) project #577

Closed ghost closed 1 year ago

ghost commented 3 years ago

Description

I have a springboot project that is using a IngressRoute (traefik CRD). With the help from @rohanKanojia it is now possible to deploy to kubernetes barebone cluster. However, when re-applying (mvn k8s:apply) it fails:

Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.0.2:apply (default-cli) on project demo: Execution default-cli of goal org.eclipse.jkube:kubernetes-maven-plugin:1.0.2:apply failed: Failure executing: PUT at: https://168.119.233.19:6443/apis/traefik.containo.us/v1alpha1/namespaces/default/tlsoptions/quasifacttlsoption. Message: tlsoptions.traefik.containo.us "quasifacttlsoption" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=metadata.resourceVersion, message=Invalid value: 0x0: must be specified for an update, reason=FieldValueInvalid, additionalProperties={})], group=traefik.containo.us, kind=tlsoptions, name=quasifacttlsoption, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=tlsoptions.traefik.containo.us "quasifacttlsoption" is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}). -> [Help 1]

StackOverFlow Conversation: https://stackoverflow.com/questions/65984438

Info

run it twice

manusa commented 3 years ago

Should be fixed on #534 Will be available in next minor release.

manusa commented 3 years ago

@rohanKanojia to check if the provided reproducer works OK in master branch.

rohanKanojia commented 3 years ago

I can confirm that I can get the above project working with 1.2.0-SNAPSHOT

First Apply (Create):

mvn k8s:resource k8s:apply
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------------< com.quasifact:demo >-------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- kubernetes-maven-plugin:1.2.0-SNAPSHOT:resource (default-cli) @ demo ---
[INFO] k8s: Generators:
[INFO] k8s:  - quarkus
[INFO] k8s:  - spring-boot
[INFO] k8s: Running generator spring-boot
[INFO] k8s: spring-boot: Using Docker image quay.io/jkube/jkube-java-binary-s2i:0.0.9 as base / builder
[INFO] k8s: spring-boot: Using fat jar packaging as the spring boot plugin is using `repackage` goal execution
[INFO] k8s:  - wildfly-swarm
[INFO] k8s:  - thorntail-v2
[INFO] k8s:  - wildfly-jar
[INFO] k8s:  - openliberty
[INFO] k8s:  - karaf
[INFO] k8s:  - vertx
[INFO] k8s:  - micronaut
[INFO] k8s:  - java-exec
[INFO] k8s:  - webapp
[INFO] k8s: Enrichers:
[INFO] k8s: - jkube-metadata
[INFO] k8s: - jkube-name
[INFO] k8s: - jkube-controller
[INFO] k8s: - jkube-controller-from-configuration
[INFO] k8s: - jkube-service
[INFO] k8s: - jkube-namespace
[INFO] k8s: - jkube-image
[INFO] k8s: - jkube-portname
[INFO] k8s: - jkube-project-label
[INFO] k8s: - jkube-dependency
[INFO] k8s: - jkube-pod-annotations
[INFO] k8s: - jkube-git
[INFO] k8s: - jkube-maven-scm
[INFO] k8s: - jkube-serviceaccount
[INFO] k8s: - jkube-maven-issue-mgmt
[INFO] k8s: - jkube-debug
[INFO] k8s: - jkube-remove-build-annotations
[INFO] k8s: - jkube-volume-permission
[INFO] k8s: - jkube-configmap-file
[INFO] k8s: - jkube-secret-file
[INFO] k8s: - jkube-openshift-service-expose
[INFO] k8s: - jkube-openshift-route
[INFO] k8s: - jkube-openshift-deploymentconfig
[INFO] k8s: - jkube-openshift-project
[INFO] k8s: - jkube-ingress
[INFO] k8s: - jkube-healthcheck-quarkus
[INFO] k8s: - jkube-healthcheck-spring-boot
[INFO] k8s: - jkube-healthcheck-wildfly-swarm
[INFO] k8s: - jkube-healthcheck-thorntail-v2
[INFO] k8s: - jkube-healthcheck-wildfly-jar
[INFO] k8s: - jkube-healthcheck-karaf
[INFO] k8s: - jkube-healthcheck-vertx
[INFO] k8s: - jkube-healthcheck-docker
[INFO] k8s: - jkube-healthcheck-webapp
[INFO] k8s: - jkube-healthcheck-micronaut
[INFO] k8s: - jkube-prometheus
[INFO] k8s: - jkube-service-discovery
[INFO] k8s: - jkube-container-env-java-options
[INFO] k8s: - jkube-revision-history
[INFO] k8s: - jkube-docker-registry-secret
[INFO] k8s: - jkube-triggers-annotation
[INFO] k8s: - jkube-openshift-imageChangeTrigger
[INFO] k8s: Using resource templates from /home/rohaan/work/repos/jkube-testing-samples/demo/src/main/jkube
[INFO] k8s: jkube-controller: Adding a default Deployment
[INFO] k8s: jkube-service: Adding a default service 'demo' with ports [8080]
[INFO] k8s: jkube-portname: Adding default port name http for port 8080
[INFO] k8s: jkube-portname: Adding default port name prometheus for port 9779
[INFO] k8s: jkube-portname: Adding default port name jolokia for port 8778
[INFO] k8s: jkube-debug: Debugging not enabled. To enable try setting the jkube.debug.enabled maven or system property to 'true'                                                                                              
[INFO] k8s: jkube-openshift-service-expose: Adding Service label 'expose:true' on service demo so that it is exposed by the exposecontroller microservice. To disable use the maven argument: '-Dfabric8.profile=internal-microservice'                                                                                                      
[INFO] k8s: jkube-healthcheck-spring-boot: Adding readiness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 10 seconds                                                                         
[INFO] k8s: jkube-healthcheck-spring-boot: Adding liveness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 180 seconds                                                                         
[INFO] k8s: jkube-prometheus: Adding prometheus.io annotations: prometheus.io/path=/metrics, prometheus.io/port=9779, prometheus.io/scrape=true                                                                               
[INFO] k8s: jkube-service-discovery: Using first mentioned service port '8080' 
[INFO] k8s: jkube-revision-history: Adding revision history limit to 2
[INFO] k8s: jkube-docker-registry-secret: Adding secrets resources from plugin configuration
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/quasifact-com-secret-secret.yml resource                                                                   
[WARNING] Unknown keyword $module - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
[WARNING] Unknown keyword existingJavaType - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
[WARNING] Unknown keyword javaOmitEmpty - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
[WARNING] Unknown keyword serializer - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
[WARNING] Unknown keyword deserializer - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/demo-service.yml resource                                                                                  
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/demo-deployment.yml resource                                                                               
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/demo.yml resource                                                                                          
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/exampletlsoption.yml resource                                                                              
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/ingressroutes.traefik.containo.us-customerresourcedefinition resource                                      
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/quasifacttlsoption.yml resource                                                                            
[INFO] 
[INFO] --- kubernetes-maven-plugin:1.2.0-SNAPSHOT:apply (default-cli) @ demo ---
[INFO] k8s: Using Kubernetes at https://192.168.39.234:8443/ in namespace default with manifest /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes.yml                               
[INFO] k8s: Using currentNamespace: default
[INFO] k8s: Creating a Secret from kubernetes.yml namespace default name quasifact-com-secret
[INFO] k8s: Created Secret: target/jkube/applyJson/default/secret-quasifact-com-secret-1.json
[INFO] k8s: Creating a Service from kubernetes.yml namespace default name demo
[INFO] k8s: Created Service: target/jkube/applyJson/default/service-demo-1.json
[INFO] k8s: Creating a Custom Resource Definition from kubernetes.yml name ingressroutes.traefik.containo.us
[INFO] k8s: Created Custom Resource Definition result: ingressroutes.traefik.containo.us
[INFO] k8s: Creating a Deployment from kubernetes.yml namespace default name demo
[INFO] k8s: Created Deployment: target/jkube/applyJson/default/deployment-demo.json
[INFO] k8s: Created Custom Resource: traefik.containo.us/v1alpha1#IngressRoute default/demo
[INFO] k8s: Created Custom Resource: traefik.containo.us/v1alpha1#TLSOption default/exampletlsoption
[INFO] k8s: Created Custom Resource: traefik.containo.us/v1alpha1#TLSOption default/quasifacttlsoption
[INFO] k8s: HINT: Use the command `kubectl get pods -w` to watch your pods start up
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  14.938 s
[INFO] Finished at: 2021-03-02T19:22:45+05:30
[INFO] ------------------------------------------------------------------------

Second apply( Update) :

demo : $ mvn k8s:resource k8s:apply
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------------< com.quasifact:demo >-------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- kubernetes-maven-plugin:1.2.0-SNAPSHOT:resource (default-cli) @ demo ---
[INFO] k8s: Generators:
[INFO] k8s:  - quarkus
[INFO] k8s:  - spring-boot
[INFO] k8s: Running generator spring-boot
[INFO] k8s: spring-boot: Using Docker image quay.io/jkube/jkube-java-binary-s2i:0.0.9 as base / builder
[INFO] k8s: spring-boot: Using fat jar packaging as the spring boot plugin is using `repackage` goal execution
[INFO] k8s:  - wildfly-swarm
[INFO] k8s:  - thorntail-v2
[INFO] k8s:  - wildfly-jar
[INFO] k8s:  - openliberty
[INFO] k8s:  - karaf
[INFO] k8s:  - vertx
[INFO] k8s:  - micronaut
[INFO] k8s:  - java-exec
[INFO] k8s:  - webapp
[INFO] k8s: Enrichers:
[INFO] k8s: - jkube-metadata
[INFO] k8s: - jkube-name
[INFO] k8s: - jkube-controller
[INFO] k8s: - jkube-controller-from-configuration
[INFO] k8s: - jkube-service
[INFO] k8s: - jkube-namespace
[INFO] k8s: - jkube-image
[INFO] k8s: - jkube-portname
[INFO] k8s: - jkube-project-label
[INFO] k8s: - jkube-dependency
[INFO] k8s: - jkube-pod-annotations
[INFO] k8s: - jkube-git
[INFO] k8s: - jkube-maven-scm
[INFO] k8s: - jkube-serviceaccount
[INFO] k8s: - jkube-maven-issue-mgmt
[INFO] k8s: - jkube-debug
[INFO] k8s: - jkube-remove-build-annotations
[INFO] k8s: - jkube-volume-permission
[INFO] k8s: - jkube-configmap-file
[INFO] k8s: - jkube-secret-file
[INFO] k8s: - jkube-openshift-service-expose
[INFO] k8s: - jkube-openshift-route
[INFO] k8s: - jkube-openshift-deploymentconfig
[INFO] k8s: - jkube-openshift-project
[INFO] k8s: - jkube-ingress
[INFO] k8s: - jkube-healthcheck-quarkus
[INFO] k8s: - jkube-healthcheck-spring-boot
[INFO] k8s: - jkube-healthcheck-wildfly-swarm
[INFO] k8s: - jkube-healthcheck-thorntail-v2
[INFO] k8s: - jkube-healthcheck-wildfly-jar
[INFO] k8s: - jkube-healthcheck-karaf
[INFO] k8s: - jkube-healthcheck-vertx
[INFO] k8s: - jkube-healthcheck-docker
[INFO] k8s: - jkube-healthcheck-webapp
[INFO] k8s: - jkube-healthcheck-micronaut
[INFO] k8s: - jkube-prometheus
[INFO] k8s: - jkube-service-discovery
[INFO] k8s: - jkube-container-env-java-options
[INFO] k8s: - jkube-revision-history
[INFO] k8s: - jkube-docker-registry-secret
[INFO] k8s: - jkube-triggers-annotation
[INFO] k8s: - jkube-openshift-imageChangeTrigger
[INFO] k8s: Using resource templates from /home/rohaan/work/repos/jkube-testing-samples/demo/src/main/jkube
[INFO] k8s: jkube-controller: Adding a default Deployment
[INFO] k8s: jkube-service: Adding a default service 'demo' with ports [8080]
[INFO] k8s: jkube-portname: Adding default port name http for port 8080
[INFO] k8s: jkube-portname: Adding default port name prometheus for port 9779
[INFO] k8s: jkube-portname: Adding default port name jolokia for port 8778
[INFO] k8s: jkube-debug: Debugging not enabled. To enable try setting the jkube.debug.enabled maven or system property to 'true'                                                                                              
[INFO] k8s: jkube-openshift-service-expose: Adding Service label 'expose:true' on service demo so that it is exposed by the exposecontroller microservice. To disable use the maven argument: '-Dfabric8.profile=internal-microservice'                                                                                                      
[INFO] k8s: jkube-healthcheck-spring-boot: Adding readiness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 10 seconds                                                                         
[INFO] k8s: jkube-healthcheck-spring-boot: Adding liveness probe on port 8080, path='/actuator/health', scheme='HTTP', with initial delay 180 seconds                                                                         
[INFO] k8s: jkube-prometheus: Adding prometheus.io annotations: prometheus.io/path=/metrics, prometheus.io/port=9779, prometheus.io/scrape=true                                                                               
[INFO] k8s: jkube-service-discovery: Using first mentioned service port '8080' 
[INFO] k8s: jkube-revision-history: Adding revision history limit to 2
[INFO] k8s: jkube-docker-registry-secret: Adding secrets resources from plugin configuration
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/quasifact-com-secret-secret.yml resource                                                                   
[WARNING] Unknown keyword $module - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
[WARNING] Unknown keyword existingJavaType - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
[WARNING] Unknown keyword javaOmitEmpty - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
[WARNING] Unknown keyword serializer - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
[WARNING] Unknown keyword deserializer - you should define your own Meta Schema. If the keyword is irrelevant for validation, just use a NonValidationKeyword
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/demo-service.yml resource                                                                                  
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/demo-deployment.yml resource                                                                               
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/demo.yml resource                                                                                          
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/exampletlsoption.yml resource                                                                              
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/ingressroutes.traefik.containo.us-customerresourcedefinition resource                                      
[INFO] k8s: validating /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes/quasifacttlsoption.yml resource
[INFO] 
[INFO] --- kubernetes-maven-plugin:1.2.0-SNAPSHOT:apply (default-cli) @ demo ---
[INFO] k8s: Using Kubernetes at https://192.168.39.234:8443/ in namespace default with manifest /home/rohaan/work/repos/jkube-testing-samples/demo/target/classes/META-INF/jkube/kubernetes.yml 
[INFO] k8s: Using currentNamespace: default
[INFO] k8s: Updating Secret from kubernetes.yml
[INFO] k8s: Updated Secret: target/jkube/applyJson/default/secret-quasifact-com-secret-2.json
[INFO] k8s: Updating Service from kubernetes.yml
[INFO] k8s: Updated Service: target/jkube/applyJson/default/service-demo-2.json
[INFO] k8s: Updating CustomResourceDefinition from kubernetes.yml
[INFO] k8s: Updated CustomResourceDefinition: target/jkube/applyJson/default/customresourcedefinition-ingressroutes.traefik.containo.us-1.json
[INFO] k8s: Updating Deployment from kubernetes.yml
[INFO] k8s: Updated Deployment: target/jkube/applyJson/default/deployment-demo-1.json
[INFO] k8s: Updated Custom Resource: traefik.containo.us/v1alpha1#IngressRoute default/demo
[INFO] k8s: Updated Custom Resource: traefik.containo.us/v1alpha1#TLSOption default/exampletlsoption
[INFO] k8s: Updated Custom Resource: traefik.containo.us/v1alpha1#TLSOption default/quasifacttlsoption
[INFO] k8s: HINT: Use the command `kubectl get pods -w` to watch your pods start up
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.474 s
[INFO] Finished at: 2021-03-02T19:23:05+05:30
[INFO] ------------------------------------------------------------------------
demo : $ kubectl get ingressroute
NAME   AGE
demo   72s
manusa commented 1 year ago

Closing as the reproducer project was working on v1.2-SNAPSHOT and the reporting user no longer exists. Please open a new issue for any other similar error.