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

CASMTRIAGE-7294 upgrade cert-manager in prerequisites.sh if cray-drydock is not on the correct version #5379

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

leliasen-hpe
Copy link
Contributor

@leliasen-hpe leliasen-hpe commented Sep 17, 2024

Description

In CSM 1.6, the latest cray-drydock version is 2.18.4. In that version, cray-drydock creates the cert-manager namespace. If the system has already been upgraded to an early version on CSM 1.6, then cert-manager has likely been upgraded and cray-drydock has not. The cray-drydock chart fails to upgrade when cert-manager is installed. This PR adds logic in the case of a CSM 1.6 to CSM 1.6 upgrade. It allows cray-drydock to be upgraded by uninstalling cert-manager, then upgrading drydock, then reinstalling cert-manager. Again, this is only used on a CSM 1.6 to CSM 1.6 upgrade.

Checklist

  • If I added any command snippets, the steps they belong to follow the prompt conventions (see example).
  • If I added a new directory, I also updated .github/CODEOWNERS with the corresponding team in Cray-HPE.
  • My commits or Pull-Request Title contain my JIRA information, or I do not have a JIRA.

Copy link

@dborman-hpe dborman-hpe left a comment

Choose a reason for hiding this comment

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

LGTM

@leliasen-hpe
Copy link
Contributor Author

I tested the latest version of this block on gamora and observed that it worked properly. Here is a section of the output when run with 'set -x'

+ '[' 0 -eq 0 ']'
++ helm get metadata -n loftsman cray-drydock -o json
++ jq -r .version
+ drydock_vers=2.18.2
+ major=2
+ minor=18
+ patch=4
+ drydock_major=2
+ drydock_minor_patch=18.2
+ drydock_patch=2
+ drydock_minor=18
+ '[' 2 -lt 2 ']'
+ '[' 2 -eq 2 ']'
+ '[' 18 -lt 18 ']'
+ '[' 2 -eq 2 ']'
+ '[' 18 -eq 18 ']'
+ '[' 2 -lt 4 ']'
+ needs_upgrade=1
+ '[' 1 -ne 0 ']'
+ echo 'cray-drydock version [2.18.2] less than 2.18.4 and needs to be upgraded.'
cray-drydock version [2.18.2] less than 2.18.4 and needs to be upgraded.
+ echo 'Cray-drydock will be upgraded and the cert-manager namespace will be redeployed.'
Cray-drydock will be upgraded and the cert-manager namespace will be redeployed.

@leliasen-hpe
Copy link
Contributor Author

leliasen-hpe commented Sep 24, 2024

In early CSM 1.6 versions, helm is an earlier version and does not have the metadata -o json option. In the case where this is run on an early CSM 1.6 system, this is the output. It still functions correctly.

++ helm get metadata -n loftsman cray-drydock -o json
++ jq -r .version
Error: unknown shorthand flag: 'o' in -o
+ drydock_vers=
+ major=2
+ minor=18
+ patch=4
+ drydock_major=
+ drydock_minor_patch=
+ drydock_patch=
+ drydock_minor=
+ '[' -lt 2 ']'
./upgrade_drydock.sh: line 48: [: -lt: unary operator expected
+ '[' -eq 2 ']'
./upgrade_drydock.sh: line 50: [: -eq: unary operator expected
+ '[' -eq 2 ']'
./upgrade_drydock.sh: line 52: [: -eq: unary operator expected
+ [[ '' == '' ]]
+ needs_upgrade=1
+ '[' 1 -ne 0 ']'
+ echo 'cray-drydock version [] less than 2.18.4 and needs to be upgraded.'
cray-drydock version [] less than 2.18.4 and needs to be upgraded.
+ echo 'Cray-drydock will be upgraded and the cert-manager namespace will be redeployed.'
Cray-drydock will be upgraded and the cert-manager namespace will be redeployed.

@rustydb rustydb merged commit ef5f450 into release/1.6 Sep 24, 2024
7 of 8 checks passed
@rustydb rustydb deleted the CASMTRIAGE-7294 branch September 24, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants