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

Move default openshift version #3094

Merged
merged 10 commits into from
Jan 18, 2024

Conversation

mbarnes
Copy link
Contributor

@mbarnes mbarnes commented Aug 12, 2023

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.

@mbarnes mbarnes force-pushed the move-default-openshift-version branch from ad7f1db to bae936c Compare August 12, 2023 19:51
@mbarnes mbarnes changed the title Move default openshift version [WIP] Move default openshift version Aug 13, 2023
@mbarnes mbarnes force-pushed the move-default-openshift-version branch 2 times, most recently from c140b25 to b555895 Compare August 17, 2023 15:11
@github-actions github-actions bot added the needs-rebase branch needs a rebase label Aug 17, 2023
@github-actions
Copy link

Please rebase pull request.

@mbarnes mbarnes force-pushed the move-default-openshift-version branch from 572fef9 to c024abb Compare August 17, 2023 16:34
@github-actions github-actions bot removed the needs-rebase branch needs a rebase label Aug 17, 2023
@mbarnes mbarnes force-pushed the move-default-openshift-version branch from c024abb to 965781a Compare August 17, 2023 17:00
@mbarnes mbarnes changed the title [WIP] Move default openshift version Move default openshift version Aug 17, 2023
@mbarnes mbarnes force-pushed the move-default-openshift-version branch from 965781a to 6c79a24 Compare August 17, 2023 18:03
@mbarnes mbarnes marked this pull request as ready for review August 17, 2023 18:04
@mbarnes
Copy link
Contributor Author

mbarnes commented Nov 20, 2023

@SudoBrendan and @petrkotas had previously approved this.

SudoBrendan
SudoBrendan previously approved these changes Nov 20, 2023
Copy link
Collaborator

@SudoBrendan SudoBrendan left a 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!

cmd/aro/update_ocp_versions.go Show resolved Hide resolved
cmd/aro/update_ocp_versions.go Outdated Show resolved Hide resolved
cmd/aro/update_ocp_versions.go Outdated Show resolved Hide resolved
Copy link
Contributor

@kimorris27 kimorris27 left a 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?

@cadenmarchese cadenmarchese removed the next-release To be included in the next RP release rollout label Nov 28, 2023
@github-actions github-actions bot added the needs-rebase branch needs a rebase label Nov 29, 2023
Copy link

Please rebase pull request.

Matthew Barnes added 10 commits December 6, 2023 14:29
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.
@mbarnes mbarnes force-pushed the move-default-openshift-version branch from 8db2521 to d89b290 Compare December 6, 2023 19:40
@github-actions github-actions bot removed the needs-rebase branch needs a rebase label Dec 6, 2023
Copy link
Contributor

@jhoreman jhoreman left a 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.

Comment on lines +25 to +29
// Corresponds to configuration.openShiftVersions in RP-Config
type OpenShiftVersions struct {
DefaultStream map[string]string
InstallStreams map[string]string
}
Copy link
Collaborator

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?

Copy link
Contributor

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.

Copy link
Contributor Author

@mbarnes mbarnes Jan 18, 2024

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.
Copy link
Collaborator

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 ;) )

Copy link
Contributor

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
Copy link
Collaborator

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?

Copy link
Contributor

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
Copy link
Collaborator

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.

Copy link
Contributor

@lranjbar lranjbar Jan 18, 2024

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.

Copy link
Contributor

@lranjbar lranjbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@kimorris27 kimorris27 left a 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 🙂

@SudoBrendan SudoBrendan merged commit 809041f into Azure:master Jan 18, 2024
22 checks passed
@mbarnes mbarnes deleted the move-default-openshift-version branch January 18, 2024 20:27
LiniSusan pushed a commit to LiniSusan/ARO-RP that referenced this pull request Jan 25, 2024
* 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]>
ventifus pushed a commit to ventifus/ARO-RP that referenced this pull request Feb 7, 2024
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants