Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #4167 : Default integrationPlatform created at operator startup dose not honor OPERATOR_ID config #4180

Merged
merged 1 commit into from
Mar 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pkg/cmd/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,26 @@ func Run(healthPort, monitoringPort int32, leaderElection bool, leaderElectionID

// findOrCreateIntegrationPlatform create default integration platform in operator namespace if not already exists.
func findOrCreateIntegrationPlatform(ctx context.Context, c client.Client, operatorNamespace string) error {
operatorID := defaults.OperatorID()
var platformName string
if defaults.OperatorID() != "" {
platformName = defaults.OperatorID()
if operatorID != "" {
platformName = operatorID
} else {
platformName = platform.DefaultPlatformName
}

if pl, err := kubernetes.GetIntegrationPlatform(ctx, c, platformName, operatorNamespace); pl == nil || k8serrors.IsNotFound(err) {
defaultPlatform := v1.NewIntegrationPlatform(operatorNamespace, platformName)

if defaultPlatform.Labels == nil {
defaultPlatform.Labels = make(map[string]string)
}
defaultPlatform.Labels["camel.apache.org/platform.generated"] = "true"

if operatorID != "" {
defaultPlatform.SetOperatorID(operatorID)
}

if _, err := c.CamelV1().IntegrationPlatforms(operatorNamespace).Create(ctx, &defaultPlatform, metav1.CreateOptions{}); err != nil {
return err
}
Expand Down