-
Notifications
You must be signed in to change notification settings - Fork 158
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
[RFC] feat: pass platform from env variable and fall back to use old logic #1231
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The patch contains much more changes than in description |
quck note: ideally, env vars should have a domain prefix to avoid any conflict, i.e. ODH_ |
but we are having 2 different env variable in upstream and downstream: ODH_PLATFORM and RHOAI_PLATFORM |
the main change is the "env part" but since it reuses the old function name, then the old function have to get a new name. as for the part of "removing duplicated calls (of old function) and use parameters" it is not stated in the draft's title, only in the description. |
I see the change as you keep API the same and only change implementation under the hood. |
I'd say |
In general, I support passing data to functions explicitly instead of look up from some global state inside. As much as possible. Usually it in addition makes functions more testable. But it is just a different change. |
- introduce new env var ODH_PLATFORM_TYPE - rename old function to DetectPlatform - create new GetPlatform to check env first or fall to call DetectPlatform - move old call cluster.GetPlatform, either pass as parameter or out of subcomponent reconcile Signed-off-by: Wen Zhou <wenzhou@redhat.com>
Can it be splitted into 2 PRs -- passing platform as a parameter, and introducing environment variable? |
can do that. |
close in favor of 2 following PRs |
Description
How Has This Been Tested?
local build: quay.io/wenzhou/opendatahub-operator-catalog:v2.18.913-0 without setting new env == the old way
operator pod: print
{"level":"info","ts":"2024-09-13T11:07:12Z","logger":"setup","msg":"running on","platform":"Open Data Hub"}
by adding in CSV
oprator pod print
{"level":"info","ts":"2024-09-13T11:06:38Z","logger":"setup","msg":"running on","platform":"OpenShift AI Self-Managed"}
Screenshot or short clip
Merge criteria