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 2022/06/24 18:29:36 UTC

[GitHub] [camel-k] christophd commented on a diff in pull request #3358: Improve multi operator handling and multi tenancy model

christophd commented on code in PR #3358:
URL: https://github.com/apache/camel-k/pull/3358#discussion_r906302072


##########
pkg/apis/camel/v1/integration_types_support.go:
##########
@@ -255,6 +255,15 @@ func (in *SourceSpec) InferLanguage() Language {
 	return ""
 }
 
+// SetOperatorID sets the given operator id as an annotation
+func (in *Integration) SetOperatorID(operatorID string) {
+	if in.Annotations == nil {
+		in.Annotations = make(map[string]string)
+	}
+
+	in.Annotations[OperatorIDAnnotation] = operatorID
+}
+

Review Comment:
   👍 



##########
pkg/cmd/bind.go:
##########
@@ -217,6 +235,36 @@ func (o *bindCmdOptions) run(cmd *cobra.Command, args []string) error {
 		binding.Spec.Integration.Traits = traits
 	}
 
+	if binding.Annotations == nil {
+		binding.Annotations = make(map[string]string)
+	}
+
+	if o.OperatorID != "" {
+		if pl, err := platformutil.LookupForPlatformName(o.Context, client, o.OperatorID); err != nil {
+			if k8serrors.IsForbidden(err) {
+				o.PrintfVerboseOutf(cmd, "Unable to verify existence of operator id [%s] due to lack of user privileges\n", o.OperatorID)
+			} else {
+				return err
+			}
+		} else if pl == nil {
+			if o.Force {
+				o.PrintfVerboseOutf(cmd, "Unable to find operator with given id [%s] - Kamelet binding may not be reconciled and get stuck in waiting state\n", o.OperatorID)
+			} else {
+				return fmt.Errorf("unable to find integration platform for given operator id '%s', use --force option or make sure to use a proper operator id", o.OperatorID)
+			}
+		}
+	}

Review Comment:
   👍 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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