You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/04/13 13:08:45 UTC

[camel-k] branch main updated (d5980c343 -> dc7f25051)

This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


    from d5980c343 fix(ctrl): use builtin command kill
     new fdd30a6e7 fix(cmd): uninstall kube-public rolebindings
     new dc7f25051 chore(ctrl): lint suggestions

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pkg/cmd/uninstall.go    | 24 ++++++++++++++++++++++++
 pkg/install/operator.go |  2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)


[camel-k] 02/02: chore(ctrl): lint suggestions

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit dc7f25051315966c9cd78f5ae4998af48dba132e
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Apr 13 13:27:21 2023 +0200

    chore(ctrl): lint suggestions
---
 pkg/cmd/uninstall.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkg/cmd/uninstall.go b/pkg/cmd/uninstall.go
index 6579da4a0..f7bf20e5d 100644
--- a/pkg/cmd/uninstall.go
+++ b/pkg/cmd/uninstall.go
@@ -241,7 +241,7 @@ func (o *uninstallCmdOptions) uninstallNamespaceRoles(ctx context.Context, cmd *
 		fmt.Fprintln(cmd.OutOrStdout(), "Camel K Role Bindings removed from namespace", o.Namespace)
 
 		KEP1755Namespace := "kube-public"
-		if err := o.uninstallKEP_1755RoleBindings(ctx, c, KEP1755Namespace); err != nil {
+		if err := o.uninstallKEP1755RoleBindings(ctx, c, KEP1755Namespace); err != nil {
 			return err
 		}
 		fmt.Fprintln(cmd.OutOrStdout(), "Camel K Role Bindings removed from namespace", KEP1755Namespace)
@@ -353,7 +353,7 @@ func (o *uninstallCmdOptions) uninstallRoleBindings(ctx context.Context, c clien
 	return nil
 }
 
-func (o *uninstallCmdOptions) uninstallKEP_1755RoleBindings(ctx context.Context, c client.Client, namespace string) error {
+func (o *uninstallCmdOptions) uninstallKEP1755RoleBindings(ctx context.Context, c client.Client, namespace string) error {
 	api := c.RbacV1()
 
 	roleBindings, err := api.RoleBindings(namespace).List(ctx, defaultListOptions)


[camel-k] 01/02: fix(cmd): uninstall kube-public rolebindings

Posted by pc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit fdd30a6e742fb0744e87002fb6e36a4fe793ddfe
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Apr 13 12:53:31 2023 +0200

    fix(cmd): uninstall kube-public rolebindings
    
    Closes #3829
---
 pkg/cmd/uninstall.go    | 24 ++++++++++++++++++++++++
 pkg/install/operator.go |  2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/pkg/cmd/uninstall.go b/pkg/cmd/uninstall.go
index 56157b9d7..6579da4a0 100644
--- a/pkg/cmd/uninstall.go
+++ b/pkg/cmd/uninstall.go
@@ -239,6 +239,12 @@ func (o *uninstallCmdOptions) uninstallNamespaceRoles(ctx context.Context, cmd *
 			return err
 		}
 		fmt.Fprintln(cmd.OutOrStdout(), "Camel K Role Bindings removed from namespace", o.Namespace)
+
+		KEP1755Namespace := "kube-public"
+		if err := o.uninstallKEP_1755RoleBindings(ctx, c, KEP1755Namespace); err != nil {
+			return err
+		}
+		fmt.Fprintln(cmd.OutOrStdout(), "Camel K Role Bindings removed from namespace", KEP1755Namespace)
 	}
 
 	if !o.SkipRoles {
@@ -347,6 +353,24 @@ func (o *uninstallCmdOptions) uninstallRoleBindings(ctx context.Context, c clien
 	return nil
 }
 
+func (o *uninstallCmdOptions) uninstallKEP_1755RoleBindings(ctx context.Context, c client.Client, namespace string) error {
+	api := c.RbacV1()
+
+	roleBindings, err := api.RoleBindings(namespace).List(ctx, defaultListOptions)
+	if err != nil {
+		return err
+	}
+
+	for _, roleBinding := range roleBindings.Items {
+		err := api.RoleBindings(namespace).Delete(ctx, roleBinding.Name, metav1.DeleteOptions{})
+		if err != nil {
+			return err
+		}
+	}
+
+	return nil
+}
+
 func (o *uninstallCmdOptions) uninstallClusterRoles(ctx context.Context, c client.Client) error {
 	api := c.RbacV1()
 
diff --git a/pkg/install/operator.go b/pkg/install/operator.go
index 9f8c10d9c..14f99fa0a 100644
--- a/pkg/install/operator.go
+++ b/pkg/install/operator.go
@@ -345,7 +345,7 @@ func OperatorOrCollect(ctx context.Context, cmd *cobra.Command, c client.Client,
 	}
 
 	if err = installNamespacedRoleBinding(ctx, c, collection, cfg.Namespace, "/rbac/operator-role-binding-local-registry.yaml"); err != nil {
-		fmt.Fprintln(cmd.ErrOrStderr(), "Warning: the operator won't be able to detect a local image registry via KEP-1755")
+		fmt.Fprintf(cmd.ErrOrStderr(), "Warning: the operator may not be able to detect a local image registry (%s)\n", err.Error())
 	}
 
 	if cfg.Monitoring.Enabled {