-
Notifications
You must be signed in to change notification settings - Fork 56
Enhance skuba addon upgrade [plan|apply] #1247
Conversation
Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
executes `skuba addon upgrade plan`, besides display new addon or addon to be upgrade, also try server-side validation to validates the base+patch manifests. Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
perform check local addons manifests before - `skuba addon upgrade plan` - `skuba addon upgrade apply` Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
add a unit test to check local addons base manifests behavior is as expected. Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
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, just one comment to resolve.
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.
Sadly I am not fully familiar with some parts of the code, and I don't have the time to delve deeper this week, so I can't do an in-depth review. At first sight it looks okay. I would add some comments on the rootDir change though.
@@ -340,28 +370,39 @@ func (addon Addon) Write(addonConfiguration AddonConfiguration) error { | |||
// applyPreflight applies the preflight deployment/daemonset manifest if such | |||
// is defined by the addon. It returns a bool whether preflight was defined | |||
// by the addon and an error. | |||
func (addon Addon) applyPreflight(addonConfiguration AddonConfiguration, sandboxDir string) (bool, error) { | |||
func (addon Addon) applyPreflight(addonConfiguration AddonConfiguration, rootDir string, dryRun bool) (bool, error) { |
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.
Why the change in the rootDir?
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.
Just make the naming all the same cross files 😃
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
`skuba addon upgrade plan` will: 1. check local base addon manifest is up-to-date 2. display new addon or addon to be upgraded 3. generates kustomization.yaml inside addons/<addon> 4. executes server-side validation to validates the base+patch manifests `skuba addon upgrade apply` will: 1. check local base addon manifest is up-to-date 2. generates kustomization.yaml inside addons/<addon> 3. applied new addon or addon to be upgraded into the current cluster Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
Why is this PR needed?
The users would use kustomize to overlay the default base addon manifest value.
However, we did not perform a dry-run check before applied to the current Kubernetes cluster, the user provides kustomize patch manifests might have some problem like manifest indentation error.
Therefore, for
skuba addon upgrade plan
, we not only display is there any new addon or existed addon need to be upgraded, moreover, we also perform the Kubernetes server-side validation by runningkubectl apply -k addons/<addon> --dry-run=server
and outputs the stderr to the user if present.Besides, we'll generate
kustomization.yaml
insideaddons/<addon>
to make the user have the ability to runkubectl apply -k addons/<addon>
after addons upgraded because the user might want to add more patches into the cluster and make sure the patches manifests will keep overtime for each addon upgrade.By the way, before actually perform the
skuba addon upgrade [plan|apply]
, we will check the local addons base manifests match to the current Kubernetes cluster version, to make sure it's up-to-date.The command
skuba addon refresh localconfig
is in another PR #1226 to not make a single PR too large.Fixes https://github.com/SUSE/avant-garde/issues/1765
What does this PR do?
skuba addon upgrade [plan|apply]
.kustomization.yaml
insideaddons/<addon>
forskuba addon upgrade [plan|apply]
skuba addon upgrade plan
Anything else a reviewer needs to know?
N/A
Info for QA
This is info for QA so that they can validate this. This is mandatory if this PR fixes a bug.
If this is a new feature, a good description in "What does this PR do" may be enough.
Related info
An updated RFC for this PR.
Status BEFORE applying the patch
kustomization.yaml
won't exist insideaddons/<addon>
.skuba addon upgrade plan
won't do Kubernetes server-side dry-run.Status AFTER applying the patch
skuba addon upgrade [plan|apply]
kustomization.yaml
will exist afterskuba addon upgrade [plan|apply]
skuba addon upgrade plan
will do Kubernetes server-side dry-run.Docs
SUSE/doc-caasp#923
Merge restrictions
(Please do not edit this)
We are in v4-maintenance phase, so we will restrict what can be merged to prevent unexpected surprises: