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

✨ [E2E] allow provider specific infra machine template for upgrade tests #6075

Merged

Conversation

aartij17
Copy link
Contributor

@aartij17 aartij17 commented Feb 8, 2022

What this PR does / why we need it:
This PR introduces an option to change the infra template in the test spec during the cluster upgrade tests.

Please refer to this slack conversation for more context
cc: @sbueringer @srm09

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 8, 2022
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 8, 2022
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Overall looks good, thx!

A few nits, mostly around naming.

EtcdVersionUpgradeTo = "ETCD_VERSION_UPGRADE_TO"
CoreDNSVersionUpgradeTo = "COREDNS_VERSION_UPGRADE_TO"
IPFamily = "IP_FAMILY"
KubernetesVersionUpgradeMachineTemplateTo = "KUBERNETES_VERSION_UPGRADE_MACHINE_TEMPLATE_TO"
Copy link
Member

@sbueringer sbueringer Feb 8, 2022

Choose a reason for hiding this comment

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

Suggested change
KubernetesVersionUpgradeMachineTemplateTo = "KUBERNETES_VERSION_UPGRADE_MACHINE_TEMPLATE_TO"
MachineTemplateUpgradeTo = "MACHINE_TEMPLATE_UPGRADE_TO"

nit: I think it reads better in this order / then follows the same pattern as KUBERNETES_VERSION_UPGRADE_TO

Can you also move it directly below KubernetesVersionUpgradeTo?

Copy link
Member

Choose a reason for hiding this comment

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

Ideally I would prefer a common prefix with the other UPGRADE_TO env var, but given that we can't easily change the existing env var I would prefer the one I proposed. But let's see what @fabriziopandini thinks.

(except if we deprecate the old var and introduce a new one...)

Copy link
Member

Choose a reason for hiding this comment

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

+1 to MACHINE_TEMPLATE_UPGRADE_TO
(we strive for a common suffix)

EtcdImageTag: input.E2EConfig.GetVariable(EtcdVersionUpgradeTo),
DNSImageTag: input.E2EConfig.GetVariable(CoreDNSVersionUpgradeTo),
KubernetesUpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
KubernetesVersionUpgradeMachineTemplateTo: k8sVersionUpgradeMachineTemplateTo,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
KubernetesVersionUpgradeMachineTemplateTo: k8sVersionUpgradeMachineTemplateTo,
KubernetesUpgradeMachineTemplate: k8sVersionUpgradeMachineTemplateTo,

ClusterProxy: input.BootstrapClusterProxy,
Cluster: clusterResources.Cluster,
UpgradeVersion: input.E2EConfig.GetVariable(KubernetesVersionUpgradeTo),
KubernetesVersionUpgradeMachineTemplateTo: k8sVersionUpgradeMachineTemplateTo,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
KubernetesVersionUpgradeMachineTemplateTo: k8sVersionUpgradeMachineTemplateTo,
UpgradeMachineTemplate: k8sVersionUpgradeMachineTemplateTo,

@@ -310,7 +311,9 @@ func UpgradeControlPlaneAndWaitForUpgrade(ctx context.Context, input UpgradeCont
Expect(err).ToNot(HaveOccurred())

input.ControlPlane.Spec.Version = input.KubernetesUpgradeVersion

if input.KubernetesVersionUpgradeMachineTemplateTo != nil {
input.ControlPlane.Spec.MachineTemplate.InfrastructureRef.Name = pointer.StringDeref(input.KubernetesVersionUpgradeMachineTemplateTo, "")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
input.ControlPlane.Spec.MachineTemplate.InfrastructureRef.Name = pointer.StringDeref(input.KubernetesVersionUpgradeMachineTemplateTo, "")
input.ControlPlane.Spec.MachineTemplate.InfrastructureRef.Name = *input.KubernetesVersionUpgradeMachineTemplateTo

nit. Should be fine as we already handle the nil one line above

Copy link
Member

Choose a reason for hiding this comment

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

same in UpgradeMachineDeploymentsAndWait

@aartij17 aartij17 force-pushed the add-machinetemplate-flag branch 2 times, most recently from 99ee1f8 to 7e2d4f5 Compare February 8, 2022 17:49
@aartij17 aartij17 requested a review from sbueringer February 8, 2022 17:54
@aartij17 aartij17 force-pushed the add-machinetemplate-flag branch from 7e2d4f5 to 20a0a9a Compare February 8, 2022 17:57
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 8, 2022
@srm09
Copy link
Contributor

srm09 commented Feb 8, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 8, 2022
@fabriziopandini
Copy link
Member

@aartij17 thanks for improving the test framework! All the providers will benefit from this!
/lgtm
waiting for @sbueringer final pass

@sbueringer
Copy link
Member

sbueringer commented Feb 9, 2022

Thank you very much!

Really nice addition, which should enable more providers to be able to use the upgrade e2e test.

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 Feb 9, 2022
@sbueringer
Copy link
Member

@aartij17 @srm09 I would be fine with cherry-picking this into release-1.1 if it makes it easier for you to pick up.

I think we should encourage folks to contribute to the test framework by making it easy to pickup new features/ bug fixes vs. forcing them to wait or use CAPI main.

@k8s-ci-robot k8s-ci-robot merged commit 83af791 into kubernetes-sigs:main Feb 9, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.2 milestone Feb 9, 2022
@sbueringer
Copy link
Member

@aartij17 @srm09 I would be fine with cherry-picking this into release-1.1 if it makes it easier for you to pick up.

I think we should encourage folks to contribute to the test framework by making it easy to pickup new features/ bug fixes vs. forcing them to wait or use CAPI main.

/cc @fabriziopandini WDYT?

@fabriziopandini
Copy link
Member

+1 to backport considering it can help providers and the change is small/well confined
/cherry-pick release-v1.1

@k8s-infra-cherrypick-robot

@fabriziopandini: cannot checkout release-v1.1: error checking out release-v1.1: exit status 1. output: error: pathspec 'release-v1.1' did not match any file(s) known to git

In response to this:

+1 to backport considering it can help providers and the change is small/well confined
/cherry-pick release-v1.1

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.

@fabriziopandini
Copy link
Member

/cherry-pick release-1.1

@k8s-infra-cherrypick-robot

@fabriziopandini: new pull request created: #6083

In response to this:

/cherry-pick release-1.1

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.

@fabriziopandini fabriziopandini changed the title ✨ allow provider specific infra machine template for upgrade tests ✨ [E2E] allow provider specific infra machine template for upgrade tests Feb 9, 2022
@cpanato
Copy link
Member

cpanato commented Feb 13, 2022

this is really useful, thanks for doing that!!
I'm implementing that for capg now

wondering if we should have two variables one for the control-plane and another for the workers

wdyt @fabriziopandini @sbueringer

@sbueringer
Copy link
Member

sbueringer commented Feb 14, 2022

@cpanato
I can imagine there are cases where you want / have to use different machine templates for control plane and workers.
So, sounds reasonable to me.

@aartij17 @srm09 WDYT about replacing the current var through one specifically for cp and one for workers?

@fabriziopandini
Copy link
Member

+1 for me, this is for providers to use!

@cpanato
Copy link
Member

cpanato commented Feb 14, 2022

i can work on that @sbueringer @fabriziopandini

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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants