jkube
jkube copied to clipboard
Disable forced Deployment creation for incomplete image models
Description
I have simple module with only one kubernates Service defined in: ../jkube/simple-service.yaml I'm already exclude most enrichers - so i expect only one object to be generated. Actualy resource goal always generate "Deployment/Deployment Config" object. Generated object is incomplete (because where is no info about container image). So if i run apply goal - exception is thrown. I was trying to add exclusion for enricher responsible for Deployment object generation, but fail to find right name in documentation. May be there is another way to change default behavior, or it's a bug?
Info
- Eclipse JKube version : 1.6.0, 1.5.1, 1.4.0
- Maven version (
mvn -v) : 3.6.8
Did you exclude jkube-controller?
Ecluding jkube-controller - helped in my case. Thank you! But steel - i think that resource generation of "broken" xml config (no image is supplied) should end with exception.
But steel - i think that resource generation of "broken" xml config (no image is supplied) should end with exception.
This one would be hard to tackle, could you provide some reproducer code?
I understand that you end up with a Deployment that has no PodTemplate?
I mean exceptional case - when developer forget to add Image tag. Expected behavior of jkube-controller - is exception at resource goal. Actualy it generates config without any exceptions. And you will get exception from API server if you try to apply generated config.
It would be really helpful to get some reproducer code to see how we can properly tackle this.
My plugin configuration:
<jkube.build.switchToDeployment>true</jkube.build.switchToDeployment>
...
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>openshift-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<namespace>${k8s.namespace}</namespace>
<apiVersion>v1</apiVersion>
<recreate>true</recreate>
<deletePodsOnReplicationControllerUpdate>true</deletePodsOnReplicationControllerUpdate>
<filter>@</filter>
<enricher>
<excludes>
<exclude>jkube-project-label</exclude>
<exclude>jkube-service</exclude>
<exclude>jkube-serviceaccount</exclude>
</excludes>
</enricher>
<mappings>
<mapping>
<kind>Endpoints</kind>
<filenameTypes>endpoints</filenameTypes>
</mapping>
</mappings>
<resources>
<secrets>
<secret>
<name>${k8s.image.pull.secret}</name>
<dockerServerId>${k8s.pull.registry.server.id}</dockerServerId>
</secret>
</secrets>
</resources>
</configuration>
</plugin>
Also i have 2 yaml files in jkube directory:
apiVersion: v1
kind: Service
metadata:
name: kafka-service
spec:
type: ClusterIP
ports:
- name: client
port: 9092
targetPort: @kafka.external.port@
protocol: TCP
apiVersion: v1
kind: Endpoints
metadata:
name: kafka-service
subsets:
- addresses:
- ip: @kafka.external.ip@
ports:
- name: client
port: @kafka.external.port@
If you try to execute resource goal - Deployment object wil be created (no errors), but it will fail on apply phase.
We already seem to have a check to not generate Deployment or any controller when no image configuration is present:
https://github.com/eclipse/jkube/blob/4cef8d361a73f04161699dd149383b70f60de6ca/jkube-kit/enricher/generic/src/main/java/org/eclipse/jkube/enricher/generic/DefaultControllerEnricher.java#L113
I think Some generator is kicking in your case and generating opinionated Image configuration. Could you please try adding an exclusion for the generator which is getting activated in your case?
<generator>
<excludes>
<exclude>java-exec</exclude>
</excludes>
</generator>
@tipame: Polite ping, Did you get time to revisit this issue?
@tipame : polite ping, Would appreciate it if you could provide some feedback regarding this issue? Any reproducer project would help us in investigating whether some generator is kicking in or not.
@tipame : Is this still an issue? Or were you able to resolve it via some other method?
@tipame : is it still an issue ? I am closing this issue, feel free to reopen if needed. Thanks!