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

[Kubernetes-maven-plugin] Disable namespace creation during k8s:resource #570

Closed
Christian-dev-ops opened this issue Feb 8, 2021 · 7 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Christian-dev-ops
Copy link

Description

As Devops developer, I found a feature that I considered that I need to have disabled option. During K8s:resource and specify a namespace in the pom.xml or using the property "jkube.namespace". Because we use K8s:undeploy, jkube delete the namespace and remove all ours previous deployments.

Feature description

I need a property to disabled the namespace creation during k8s:resource. The suggest name "jkube.namespace.creation.disabled"

@manusa
Copy link
Member

manusa commented Feb 8, 2021

This seems more like a bug according to documentation.
The jkube.namespace flag should configure the namespace on which to operate, not create/delete it.

@manusa manusa added the bug Something isn't working label Feb 8, 2021
@manusa
Copy link
Member

manusa commented Feb 8, 2021

It seems that the implementation of fabric8io/fabric8-maven-plugin#1611 reused a configuration flag that was meant for another purpose.

@rohanKanojia
Copy link
Member

How is this related to #520? This behavior seems to be there in v1.0.2 as well:

eclipse-jkube-sample-with-resource-fragments : $ mvn k8s:resource
[INFO] Scanning for projects...
[INFO] 
[INFO] -------< org.eclipse.jkube.quickstarts.maven:external-resources >-------
[INFO] Building Eclipse JKube :: Quickstarts :: Maven :: External Resources 1.1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- kubernetes-maven-plugin:1.0.2:resource (default-cli) @ external-resources ---
[INFO] k8s: Running generator spring-boot
[INFO] k8s: spring-boot: Using Docker image quay.io/jkube/jkube-java-binary-s2i:0.0.8 as base / builder
[INFO] k8s: Using resource templates from /home/rohaan/work/repos/eclipse-jkube-sample-with-resource-fragments/src/main/jkube                                                                                                 
[INFO] k8s: jkube-controller: Adding a default Deployment
[INFO] k8s: jkube-namespace: Adding a default Namespace: rohan-kumar-ns
[INFO] k8s: jkube-healthcheck-spring-boot: Adding readiness probe on port 8080, path='/health', scheme='HTTP', with initial delay 10 seconds
[INFO] k8s: jkube-healthcheck-spring-boot: Adding liveness probe on port 8080, path='/health', scheme='HTTP', with initial delay 180 seconds
[INFO] k8s: jkube-revision-history: Adding revision history limit to 2
[INFO] k8s: validating /home/rohaan/work/repos/eclipse-jkube-sample-with-resource-fragments/target/classes/META-INF/jkube/kubernetes/rohan-kumar-ns-namespace.yml resource
[INFO] k8s: validating /home/rohaan/work/repos/eclipse-jkube-sample-with-resource-fragments/target/classes/META-INF/jkube/kubernetes/ribbon-serviceaccount.yml resource
[INFO] k8s: validating /home/rohaan/work/repos/eclipse-jkube-sample-with-resource-fragments/target/classes/META-INF/jkube/kubernetes/my-headless-service-service.yml resource
[INFO] k8s: validating /home/rohaan/work/repos/eclipse-jkube-sample-with-resource-fragments/target/classes/META-INF/jkube/kubernetes/game-config-env-file-configmap.yml resource
[INFO] k8s: validating /home/rohaan/work/repos/eclipse-jkube-sample-with-resource-fragments/target/classes/META-INF/jkube/kubernetes/external-resources-deployment.yml resource
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.870 s
[INFO] Finished at: 2021-02-08T21:39:57+05:30
[INFO] ------------------------------------------------------------------------
eclipse-jkube-sample-with-resource-fragments : $ ls target/classes/META-INF/jkube/kubernetes/
external-resources-deployment.yml   my-headless-service-service.yml  rohan-kumar-ns-namespace.yml
game-config-env-file-configmap.yml  ribbon-serviceaccount.yml
eclipse-jkube-sample-with-resource-fragments : $

@manusa
Copy link
Member

manusa commented Feb 8, 2021

It relates because that PR deals with Namespace creation and deletion.

Besides, now Namespaces are deleted/undeployed (which didn't happen on 1.0.2).

So if you upgraded your project from 1.0.2 to 1.1.0 and you are using the jkube.namespace configuration flag, now your Namespace will be deleted when running the k8s:undeploy goal which is a very nasty and probably undesired new side-effect.

@rohanKanojia rohanKanojia self-assigned this Feb 10, 2021
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Feb 10, 2021
Now `jkube.namespace` would only append namespace in Kubernetes
resources metadata. Earlier we were creating a new namespace too when
this property was configured.

For creating a new namespace a new property should be used:
`jkube.enricher.jkube-namespace.create-namespace`
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Feb 11, 2021
Now `jkube.namespace` would only append namespace in Kubernetes
resources metadata. Earlier we were creating a new namespace too when
this property was configured.

For creating a new namespace a new property should be used:
`jkube.enricher.jkube-namespace.create-namespace`
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Feb 11, 2021
Now `jkube.namespace` would only append namespace in Kubernetes
resources metadata. Earlier we were creating a new namespace too when
this property was configured.

For creating a new namespace this property should be used:
`jkube.enricher.jkube-namespace.namespace`
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Feb 11, 2021
Now `jkube.namespace` would only append namespace in Kubernetes
resources metadata. Earlier we were creating a new namespace too when
this property was configured.

For creating a new namespace this property should be used:
`jkube.enricher.jkube-namespace.namespace`
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Feb 12, 2021
Now `jkube.namespace` would only append namespace in Kubernetes
resources metadata. Earlier we were creating a new namespace too when
this property was configured.

For creating a new namespace this property should be used:
`jkube.enricher.jkube-namespace.namespace`
@manusa manusa added this to the 1.1.1 milestone Feb 18, 2021
@manusa manusa self-assigned this Feb 18, 2021
rohanKanojia added a commit to rohanKanojia/jkube that referenced this issue Feb 18, 2021
Now `jkube.namespace` would only append namespace in Kubernetes
resources metadata. Earlier we were creating a new namespace too when
this property was configured.

For creating a new namespace this property should be used:
`jkube.enricher.jkube-namespace.namespace`
@manusa
Copy link
Member

manusa commented Feb 18, 2021

As agreed during several meetings and PR reviews behavior should be as follows:

  • A new configuration option is provided in the Namespace Enricher: jkube.enricher.jkube-namespace.namespace
    This option accepts the name of the Namespace to create.
Expected behavior jkube.namespace jkube.enricher.jkube-namespace.namespace
Use default namespace or the one provided in .kube/config to apply resources
Configure namespace in which to operate (Namespace where resources will be applied) X
Create a namespace/project resource, but JKube operates in the default/kubeConfig namespace X
Create a namespace/project resource and operate in the namespace defined in jkube.namespace X X

Cases:

Description jkube.namespace jkube.enricher.jkube-namespace.namespace
Operate in the default namespace
Create a new namespace with name foo foo
Operate in the bar Namespace bar
Create and operate in the foonamespace foo foo
Create a foo namespace and operate in the bar namespace bar foo

manusa pushed a commit to rohanKanojia/jkube that referenced this issue Feb 18, 2021
Now `jkube.namespace` would only append namespace in Kubernetes
resources metadata. Earlier we were creating a new namespace too when
this property was configured.

For creating a new namespace this property should be used:
`jkube.enricher.jkube-namespace.namespace`
@manusa manusa closed this as completed in b486e42 Feb 23, 2021
@manusa manusa reopened this Feb 23, 2021
@manusa
Copy link
Member

manusa commented Feb 24, 2021

Behavior should be fixed in 1.1.1 and improved in upcoming 1.2.0.

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
None yet
Development

Successfully merging a pull request may close this issue.

3 participants