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

feat: pass platform from env variable or fall back to use old logic #1252

Merged
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,8 @@ spec:
fieldPath: metadata.namespace
- name: DEFAULT_MANIFESTS_PATH
value: /opt/manifests
- name: ODH_PLATFORM_TYPE
value: OpenDataHub
image: REPLACE_IMAGE:latest
imagePullPolicy: Always
livenessProbe:
Expand Down
2 changes: 2 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ spec:
fieldPath: metadata.namespace
- name: DEFAULT_MANIFESTS_PATH
value: /opt/manifests
- name: ODH_PLATFORM_TYPE
value: OpenDataHub
args:
- --leader-elect
- --operator-name=opendatahub
Expand Down
21 changes: 14 additions & 7 deletions pkg/cluster/cluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,21 @@ func detectManagedRHODS(ctx context.Context, cli client.Client) (Platform, error
}

func getPlatform(ctx context.Context, cli client.Client) (Platform, error) {
// First check if its addon installation to return 'ManagedRhods, nil'
if platform, err := detectManagedRHODS(ctx, cli); err != nil {
return Unknown, err
} else if platform == ManagedRhods {
switch os.Getenv("ODH_PLATFORM_TYPE") {
case "OpenDataHub", "":
return OpenDataHub, nil
case "ManagedRHOAI":
return ManagedRhods, nil
case "SelfManagedRHOAI":
return SelfManagedRhods, nil
default: // fall back to detect platform if ODH_PLATFORM_TYPE env is not provided
if platform, err := detectManagedRHODS(ctx, cli); err != nil {
return Unknown, err
} else if platform == ManagedRhods {
return ManagedRhods, nil
}
return detectSelfManaged(ctx, cli)
}

// check and return whether ODH or self-managed platform
return detectSelfManaged(ctx, cli)
}

func getRelease(ctx context.Context, cli client.Client) (Release, error) {
Expand All @@ -197,6 +203,7 @@ func getRelease(ctx context.Context, cli client.Client) (Release, error) {
if os.Getenv("CI") == "true" {
return initRelease, nil
}

// Set Version
// Get watchNamespace
operatorNamespace, err := GetOperatorNamespace()
Expand Down