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/07/04 16:27:48 UTC
[GitHub] [camel-k] astefanutti commented on a diff in pull request #3358: Improve multi operator handling and multi tenancy model
astefanutti commented on code in PR #3358:
URL: https://github.com/apache/camel-k/pull/3358#discussion_r913136518
##########
pkg/cmd/operator/operator.go:
##########
@@ -245,11 +247,43 @@ func Run(healthPort, monitoringPort int32, leaderElection bool, leaderElectionID
installCtx, installCancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer installCancel()
install.OperatorStartupOptionalTools(installCtx, c, watchNamespace, operatorNamespace, log)
+ exitOnError(findOrCreateIntegrationPlatform(installCtx, c, operatorNamespace), "failed to create integration platform")
log.Info("Starting the manager")
exitOnError(mgr.Start(signals.SetupSignalHandler()), "manager exited non-zero")
}
+// findOrCreateIntegrationPlatform create default integration platform in operator namespace if not already exists.
+func findOrCreateIntegrationPlatform(ctx context.Context, c client.Client, operatorNamespace string) error {
Review Comment:
Does the logic that creates the default IntegrationPlatform in the _platform_ trait become redundant?
##########
pkg/trait/platform.go:
##########
@@ -122,14 +130,17 @@ func (t *platformTrait) getOrCreatePlatform(e *Environment) (*v1.IntegrationPlat
}
defaultPlatform.Labels["camel.apache.org/platform.generated"] = True
// Cascade the operator id in charge to reconcile the Integration
- if e.Integration.Annotations != nil && e.Integration.Annotations[v1.OperatorIDAnnotation] != "" {
- if defaultPlatform.Annotations == nil {
- defaultPlatform.Annotations = make(map[string]string)
- }
- defaultPlatform.Annotations[v1.OperatorIDAnnotation] = e.Integration.Annotations[v1.OperatorIDAnnotation]
+ if v1.GetOperatorIDAnnotation(e.Integration) != "" {
+ defaultPlatform.SetOperatorID(v1.GetOperatorIDAnnotation(e.Integration))
}
pl = &defaultPlatform
e.Resources.Add(pl)
+
+ // Make sure that IntegrationPlatform installed in operator namespace can be seen by others
+ if err := install.IntegrationPlatformViewerRole(e.Ctx, t.Client, namespace); err != nil && !k8serrors.IsAlreadyExists(err) {
Review Comment:
Should that be done in `pkg/install/optional.go` where other viewer roles are installed?
--
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