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 d15be30881ed7e140ea685f26c2700f05e418e90 Author: Pasquale Congiusti <[email protected]> AuthorDate: Thu Jun 27 14:25:45 2024 +0200 fix(cmd): remove operator id verification ... which is making impossible to run parallel testing --- pkg/cmd/bind.go | 10 ---------- pkg/cmd/run.go | 19 ++----------------- pkg/cmd/util.go | 16 ---------------- 3 files changed, 2 insertions(+), 43 deletions(-) diff --git a/pkg/cmd/bind.go b/pkg/cmd/bind.go index bd403e69b..d4dd5aa64 100644 --- a/pkg/cmd/bind.go +++ b/pkg/cmd/bind.go @@ -250,16 +250,6 @@ func (o *bindCmdOptions) run(cmd *cobra.Command, args []string) error { binding.Spec.ServiceAccountName = o.ServiceAccount } - if !isOfflineCommand(cmd) && o.OperatorID != "" { - if err := verifyOperatorID(o.Context, client, o.OperatorID); err != nil { - if o.Force { - o.PrintfVerboseErrf(cmd, "%s, use --force option or make sure to use a proper operator id", err.Error()) - } else { - return err - } - } - } - // --operator-id={id} is a syntax sugar for '--annotation camel.apache.org/operator.id={id}' binding.SetOperatorID(strings.TrimSpace(o.OperatorID)) diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go index 0afbb1d19..b9434a461 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -532,10 +532,7 @@ func (o *runCmdOptions) createOrUpdateIntegration(cmd *cobra.Command, c client.C } o.applyLabels(integration) - - if err := o.applyAnnotations(cmd, c, integration); err != nil { - return nil, err - } + o.applyAnnotations(integration) if o.ContainerImage == "" { // Resolve resources @@ -657,21 +654,11 @@ func (o *runCmdOptions) applyLabels(it *v1.Integration) { } } -func (o *runCmdOptions) applyAnnotations(cmd *cobra.Command, c client.Client, it *v1.Integration) error { +func (o *runCmdOptions) applyAnnotations(it *v1.Integration) { if it.Annotations == nil { it.Annotations = make(map[string]string) } - if !isOfflineCommand(cmd) && o.OperatorID != "" { - if err := verifyOperatorID(o.Context, c, o.OperatorID); err != nil { - if o.Force { - o.PrintfVerboseErrf(cmd, "%s, use --force option or make sure to use a proper operator id", err.Error()) - } else { - return err - } - } - } - // --operator-id={id} is a syntax sugar for '--annotation camel.apache.org/operator.id={id}' it.SetOperatorID(strings.TrimSpace(o.OperatorID)) @@ -692,8 +679,6 @@ func (o *runCmdOptions) applyAnnotations(cmd *cobra.Command, c client.Client, it it.Annotations[parts[0]] = parts[1] } } - - return nil } func (o *runCmdOptions) resolveSources(cmd *cobra.Command, sources []string, it *v1.Integration) error { diff --git a/pkg/cmd/util.go b/pkg/cmd/util.go index 1ecdcf35e..9afc86c1e 100644 --- a/pkg/cmd/util.go +++ b/pkg/cmd/util.go @@ -30,13 +30,11 @@ import ( v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" "github.com/apache/camel-k/v2/pkg/client" - platformutil "github.com/apache/camel-k/v2/pkg/platform" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" p "github.com/gertd/go-pluralize" - k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -238,17 +236,3 @@ func fieldByMapstructureTagName(target reflect.Value, tagName string) (reflect.S return reflect.StructField{}, false } - -func verifyOperatorID(ctx context.Context, client client.Client, operatorID string) error { - if pl, err := platformutil.LookupForPlatformName(ctx, client, operatorID); err != nil { - if k8serrors.IsForbidden(err) { - return nil - } - - return err - } else if pl == nil { - return fmt.Errorf("unable to find operator with given id [%s] - resource may not be reconciled and get stuck in waiting state", operatorID) - } - - return nil -}
