-
Notifications
You must be signed in to change notification settings - Fork 169
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
Move default openshift version #3094
Move default openshift version #3094
Conversation
ad7f1db
to
bae936c
Compare
c140b25
to
b555895
Compare
Please rebase pull request. |
572fef9
to
c024abb
Compare
c024abb
to
965781a
Compare
965781a
to
6c79a24
Compare
@SudoBrendan and @petrkotas had previously approved this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some comments/nits. Thanks!
0c4c212
to
8db2521
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Have the changes been tested in INT yet?
Please rebase pull request. |
The frontend's OpenShiftVersions change feed handler will record the current default version for the rest of the frontend to use.
The RP no longer has this information internally, so the metric is no longer relevant.
Isolating some light refactoring. The purpose will become more clear in the next commit.
Read OpenShift versions and pull specs from an OPENSHIFT_VERSIONS environment variable containing a JSON object. This data includes the default OpenShift version for new installs that don't specify a version. This moves us toward eliminating hard-coded OpenShift versions in pkg/util/version/const.go.
I'm not sure what to do with this test. Install stream data has moved to RP-Config, so if the test is worth keeping then I guess the oldest supported version will have to be hard-coded and kept up-to-date. But it probably won't be.
DefaultInstallStream will remain for now, but it's ONLY for use by local development mode until we can come up with a better solution.
Clarifies their purpose and helps avoid variable name collisions.
8db2521
to
d89b290
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was able to personally test this in INT. Updating the default version in the cosmosDB document for OpenShiftVersions changes the default install version as expected and desired.
// Corresponds to configuration.openShiftVersions in RP-Config | ||
type OpenShiftVersions struct { | ||
DefaultStream map[string]string | ||
InstallStreams map[string]string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems odd to me (someone who is new to the team and GO) that we don't have some large struct to validate the contents of the RP-config already. Do we always just query part of the config piecemeal like this? Wouldn't it be more typical to load the config at start time and then access some object as needed? (Assuming that we don't have any dynamic components to the config). What am I missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main goal of this work was to move the hardcoded configuration of the versioning into the database. Historically this configuration has been hardcoded so there was not a need to call it other than using pkg/util/version/
What you suggest is a good idea but we haven't gotten to a something like a general pkg/util/config
at a team. In time this will probably make sense to consolidate the configuration of the RP in one package. But it was out of scope for this effort. Mainly when this was talked about there was some worry about not knowing what all the configuration was, so we decided to move one by one instead. With the idea that we would consolidate later. This is what I remember anyways.
While I wasn't the main person working on this. Matt has been moved to other priorities at the moment so the rest of Loki team is trying to push this one over the finish line for him.
+1 for a follow up discussion and effort on this for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, ARO.Pipelines has the full struct and parser you're looking for. What's happening in this context is the parser is extracting the OpenShift version bits we need from RP-Config and passing it to the RP as a JSON blob by way of an environment variable. All we're parsing here is the environment variable, not RP-Config directly.
|
||
dstRepo := dstAcr + acrDomainSuffix | ||
ocpVersions := []api.OpenShiftVersion{} | ||
// The DefaultStream map must have exactly one entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small question to help with my understanding of how we do things:
This comment tells me the "What" but not the "Why" and in the past this has been the rule I've used to determine if we need a comment. So:
- Do we need to update this comment to the "Why"?
- Can we just drop the comment overall?
- Do I have this all wrong? (Probably some amount of this ;) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always good to get feedback on this. Basically we have only one default version for install - the latest Y version. Instead of having a default version per Y stream.
@@ -63,6 +63,7 @@ type frontend struct { | |||
dbSubscriptions database.Subscriptions | |||
dbOpenShiftVersions database.OpenShiftVersions | |||
|
|||
defaultOcpVersion string // always enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this comment more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will answer below.
@@ -53,6 +46,11 @@ func (f *frontend) putAdminOpenShiftVersion(w http.ResponseWriter, r *http.Reque | |||
if docs != nil { | |||
for _, doc := range docs.OpenShiftVersionDocuments { | |||
if doc.OpenShiftVersion.Properties.Version == ext.Properties.Version { | |||
// prevent disabling of the default installation version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same commenting point as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is explained by looking at the docs of az aro create
. Basically if you don't supply a version to install it will install this default version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed this back in December but am giving my official green check mark now that it's been tested in INT 🙂
* api: Avoid referencing DefaultInstallStream in tests * frontend: Avoid referencing DefaultInstallStream The frontend's OpenShiftVersions change feed handler will record the current default version for the rest of the frontend to use. * monitor: Remove latestGaMinorVersion metric The RP no longer has this information internally, so the metric is no longer relevant. * update_ocp_versions: Read versions from an environment variable Read OpenShift versions and pull specs from an OPENSHIFT_VERSIONS environment variable containing a JSON object. This data includes the default OpenShift version for new installs that don't specify a version. This moves us toward eliminating hard-coded OpenShift versions in pkg/util/version/const.go. * cache_fallback_discovery_client_test.go: Hard-code version I'm not sure what to do with this test. Install stream data has moved to RP-Config, so if the test is worth keeping then I guess the oldest supported version will have to be hard-coded and kept up-to-date. But it probably won't be. * version: Remove DefaultInstallStreams DefaultInstallStream will remain for now, but it's ONLY for use by local development mode until we can come up with a better solution. --------- Co-authored-by: Matthew Barnes <[email protected]>
* api: Avoid referencing DefaultInstallStream in tests * frontend: Avoid referencing DefaultInstallStream The frontend's OpenShiftVersions change feed handler will record the current default version for the rest of the frontend to use. * monitor: Remove latestGaMinorVersion metric The RP no longer has this information internally, so the metric is no longer relevant. * update_ocp_versions: Read versions from an environment variable Read OpenShift versions and pull specs from an OPENSHIFT_VERSIONS environment variable containing a JSON object. This data includes the default OpenShift version for new installs that don't specify a version. This moves us toward eliminating hard-coded OpenShift versions in pkg/util/version/const.go. * cache_fallback_discovery_client_test.go: Hard-code version I'm not sure what to do with this test. Install stream data has moved to RP-Config, so if the test is worth keeping then I guess the oldest supported version will have to be hard-coded and kept up-to-date. But it probably won't be. * version: Remove DefaultInstallStreams DefaultInstallStream will remain for now, but it's ONLY for use by local development mode until we can come up with a better solution. --------- Co-authored-by: Matthew Barnes <[email protected]>
Which issue this PR addresses:
[ARO-3896] Read default OCP version from CosmosDB
Depends on a couple ADO pull requests:
What this PR does / why we need it:
Make CosmosDB the single source of truth for available OpenShift versions, including the default version. Currently it's a mix: CosmosDB has the available versions but only ARO RP knows the default version.
Local Development Mode
Local development mode has been a subject of discussion within my functional team (Loki). Initially I had planned to implement a small hack to keep local development mode working as is in lieu of an internal default OpenShift version and pullspec. But the team has grander plans for local development mode, so I'm going to defer that issue here and leave the internal default version in place. But it's ONLY to be used for local development mode, not in the frontend or in any production pipelines.
Test plan for issue:
Combination of local development mode and probably deployment to INT to test
aro update-versions
in a pipeline.Is there any documentation that needs to be updated for this PR?
The wiki page Multi-Version OpenShift Installations should direct readers to RP-Config rather than pkg/util/version/const.go for updating install streams.