jkube
jkube copied to clipboard
jkube-service breaks service resource generation when a provided service.yml already contains a metadata.name
Describe the bug
Since 1.10.0, generating the service resource when a discovered service.yml is provided as base, fails when this resource has metadata.name in it. The error manifests in double creation of service.yml, with different names, and the resulting kubernetes.yml
- If enricher is disabled or enabled with defaults and no metadata.name is manually added to provided jkube/service.yml, it takes artifactId + '-service' for the service (metadata)name
- If enricher is disabled or enabled with defaults and metadata.name is manually added to provided jkube/service.yml, it creates 2 services descriptors/kinds, one for spring.app.name and one for provided service.yaml's metadata.name
- If enricher is enabled and has
<jkube-name><name>
configured and no metadata.name manually added to provided jkube/service.yml, it takes the configured jkube-service name correctly - If enricher is enabled and has
<jkube-name><name>
configured and metadata.name is manually added to providedjkube/service.yml
, it creates 2 services, one with configured<jkube-name><name>
and another one with the same name and a suffix of "-1"
When you need to have different names for service and deployment, different from the artifact, the only solution is disabling jkube-service enricher and provide metadata.name manually for both resources
Eclipse JKube version
1.12.0
Component
Kubernetes Maven Plugin
Apache Maven version
3.6.2
Gradle version
None
Steps to reproduce
Provide a service.yml with metadata.name different than the artifact and generate service.ymls. 2 service yamls are generated, one with metadata.name name and the other with spring.application.name
Expected behavior
Only one service descriptor is created, and IMO, preferably, metadata.name should be honoured before artifactId + '-service' and spring.application.name
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.25.3
Environment
macOS
Eclipse JKube Logs
No response
Sample Reproducer Project
No response
Additional context
No response