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

Spring Boot Dekorate Maven Quickstart throws NPE on k8s:apply #1113

Closed
rohanKanojia opened this issue Nov 10, 2021 · 0 comments · Fixed by #1124
Closed

Spring Boot Dekorate Maven Quickstart throws NPE on k8s:apply #1113

rohanKanojia opened this issue Nov 10, 2021 · 0 comments · Fixed by #1124
Assignees

Comments

@rohanKanojia
Copy link
Member

Description

When I'm running k8s:apply goal to apply manifests generated by dekorate to Kubernetes Cluster. I'm getting NullPointerException:

spring-boot-dekorate : $ mvn k8s:apply -Pkubernetes
[INFO] Scanning for projects...
[INFO] 
[INFO] ------< org.eclipse.jkube.quickstarts.maven:spring-boot-dekorate >------
[INFO] Building Eclipse JKube :: Quickstarts :: Maven :: Spring Boot - Dekorate 1.5.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- kubernetes-maven-plugin:1.5.1:apply (default-cli) @ spring-boot-dekorate ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.672 s
[INFO] Finished at: 2021-11-10T23:10:53+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.5.1:apply (default-cli) on project spring-boot-dekorate: null: MojoExecutionException: NullPointerException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

NPE seems to be pointing to this line (items being null):

https://github.com/eclipse/jkube/blob/2a328258896d2079a3f3d8059c40b7cb141099da/jkube-kit/common/src/main/java/org/eclipse/jkube/kit/common/util/ResourceUtil.java#L97

This seems to be affecting all versions since v1.1.0. Quickstart is working for me on v1.1.0, but fails on all later versions. The problem seems to be coming from recent changes in ResourceUtil class that it can no longer handle multiple document manifests which are added by Dekorate:

---
apiVersion: "v1"
kind: "Service"
metadata:
  labels:
    app: "spring-boot-dekorate"
    decorated-by: "dekorate"
    version: "latest"
    group: "jkube"
---
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
  labels:
    app: "spring-boot-dekorate"

It only seems to be accepting this format:

---
apiVersion: v1
kind: List
items:
- apiVersion: v1
  kind: Service
  metadata:
    annotations:

Info

  • Eclipse JKube version : 1.5.1
  • Maven version (mvn -v) :
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /opt/apache-maven
Java version: 11.0.11, vendor: Oracle Corporation, runtime: /usr/java/jdk-11.0.11
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.14.14-300.fc35.x86_64", arch: "amd64", family: "unix"
  • Kubernetes / Red Hat OpenShift setup and version : N/A

  • If it's a bug, how to reproduce : Go to quickstarts/maven/spring-boot-dekorate and run mvn clean install k8s:apply -Pkubernetes you'll get NPE

rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Nov 10, 2021
…late` should also handle YAML manifests with multiple docs

+ Added logic in `ResourceUtil.deserializeKubernetesListOrTemplate()`
  method to handle YAML manifests which multiple documents. This was
  causing deserialization to fail when JKube was trying to deserialize
  manifests generated by Dekorate

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Nov 11, 2021
…late` should also handle YAML manifests with multiple docs

+ Added logic in `ResourceUtil.deserializeKubernetesListOrTemplate()`
  method to handle YAML manifests which multiple documents. This was
  causing deserialization to fail when JKube was trying to deserialize
  manifests generated by Dekorate

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@rohanKanojia rohanKanojia self-assigned this Nov 11, 2021
manusa pushed a commit to rohanKanojia/jkube that referenced this issue Nov 18, 2021
…late` should also handle YAML manifests with multiple docs

+ Added logic in `ResourceUtil.deserializeKubernetesListOrTemplate()`
  method to handle YAML manifests which multiple documents. This was
  causing deserialization to fail when JKube was trying to deserialize
  manifests generated by Dekorate

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
manusa pushed a commit to manusa/jkube that referenced this issue Nov 18, 2021
…late` should also handle YAML manifests with multiple docs

+ Added logic in `ResourceUtil.deserializeKubernetesListOrTemplate()`
  method to handle YAML manifests which multiple documents. This was
  causing deserialization to fail when JKube was trying to deserialize
  manifests generated by Dekorate

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@manusa manusa mentioned this issue Nov 18, 2021
12 tasks
manusa pushed a commit that referenced this issue Nov 23, 2021
…also handle YAML manifests with multiple docs

+ Added logic in `ResourceUtil.deserializeKubernetesListOrTemplate()`
  method to handle YAML manifests which multiple documents. This was
  causing deserialization to fail when JKube was trying to deserialize
  manifests generated by Dekorate

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
None yet
Projects
None yet
1 participant