-
Notifications
You must be signed in to change notification settings - Fork 522
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
NullPointerException on k8s:resource #578
Comments
error seems to disappear if adding an empty build env-vars, like so: <build>
<env>
</env>
</build> |
Duplicate of #618 |
When I use an ImageConfiguration with no XML configuration as provided in https://github.com/shaohme/k8stest like this: <image>
<name>local/my-image</name>
<alias>local-my-image</alias>
<watch>
<mode>none</mode>
</watch>
<run>
<wait>
<http>
<url>http://localhost:8080/status</url>
<method>GET</method>
<status>200</status>
</http>
<time>6000</time>
<shutdown>500</shutdown>
</wait>
<log>
<enabled>true</enabled>
<color>green</color>
</log>
</run>
</image> No image is built using build goal:
On running
When I add empty <configuration>
<imagePullPolicy>Never</imagePullPolicy>
<namespace>testing-ns</namespace>
<images>
<image>
<name>local/my-image</name>
<alias>local-my-image</alias>
<watch>
<mode>none</mode>
</watch>
<run>
<wait>
<http>
<url>http://localhost:8080/status</url>
<method>GET</method>
<status>200</status>
</http>
<time>6000</time>
<shutdown>500</shutdown>
</wait>
<log>
<enabled>true</enabled>
<color>green</color>
</log>
</run>
<build>
<env>
</env>
</build>
</image>
</images>
</configuration> With this configuration, I'm not able to build using
I think for XML configuration, |
These are several scenarios:
|
jkube.generator.name XML image configuration <configuration>
<images>
<image>
<name>rohankanojia/image-configured-xml:latest</name>
</image>
</images>
</configuration> However, if I add another filter
When I have image name configured via both properties and XML configuration, image name configured via XML takes precedence. Generators automatically get disabled in case someone provides imageconfiguration with buildconfiguration(see BaseGenerator). I couldn't really find any documentation for precedence order.
When I provide two imageconfiguration via XML, it created Deployment with two containers: <configuration>
<images>
<image>
<name>rohankanojia/firstimage:latest</name>
<build>
<from>openjdk:latest</from>
<cmd>java -jar maven/${project.artifactId}-${project.version}.jar</cmd>
</build>
</image>
<image>
<name>rohankanojia/secondimage:latest</name>
<build>
<from>openjdk:latest</from>
<cmd>java -jar maven/${project.artifactId}-${project.version}.jar</cmd>
</build>
</image>
</images>
</configuration> Generated Deployment manifest: k8stest : $ cat target/classes/META-INF/jkube/kubernetes/k8stesting-deployment.yml
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
jkube.io/git-url: [email protected]:shaohme/k8stest.git
jkube.io/git-commit: fa8fab33d590d92f143bf404fb241f9bda4fff9e
jkube.io/git-branch: main
labels:
app: K8sTesting
provider: jkube
version: 1.0-SNAPSHOT
group: org.test
name: k8stesting
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: K8sTesting
provider: jkube
group: org.test
template:
metadata:
annotations:
jkube.io/git-url: [email protected]:shaohme/k8stest.git
jkube.io/git-commit: fa8fab33d590d92f143bf404fb241f9bda4fff9e
jkube.io/git-branch: main
labels:
app: K8sTesting
provider: jkube
version: 1.0-SNAPSHOT
group: org.test
spec:
containers:
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: metadata.name
image: rohankanojia/firstimage:latest
imagePullPolicy: IfNotPresent
name: rohankanojia-K8sTesting
securityContext:
privileged: false
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: metadata.name
image: rohankanojia/secondimage:latest
imagePullPolicy: IfNotPresent
name: rohankanojia-K8sTesting
securityContext:
privileged: false Similarly if I add three images in XML config, it results in Deployment with three containers |
|
…sMergeEnricher + Fix NullPointerException in ContainerEnvJavaOptionsMergeEnricher + Add FAQ for image name configuration in docs + Add note in docs for image precedence of XML configuration over generators + Added sentence in `jkube.generator.name` flag description that it's only applicable in scope of generators
…sMergeEnricher + Fix NullPointerException in ContainerEnvJavaOptionsMergeEnricher + Add FAQ for image name configuration in docs + Add note in docs for image precedence of XML configuration over generators + Added sentence in `jkube.generator.name` flag description that it's only applicable in scope of generators
…sMergeEnricher + Fix NullPointerException in ContainerEnvJavaOptionsMergeEnricher + Add FAQ for image name configuration in docs + Add note in docs for image precedence of XML configuration over generators + Added sentence in `jkube.generator.name` flag description that it's only applicable in scope of generators
…sMergeEnricher + Fix NullPointerException in ContainerEnvJavaOptionsMergeEnricher + Add FAQ for image name configuration in docs + Add note in docs for image precedence of XML configuration over generators + Added sentence in `jkube.generator.name` flag description that it's only applicable in scope of generators
+ Fix NullPointerException in ContainerEnvJavaOptionsMergeEnricher + Add FAQ for image name configuration in docs + Add note in docs for image precedence of XML configuration over generators + Added sentence in `jkube.generator.name` flag description that it's only applicable in scope of generators
Description
Info
mvn -v
) :Kubernetes / Red Hat OpenShift setup and version :
minikube version: v1.17.1
commit: 043bdca07e54ab6e4fc0457e3064048f34133d7e
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", BuildDate:"2021-01-13T13:28:09Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", BuildDate:"2021-01-13T13:20:00Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
If it's a bug, how to reproduce :
Running "mvn -Dkubernetes k8s:resource" I get a NullPointerException in org.eclipse.jkube.enricher.generic.ContainerEnvJavaOptionsMergeEnricher$ContainerEnvJavaOptionsMergeVisitor.lambda$visit$1 . creating an empty tag solves the problem, but that hinders me using an already build and existing Docker image.
If it's a feature request, what is your use case :
Sample Reproducer Project : [GitHub Clone URL]
https://github.com/shaohme/k8stest.git
The text was updated successfully, but these errors were encountered: