-
Notifications
You must be signed in to change notification settings - Fork 2
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
OS upgrade implementation for single clusters #20
Conversation
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! I got some questions but I'm happy to approve once we discuss them.
func (r *UpgradePlanReconciler) recordCreatedPlan(upgradePlan *lifecyclev1alpha1.UpgradePlan, name, namespace string) { | ||
r.Recorder.Eventf(upgradePlan, corev1.EventTypeNormal, "PlanCreated", "Upgrade plan created: %s/%s", namespace, name) | ||
func (r *UpgradePlanReconciler) createSecret(ctx context.Context, upgradePlan *lifecyclev1alpha1.UpgradePlan, secret *corev1.Secret) error { | ||
if err := r.createObject(ctx, upgradePlan, secret); err != nil { |
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.
This approach is fine and will work but I might look into simplifying it when I have some time.
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.
Sounds good, I did it like this mainly because it was the least invasive method of introducing this in the existing code.
mountPath := filepath.Join("/host", secretPathRelativeToHost) | ||
controlPlanePlan.Spec.Secrets = []upgradecattlev1.SecretSpec{ | ||
{ | ||
Name: secretName, |
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 know it is tempting to just use the constants here but wouldn't it be better if the secret name and script are passed to the function from the outside? Both can be extracted from the secret that we query.
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 moved the secretName
out of the global constants and added it as a parameter to the plan creation function. I cannot do the same for the scriptName
mainly because it is a key of the StringData
map of the secret and I do not have a good way of extracting the key name from the secret.StringData
map. So I decided to leave the scriptName
as a global constant.
a40c924
to
58074e9
Compare
Introduces OS upgrades for clusters consisting of one node. Multi-node cluster OS upgrade will be handled in a different PR.
Tested for:
Migration screenshots:
Before:
After:
os-upgrade.sh.tpl has been refactored and now supports the following functionalities:
transactional-update run
the exit codes are not propagated well, but when we move totransactional-update migration
this functionality will be usefultransactional-update
will not be called again once the OS reboots