This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
CORTX-30147: Simplify upgrade by using selector labels #298
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
After fixing PR #297, I felt that the script was fragile with all the grepping and case statements. Now that all of the CORTX workloads are labeled with common labels, we can use said labels to simplify the querying and setting of images of active workloads.
Also re-ordered some error checking to bail out earlier when possible.
Breaking change
The script now requires certain labels to be set:
app.kubernetes.io/name=<release name>
app.kubernetes.io/component=<component>
where component is server, data, etc.These labels are always applied when installing the Helm chart. So this won't work on previous deployments that are unlabeled. However, the script is already breaking for past releases due to the switch from Deployment to StatefulSet for Data, Server and Client workloads. So this is the best time to make such a change.
Type of change
Applicable issues
How was this tested?
Deployed clusters and ran upgrade. Used both standard and data-only deployment. Also ran when no cluster installed.
Additional information
When you use a selector to set the image,
kubectl
will just silently exit if no label matches. This means we can just loop over all of the components and set image-by-image without regard to their installation state or their workload type, and attempt to set the images. In order to avoid confusion, the output was modified slightly to accommodate this, e.g. it won't say it's updating an RGW image for a data-only deployment.(It looks like there is no union operation for labels using kubectl, they only can reduce the previous set, which means I can't do something like using a single command to set cortx-data image for both client and data workloads. If that capability exists, let me know!)
Before:
After:
Data-only:
No cluster installed:
Checklist
If this change requires newer CORTX or third party image versions:
image
fields in solution.example.yaml have been updated to use the required versions.appVersion
field of the Helm chart has been updated to use the new CORTX version.If this change addresses a CORTX Jira issue:
CORTX-XXXXX:
)