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

NodePorts not created when jkube/service.yml is defined #448

Closed
rmarting opened this issue Oct 23, 2020 · 4 comments · Fixed by #449
Closed

NodePorts not created when jkube/service.yml is defined #448

rmarting opened this issue Oct 23, 2020 · 4 comments · Fixed by #449
Assignees
Labels
bug Something isn't working
Projects
Milestone

Comments

@rmarting
Copy link

Description

if a jkube/service.yml is defined to declare some extra configuration (e.g: expose other ports) in the service and jkube.enricher.jkube-service.type property is defined as NodePort, then that ports are not created in the final service created.

If that file does not exist then default ports are exposed successfully, but the application does not work because the additional ports are not declared.

Info

  • Eclipse JKube version : kubernetes-maven-plugin:1.0.0
  • Maven version (mvn -v) :
❯ mvn -v
Maven home: /home/rmarting/Software/apache-maven-3.6.3
Java version: 11.0.8, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.8.10-2.fc32.x86_64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.8.15-201.fc32.x86_64", arch: "amd64", family: "unix"
  • Kubernetes / Red Hat OpenShift setup and version :
❯ minikube version
minikube version: v1.14.0
commit: b09ee50ec047410326a85435f4d99026f9c4f5c4
  • If it's a bug, how to reproduce :

1.- Create a service.yml in the jkube folder as:

spec:
  ports:
    - name: http
      port: 8181
      protocol: TCP
      targetPort: 8181

2.- Deploy the application with:

mvn clean package k8s:build k8s:resource k8s:apply

3.- Check that any nodePort was declared:

❯ kubectl get svc <service-name> -o jsonpath='{.spec.ports[].nodePort}'

4.- Remove the service.yml and repeat the deployment as in step 3.
5.- Check that nodePort was declared successfully:

❯ kubectl get svc <service-name> -o jsonpath='{.spec.ports[].nodePort}'
31026

However the ports declared are not the needed for the application:

❯ kubectl get svc kafka-clients-quarkus-sample -o yaml
...
  ports:
  - name: http
    nodePort: 31026
    port: 8080
    protocol: TCP
    targetPort: 8080

Sample GitHub Repository: https://github.com/rmarting/kafka-clients-quarkus-sample/tree/feature/b-g-deployment-strategy

@manusa
Copy link
Member

manusa commented Oct 23, 2020

Probably the property is lost when merging the fragment, we'll check.

@manusa manusa added the bug Something isn't working label Oct 23, 2020
@manusa manusa added this to the 1.0.2 milestone Oct 23, 2020
@manusa
Copy link
Member

manusa commented Oct 23, 2020

As a quick workaround, maybe you can try to redefine your service.yml fragment as:

spec:
  type: ${jkube.enricher.jkube-service.type}
  ports:
    - name: http
      port: 8181
      protocol: TCP
      targetPort: 8181

And provide the default value in your pom.xml properties section. Then you can override the value in the mvn CLI invocation -Djkube.enricher.jkube-service.type=NodePort.

@manusa manusa self-assigned this Oct 23, 2020
@manusa manusa added this to In progress in Sprint #191 Oct 23, 2020
@rmarting
Copy link
Author

@manusa The workaround works perfectly and the service now is created with the NodePorts definitions. Thank you so much.

rmarting added a commit to rmarting/kafka-clients-quarkus-sample that referenced this issue Oct 23, 2020
@manusa
Copy link
Member

manusa commented Oct 23, 2020

🎉 Great to hear!
I'm working on a fix right now for the root-cause, hopefully this will be released on Tuesday, stay tuned ;)

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
No open projects
Sprint #191
  
Done
2 participants