Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Enhance skuba addon upgrade [plan|apply] #1247

Merged
merged 5 commits into from
Jul 23, 2020
Merged

Enhance skuba addon upgrade [plan|apply] #1247

merged 5 commits into from
Jul 23, 2020

Conversation

jenting
Copy link

@jenting jenting commented Jul 10, 2020

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 running kubectl apply -k addons/<addon> --dry-run=server and outputs the stderr to the user if present.

Besides, we'll generate kustomization.yaml inside addons/<addon> to make the user have the ability to run kubectl 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?

  1. Perform local addon base manifests check for skuba addon upgrade [plan|apply].
  2. Generates kustomization.yaml inside addons/<addon> for skuba addon upgrade [plan|apply]
  3. Perform Kubernetes server-side dry-run validation for 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

  1. The kustomization.yaml won't exist inside addons/<addon>.
  2. The skuba addon upgrade plan won't do Kubernetes server-side dry-run.

Status AFTER applying the patch

  1. It'll check the local addons base manifests is up-to-date for skuba addon upgrade [plan|apply]
  2. The kustomization.yaml will exist after skuba addon upgrade [plan|apply]
  3. The 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:

What can be merged (merge criteria):
    2 approvals:
        1 developer: code is fine
        1 QA: QA is fine
    there is a PR for updating documentation (or a statement that this is not needed)

@jenting jenting self-assigned this Jul 10, 2020
@jenting jenting marked this pull request as draft July 10, 2020 06:11
JenTing Hsiao added 5 commits July 13, 2020 10:52
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>
run `skuba addon refresh localconfig` before `addon upgrade apply`

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
@jenting jenting marked this pull request as ready for review July 13, 2020 04:58
@jenting jenting added 5.0.0 enhancement New feature or request v5 and removed 5.0.0 labels Jul 13, 2020
Copy link
Contributor

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

Copy link
Contributor

@evrardjp evrardjp left a 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) {
Copy link
Contributor

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?

Copy link
Author

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 😃

Copy link

@maximenoel8 maximenoel8 left a comment

Choose a reason for hiding this comment

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

LGTM

@jenting jenting merged commit fd8d7ed into SUSE:master Jul 23, 2020
@jenting jenting deleted the skuba-addon-upgrade-plan branch July 23, 2020 03:09
Itxaka pushed a commit to Itxaka/skuba that referenced this pull request Aug 4, 2020
`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>
@jenting jenting added the 5.0.x label Sep 21, 2020
jenting pushed a commit that referenced this pull request Oct 27, 2020
* Renew admin.conf when node upgrade (bsc#1176903) (#1403)
* New command: skuba addon refresh localconfig (bsc#1173055) (#1226)
* Enhance skuba addon upgrade [plan|apply] (#1247)

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
5.0.x enhancement New feature or request v5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants