You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/05/27 03:24:55 UTC

[GitHub] [camel-k] ipolyzos opened a new pull request #1466: #1465 remove crd and clusterrole on uninstall

ipolyzos opened a new pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466


   Fix for #1465. It enables the removal of _**CRD**_ and _**ClusterRole**_ upon _kamel uninstall_.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] ipolyzos commented on a change in pull request #1466: #1465 remove crd and clusterrole on uninstall

Posted by GitBox <gi...@apache.org>.
ipolyzos commented on a change in pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466#discussion_r431702637



##########
File path: pkg/cmd/uninstall.go
##########
@@ -105,7 +107,7 @@ func (o *uninstallCmdOptions) uninstall(cmd *cobra.Command, _ []string) error {
 	}
 
 	uninstallViaOLM := false
-	if o.OlmEnabled {
+	if o.OlmEnabled || o.UninstallAll {

Review comment:
       Good point




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro commented on pull request #1466: #1465 remove crd and clusterrole on uninstall

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466#issuecomment-634578544


   > @nicolaferraro good point indeed, I can work on the proposal of @davsclaus for the _--all_ flag if this is ok?
   
   Yeah, sounds good!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] davsclaus commented on pull request #1466: #1465 remove crd and clusterrole on uninstall

Posted by GitBox <gi...@apache.org>.
davsclaus commented on pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466#issuecomment-634516650


   Good point, maybe add code comments in the source code about this so its easier to remember why the behavior is like this


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] ipolyzos commented on pull request #1466: #1465 remove crd and clusterrole on uninstall

Posted by GitBox <gi...@apache.org>.
ipolyzos commented on pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466#issuecomment-634528623


   @nicolaferraro good point indeed, I can work on the proposal of @davsclaus  for the _--all_ flag if this is ok?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro commented on a change in pull request #1466: #1465 remove crd and clusterrole on uninstall

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on a change in pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466#discussion_r431681858



##########
File path: pkg/cmd/uninstall.go
##########
@@ -105,7 +107,7 @@ func (o *uninstallCmdOptions) uninstall(cmd *cobra.Command, _ []string) error {
 	}
 
 	uninstallViaOLM := false
-	if o.OlmEnabled {
+	if o.OlmEnabled || o.UninstallAll {

Review comment:
       ```suggestion
   	if o.OlmEnabled {
   ```
   
   We should not do olm uninstall e.g. if OLM is not installed in the cluster

##########
File path: pkg/cmd/uninstall_test.go
##########
@@ -64,3 +64,18 @@ func TestUninstallSkipFlags(t *testing.T) {
 	assert.True(t, uninstallCmdOptions.SkipClusterRoles)
 	assert.True(t, uninstallCmdOptions.SkipIntegrationPlatform)
 }
+
+func TestUninstallAllFlag(t *testing.T) {
+	options, cmd := kamelTestPreAddCommandInit()
+
+	uninstallCmdOptions := addTestUninstallCmd(options, cmd)
+
+	kamelTestPostAddCommandInit(t, cmd)
+
+	_, err := test.ExecuteCommand(cmd, "uninstall", "--all")
+	assert.Nil(t, err)
+	assert.True(t, uninstallCmdOptions.SkipCrd)
+	assert.True(t, uninstallCmdOptions.SkipClusterRoles)
+	assert.True(t, uninstallCmdOptions.OlmEnabled)

Review comment:
       ```suggestion
   ```
   
   Unrelated




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] ipolyzos closed pull request #1466: #1465 remove crd and clusterrole on uninstall

Posted by GitBox <gi...@apache.org>.
ipolyzos closed pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro commented on pull request #1466: #1465 remove crd and clusterrole on uninstall

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466#issuecomment-634513928


   Well, I think we should not change this. I've disabled the deletion of global stuff unless explicitly stated.
   
   Think to this scenario:
   
   - User 1 does `kamel install` on namespace `a`
   - User 2 does `kamel install` on namespace `b`
   
   Then at some point:
   - User 2 does `kamel uninstall` on namespace `b`
   
   If we delete the global roles and CRDs on `kamel uninstall`, then User 1 and all other users are also affected. Deleting the CRDs also means deleting all integrations running in the whole cluster...


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] ipolyzos commented on pull request #1466: #1465 remove crd and clusterrole on uninstall

Posted by GitBox <gi...@apache.org>.
ipolyzos commented on pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466#issuecomment-634911258


   The _**"--all"**_ flag to added to uninstall command.
   
   Please see below for the test scenario to verify behaviour:
   ```
   $ kamel install 
   Camel K installed in namespace default 
   $ kubectl get all,pvc,configmap,rolebindings,clusterrolebindings,secrets,sa,roles,clusterroles,crd -l 'app=camel-k'
   NAME                                   READY   STATUS              RESTARTS   AGE
   pod/camel-k-operator-89fb65586-rvdvd   0/1     ContainerCreating   0          2s
   
   NAME                               READY   UP-TO-DATE   AVAILABLE   AGE
   deployment.apps/camel-k-operator   0/1     1            0           2s
   
   NAME                                         DESIRED   CURRENT   READY   AGE
   replicaset.apps/camel-k-operator-89fb65586   1         1         0       2s
   
   NAME                                                                     ROLE                                    AGE
   rolebinding.rbac.authorization.k8s.io/camel-k-operator                   Role/camel-k-operator                   2s
   rolebinding.rbac.authorization.k8s.io/camel-k-operator-events            Role/camel-k-operator-events            2s
   rolebinding.rbac.authorization.k8s.io/camel-k-operator-servicemonitors   Role/camel-k-operator-servicemonitors   2s
   
   NAME                              SECRETS   AGE
   serviceaccount/camel-k-operator   1         2s
   
   NAME                                                              CREATED AT
   role.rbac.authorization.k8s.io/camel-k-operator                   2020-05-27T19:50:43Z
   role.rbac.authorization.k8s.io/camel-k-operator-events            2020-05-27T19:50:43Z
   role.rbac.authorization.k8s.io/camel-k-operator-servicemonitors   2020-05-27T19:50:43Z
   
   NAME                                                 CREATED AT
   clusterrole.rbac.authorization.k8s.io/camel-k:edit   2020-05-27T19:50:43Z
   
   NAME                                                                                  CREATED AT
   customresourcedefinition.apiextensions.k8s.io/builds.camel.apache.org                 2020-05-27T19:50:43Z
   customresourcedefinition.apiextensions.k8s.io/camelcatalogs.camel.apache.org          2020-05-27T19:50:43Z
   customresourcedefinition.apiextensions.k8s.io/integrationkits.camel.apache.org        2020-05-27T19:50:43Z
   customresourcedefinition.apiextensions.k8s.io/integrationplatforms.camel.apache.org   2020-05-27T19:50:43Z
   customresourcedefinition.apiextensions.k8s.io/integrations.camel.apache.org           2020-05-27T19:50:43Z
   $ kamel uninstall --all
   Camel K Integration Platform removed from namespace default
   Camel K Config Maps removed from namespace default
   Camel K Operator removed from namespace default
   Camel K Role Bindings removed from namespace default
   Camel K Roles removed from namespace default
   Camel K Service Accounts removed from namespace default
   Camel K Custom Resource Definitions removed from cluster
   Camel K Cluster Roles removed from cluster
   $ kubectl get all,pvc,configmap,rolebindings,clusterrolebindings,secrets,sa,roles,clusterroles,crd -l 'app=camel-k'                                                                               
   No resources found in default namespace.
   $ kamel install 
   Camel K installed in namespace default 
   $ kamel uninstall                                                                git:(kamel-uninstall-remove-crd-clusterrole↑1|✚2 
   Camel K Integration Platform removed from namespace default
   Camel K Config Maps removed from namespace default
   Camel K Operator removed from namespace default
   Camel K Role Bindings removed from namespace default
   Camel K Roles removed from namespace default
   Camel K Service Accounts removed from namespace default
   $ kubectl get all,pvc,configmap,rolebindings,clusterrolebindings,secrets,sa,roles,clusterroles,crd -l 'app=camel-k'                                                                               
   NAME                                   READY   STATUS        RESTARTS   AGE
   pod/camel-k-operator-89fb65586-zpv8z   0/1     Terminating   0          10s
   
   NAME                                                 CREATED AT
   clusterrole.rbac.authorization.k8s.io/camel-k:edit   2020-05-27T19:59:49Z
   
   NAME                                                                                  CREATED AT
   customresourcedefinition.apiextensions.k8s.io/builds.camel.apache.org                 2020-05-27T19:59:48Z
   customresourcedefinition.apiextensions.k8s.io/camelcatalogs.camel.apache.org          2020-05-27T19:59:48Z
   customresourcedefinition.apiextensions.k8s.io/integrationkits.camel.apache.org        2020-05-27T19:59:48Z
   customresourcedefinition.apiextensions.k8s.io/integrationplatforms.camel.apache.org   2020-05-27T19:59:48Z
   customresourcedefinition.apiextensions.k8s.io/integrations.camel.apache.org           2020-05-27T19:59:48Z
   
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] davsclaus commented on pull request #1466: #1465 remove crd and clusterrole on uninstall

Posted by GitBox <gi...@apache.org>.
davsclaus commented on pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466#issuecomment-634516942


   There could also be a flag to the command for --all to delete those bits as well 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-k] ipolyzos commented on a change in pull request #1466: #1465 remove crd and clusterrole on uninstall

Posted by GitBox <gi...@apache.org>.
ipolyzos commented on a change in pull request #1466:
URL: https://github.com/apache/camel-k/pull/1466#discussion_r431702637



##########
File path: pkg/cmd/uninstall.go
##########
@@ -105,7 +107,7 @@ func (o *uninstallCmdOptions) uninstall(cmd *cobra.Command, _ []string) error {
 	}
 
 	uninstallViaOLM := false
-	if o.OlmEnabled {
+	if o.OlmEnabled || o.UninstallAll {

Review comment:
       Good point!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org