-
Notifications
You must be signed in to change notification settings - Fork 715
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
kubeadm: enable join dryrun e2e tests #3116
Conversation
/hold for review |
/lgtm |
/lgtm |
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 had this PR planned but i could not get to it. so thanks for sending it.
i think we should do the following:
rename init-dry -> dry-run-without-cluster
perform the required_version check there
if versions is 1.32, run all these before a cluster is created:
- init dry run
- join control plane dry run
- join worker (too maybe?)
- upgrade apply dry run
- upgrade node dry run
- reset dry run
then continue testing the commands after the init node was created as it is now.
@@ -60,6 +60,22 @@ tasks: | |||
docker exec {{ .vars.clusterName }}-control-plane-1 kubeadm init --ignore-preflight-errors={{ .vars.kubeadmIgnorePreflightErrors }} --kubernetes-version={{ .vars.kubernetesVersion }} --dry-run=true --v={{ .vars.kubeadmVerbosity }} || exit 1 | |||
docker exec {{ .vars.clusterName }}-control-plane-1 kubeadm init --ignore-preflight-errors={{ .vars.kubeadmIgnorePreflightErrors }} --kubernetes-version={{ .vars.kubernetesVersion }} --upload-certs=true --dry-run=true --v={{ .vars.kubeadmVerbosity }} || exit 1 |
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 think the upload certs is no longer required? (or we can only call this variant)
required_version="1.32" # join dry-run without real control plane is available since v1.32 | ||
current_version=$(echo "{{ .vars.kubernetesVersion }}" | grep -oP '\d+\.\d+') | ||
if awk "BEGIN {exit !($current_version < $required_version)}"; then | ||
echo "Join dry-run without real control plane is not available for Kubernetes version {{ .vars.kubernetesVersion }}. Skipping." | ||
exit 0 | ||
fi |
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 like this check. it avoids us having to write updates to the kinder config (new params) or adding more workflow files.
8994f1a
to
40b5550
Compare
40b5550
to
c6c1db0
Compare
kubeadm upgrade dryrun without cluster is still not supported yet. # kubeadm upgrade apply -f v1.32.0-alpha.3.47+daef8c2419a638 --ignore-preflight-errors=Swap,SystemVerification,FileContent--proc-sys-net-bridge-bridge-nf-call-iptables --allow-release-candidate-upgrades=true --allow-experimental-upgrades=true --dry-run --v=6
open /etc/kubernetes/admin.conf: no such file or directory
failed to load kubeconfig
k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient.(*DryRun).WithKubeConfigFile
k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient/dryrun.go:79
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade.getClient
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade/common.go:195
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade.newApplyData
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade/apply.go:226
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade.newCmdApply.func2
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade/apply.go:146
k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow.(*Runner).InitData
k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow/runner.go:185
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade.newCmdApply.func1
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade/apply.go:99
github.com/spf13/cobra.(*Command).execute
github.com/spf13/[email protected]/command.go:985
github.com/spf13/cobra.(*Command).ExecuteC
github.com/spf13/[email protected]/command.go:1117
github.com/spf13/cobra.(*Command).Execute
github.com/spf13/[email protected]/command.go:1041
k8s.io/kubernetes/cmd/kubeadm/app.Run
k8s.io/kubernetes/cmd/kubeadm/app/kubeadm.go:47
main.main
k8s.io/kubernetes/cmd/kubeadm/kubeadm.go:25
runtime.main
runtime/proc.go:272
runtime.goexit
runtime/asm_amd64.s:1700
couldn't create a Kubernetes client from file "/etc/kubernetes/admin.conf"
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade.newApplyData
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade/apply.go:228
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade.newCmdApply.func2
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade/apply.go:146
k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow.(*Runner).InitData
k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow/runner.go:185
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade.newCmdApply.func1
k8s.io/kubernetes/cmd/kubeadm/app/cmd/upgrade/apply.go:99
github.com/spf13/cobra.(*Command).execute
github.com/spf13/[email protected]/command.go:985
github.com/spf13/cobra.(*Command).ExecuteC
github.com/spf13/[email protected]/command.go:1117
github.com/spf13/cobra.(*Command).Execute
github.com/spf13/[email protected]/command.go:1041
k8s.io/kubernetes/cmd/kubeadm/app.Run
k8s.io/kubernetes/cmd/kubeadm/app/kubeadm.go:47
main.main
k8s.io/kubernetes/cmd/kubeadm/kubeadm.go:25
runtime.main
runtime/proc.go:272
runtime.goexit
runtime/asm_amd64.s:1700 |
ed957ec
to
b6fd229
Compare
i think it used to work. perhaps we broke it with upgrade apply phases. |
no, seems like upgrade does need the admin.conf but i can try to make it work without it. |
|
this is ready for more review, I think we can merge it now. |
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, two minor nits.
set -x | ||
required_version="1.32" # dryrun without cluster is available since v1.32 | ||
current_version=$(echo "{{ .vars.kubernetesVersion }}" | grep -oP 'v\K\d+\.\d+') | ||
if awk "BEGIN {exit !($current_version < $required_version)}"; then |
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 think this would work too
if awk "BEGIN {exit !($current_version < $required_version)}"; then | |
if [ "$current_version" \< "$required_version" ]; then |
tested in a local bash.
#!/bin/bash
required_version="1.32"
current_version=$(echo "v1.34.0" | grep -oP 'v\K\d+\.\d+')
if [ "$current_version" \< "$required_version" ]; then
echo "less"
else
echo "supported"
fi
echo "Full dryrun support without cluster is not available for Kubernetes version {{ .vars.kubernetesVersion }}, only init-dryrun will be executed for this task." | ||
docker exec {{ .vars.clusterName }}-control-plane-1 bash -c "until crictl ps &> /dev/null; do echo 'Waiting for the container runtime to be running ...'; sleep 1; done" | ||
docker exec {{ .vars.clusterName }}-control-plane-1 kubeadm init --ignore-preflight-errors={{ .vars.kubeadmIgnorePreflightErrors }} --kubernetes-version={{ .vars.kubernetesVersion }} --dry-run --v={{ .vars.kubeadmVerbosity }} || exit 1 | ||
else |
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.
else | |
exit 0 | |
fi | |
just so that we don't indent the else part.
also added one extra line after the fi.
b6fd229
to
1d8547f
Compare
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
/apporove
thanks @SataQiu
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: carlory, neolit123, pacoxu, SataQiu 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 |
/hold cancel Let's see if it works |
kubeadm: enable join dryrun e2e tests without a real control plane
Ref: #2653