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

🌱 clusterctl upgrade cert manager before upgrading providers #3364

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR extends clusterctl upgrade in order to manage cert-manager upgrades before upgrading providers

This PR builds on top of #3313, which is not yet merged. In the meantime, please consider the latest commit only

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 17, 2020
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 17, 2020
@vincepri
Copy link
Member

/milestone v0.3.9

@k8s-ci-robot k8s-ci-robot added this to the v0.3.9 milestone Jul 31, 2020
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 6, 2020
@fabriziopandini fabriziopandini force-pushed the clusterctl-upgrade-cert-manager branch from 4d6f723 to 2c1f290 Compare August 7, 2020 14:01
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 7, 2020
@fabriziopandini fabriziopandini force-pushed the clusterctl-upgrade-cert-manager branch 2 times, most recently from 23c76ce to cc648c5 Compare August 7, 2020 18:12
@fabriziopandini fabriziopandini changed the title [WIP] 🌱 clusterctl upgrade cert manager before upgrading providers 🌱 clusterctl upgrade cert manager before upgrading providers Aug 7, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 7, 2020
Copy link
Contributor

@wfernandes wfernandes left a comment

Choose a reason for hiding this comment

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

Tested this out locally and the upgrade works.

A couple of things:

  • I think we should document that now clusterctl upgrade apply will also try upgrading cert-manager?
  • Should we have an entry in the clusterctl upgrade plan to check cert-manager versions as well? This need not be part of this PR.

cmd/clusterctl/client/cluster/cert_manager.go Show resolved Hide resolved
cmd/clusterctl/client/cluster/cert_manager.go Outdated Show resolved Hide resolved
cmd/clusterctl/client/cluster/cert_manager.go Outdated Show resolved Hide resolved
cmd/clusterctl/client/cluster/cert_manager.go Outdated Show resolved Hide resolved
cmd/clusterctl/client/cluster/cert_manager.go Outdated Show resolved Hide resolved
cmd/clusterctl/client/cluster/cert_manager_test.go Outdated Show resolved Hide resolved
case c < 0:
// if version < current, then upgrade
currentVersion = objVersion
needUpgrade = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we break here? Then we may not need the if needUpgrade check below on line 281.
This way we have a consistent pattern that everywhere needUpgrade = true we break.

Copy link
Member Author

Choose a reason for hiding this comment

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

If we break here, we are breaking the switch statement while the goal of the statement on line 281 is to break the for loop

cmd/clusterctl/client/upgrade.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 11, 2020
@fabriziopandini fabriziopandini force-pushed the clusterctl-upgrade-cert-manager branch from ecca906 to 89d13cd Compare August 11, 2020 10:11
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 11, 2020
@fabriziopandini
Copy link
Member Author

@wfernandes thanks for the feedback

Should we have an entry in the clusterctl upgrade plan to check cert-manager versions as well? This need not be part of this PR.

This makes sense

@wfernandes
Copy link
Contributor

We can open a separate issue to track this work.

Should we have an entry in the clusterctl upgrade plan to check cert-manager versions as well? This need not be part of this PR.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 11, 2020
@vincepri
Copy link
Member

Squash commits?

// NOTE: // If the cert-manager.yaml asset is modified, this line **MUST** be updated
// accordingly else future upgrades of the cert-manager component will not
// be possible, as there'll be no record of the version installed.
embeddedCertManagerManifestVersion = "v0.16.0"
Copy link
Member

Choose a reason for hiding this comment

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

We should use v0.16.1 given that it was just released

Copy link
Member Author

Choose a reason for hiding this comment

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

If it is ok for you I will send a separate PR as soon as this one merge

Copy link
Contributor

Choose a reason for hiding this comment

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

I was going to suggest a separate PR because that way we can test out what updating the cert-manager manifest would look like.

Comment on lines +52 to +62
// NOTE: // If the cert-manager.yaml asset is modified, this line **MUST** be updated
// accordingly else future upgrades of the cert-manager component will not
// be possible, as there'll be no record of the version installed.
embeddedCertManagerManifestVersion = "v0.16.0"

// NOTE: The hash is used to ensure that when the cert-manager.yaml file is updated,
// the version number marker here is _also_ updated.
// You can either generate the SHA256 hash of the file, or alternatively
// run `go test` against this package. THe Test_VersionMarkerUpToDate will output
// the expected hash if it does not match the hash here.
embeddedCertManagerManifestHash = "5770f5f01c10a902355b3522b8ce44508ebb6ec88955efde9a443afe5b3969d7"
Copy link
Member

Choose a reason for hiding this comment

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

Should we be hardcoding versions and hashes within the codebase? Can we open an issue to get rid of this or find an alternative that doesn't require code changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was inherited from #3313 and slightly re-worked here.
So far we have a unit test that ensures this value is in sync with the embedded manifest.

But happy to open an issue for another round of improvement

Copy link
Member Author

Choose a reason for hiding this comment

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

@vincepri
Copy link
Member

/assign

@fabriziopandini fabriziopandini force-pushed the clusterctl-upgrade-cert-manager branch from 89d13cd to 6e0e62d Compare August 19, 2020 10:03
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 19, 2020
@fabriziopandini
Copy link
Member Author

squashed commits

@k8s-ci-robot
Copy link
Contributor

@fabriziopandini: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-cluster-api-apidiff 6e0e62d link /test pull-cluster-api-apidiff

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@wfernandes
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 19, 2020
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 19, 2020
@k8s-ci-robot k8s-ci-robot merged commit f8ef3fe into kubernetes-sigs:master Aug 19, 2020
@fabriziopandini fabriziopandini deleted the clusterctl-upgrade-cert-manager branch August 21, 2020 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants