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

Decouple kubespray-defaults from download #10626

Conversation

VannTen
Copy link
Contributor

@VannTen VannTen commented Nov 17, 2023

What type of PR is this?
/kind cleanup

What this PR does / why we need it:

This moves all defaults variable contained into the download role into kubespray-defaults, thus avoiding the need for the
kubespray-defaults role to add a dependency on dowload only to load variable (and doing a lot of nothing as described in the linked issue).

I tested this on a 3-master 3-etcd 9-nodes cluster, where it takes around 5 minutes less (this is not the exact same patch, because my cluster is in 1.25)
This was running upgrade-cluster.yml, with no real changes (the cluster was already at the target version).

With the patch
vendredi 17 novembre 2023  10:18:04 +0100 (0:00:00.405)       0:52:34.727 ***** 
=============================================================================== 
bootstrap-os : Install libselinux python package ----------------------- 53.40s
etcd : Gen_certs | Write etcd member/admin and kube_control_plane clinet certs to other etcd nodes -- 20.02s
bootstrap-os : Enable RHEL 8 repos ------------------------------------- 15.10s
kubernetes-apps/ansible : Kubernetes Apps | Start Resources ------------ 10.79s
kubernetes-apps/ansible : Kubernetes Apps | Lay Down CoreDNS templates -- 10.64s
kubernetes/control-plane : kubeadm | Upgrade other masters ------------- 10.61s
kubernetes/control-plane : kubeadm | Upgrade other masters ------------- 10.56s
kubernetes/control-plane : kubeadm | Upgrade first master -------------- 10.50s
kubernetes/preinstall : Install packages requirements ------------------- 8.51s
container-engine/runc : runc | Uninstall runc package managed by package manager --- 7.72s
kubernetes/preinstall : Ensure kube-bench parameters are set ------------ 7.52s
container-engine/containerd : containerd | Remove any package manager controlled containerd package --- 7.39s
kubernetes/preinstall : Create kubernetes directories ------------------- 7.19s
container-engine/runc : runc | Uninstall runc package managed by package manager --- 6.75s
container-engine/containerd : containerd | Remove any package manager controlled containerd package --- 6.65s
container-engine/containerd : containerd | Remove any package manager controlled containerd package --- 6.50s
container-engine/runc : runc | Uninstall runc package managed by package manager --- 6.48s
network_plugin/calico : Calico | Create calico manifests ---------------- 6.40s
network_plugin/calico : Calico | Create calico manifests ---------------- 6.24s
bootstrap-os : Check RHEL subscription-manager status ------------------- 5.78s
Without the patch
vendredi 17 novembre 2023  11:17:27 +0100 (0:00:00.354)       0:57:04.881 ***** 
=============================================================================== 
etcd : Gen_certs | Write etcd member/admin and kube_control_plane clinet certs to other etcd nodes -- 20.47s
bootstrap-os : Enable RHEL 8 repos ------------------------------------- 14.92s
bootstrap-os : Install libselinux python package ----------------------- 13.18s
kubernetes-apps/ansible : Kubernetes Apps | Start Resources ------------ 11.35s
kubernetes/control-plane : kubeadm | Upgrade first master -------------- 10.58s
kubernetes/control-plane : kubeadm | Upgrade other masters ------------- 10.55s
kubernetes/control-plane : kubeadm | Upgrade other masters ------------- 10.54s
kubernetes-apps/ansible : Kubernetes Apps | Lay Down CoreDNS templates -- 10.47s
kubernetes/preinstall : Install packages requirements ------------------- 8.18s
kubernetes/preinstall : Ensure kube-bench parameters are set ------------ 7.71s
container-engine/runc : runc | Uninstall runc package managed by package manager --- 7.25s
container-engine/containerd : containerd | Remove any package manager controlled containerd package --- 7.06s
container-engine/runc : runc | Uninstall runc package managed by package manager --- 6.85s
container-engine/containerd : containerd | Remove any package manager controlled containerd package --- 6.60s
network_plugin/calico : Calico | Create calico manifests ---------------- 6.56s
container-engine/runc : runc | Uninstall runc package managed by package manager --- 6.53s
kubernetes/preinstall : Create kubernetes directories ------------------- 6.42s
container-engine/containerd : containerd | Remove any package manager controlled containerd package --- 6.35s
network_plugin/calico : Calico | Create calico manifests ---------------- 6.34s
etcd : Gen_certs | Gather etcd member/admin and kube_control_plane clinet certs from first etcd node --- 5.70s

Which issue(s) this PR fixes:

Fixes #9279

Special notes for your reviewer:

There is a lot of potential further cleanup, but I tried to keep this simple.
In particular:

  • moving back vars which are only used in the download role itself into its defaults
  • moving role-specific vars defined in download.yml into their respective roles (and refactor download to make that work).

Does this PR introduce a user-facing change?:

Decouple kubespray-defaults from download

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Nov 17, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 17, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @VannTen. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 17, 2023
@yankay
Copy link
Member

yankay commented Nov 21, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 21, 2023
Copy link
Member

@MrFreezeex MrFreezeex left a comment

Choose a reason for hiding this comment

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

Wow, thank you for the improvement! Indeed there are most likely a good amount of performance improvement we could do in kubespray.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 21, 2023
@VannTen VannTen force-pushed the feat/decouple_defaults_from_download branch from 8ff0dc1 to 0a84de9 Compare November 23, 2023 09:00
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 23, 2023
@VannTen
Copy link
Contributor Author

VannTen commented Nov 23, 2023

Rebased to re-trigger the CI, sorry for the noise @MrFreezeex

@MrFreezeex
Copy link
Member

No worries!
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 23, 2023
@VannTen VannTen force-pushed the feat/decouple_defaults_from_download branch from 0a84de9 to bc4e5ea Compare November 24, 2023 16:24
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 24, 2023
@VannTen
Copy link
Contributor Author

VannTen commented Nov 24, 2023

I guess git is better at resolving conflicts than tide, because I had no merge conflicts while rebasing ^^.

@VannTen
Copy link
Contributor Author

VannTen commented Nov 27, 2023

@floryut @yankay wdyt ? To me it seems like a pretty low-hanging fruit for speeding up the playbooks

@MrFreezeex
Copy link
Member

(adding back my lgtm after the rebase)
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 27, 2023
@VannTen
Copy link
Contributor Author

VannTen commented Nov 27, 2023

/assign @floryut

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 28, 2023
@VannTen VannTen force-pushed the feat/decouple_defaults_from_download branch from bc4e5ea to 46515b0 Compare November 29, 2023 09:39
@VannTen VannTen force-pushed the feat/decouple_defaults_from_download branch 2 times, most recently from c28b7d3 to 86a83b2 Compare November 30, 2023 15:42
@VannTen
Copy link
Contributor Author

VannTen commented Nov 30, 2023

/assign @liupeng0518
I've seen your reactions, care to approve on this ?
@MrFreezeex If you don't mind, would need another lgtm.

This ones is pretty "rebase annoying" even though git can solve the presumed conflicts with no problem...
(Hopefully the CI holds 🤞 )

@liupeng0518
Copy link
Member

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 1, 2023
@VannTen VannTen force-pushed the feat/decouple_defaults_from_download branch 2 times, most recently from e7fca2e to 4a138ba Compare December 5, 2023 16:09
@VannTen VannTen requested a review from MrFreezeex December 5, 2023 16:12
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 5, 2023
@VannTen VannTen force-pushed the feat/decouple_defaults_from_download branch from 4a138ba to 7ef4a90 Compare December 5, 2023 21: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 Dec 5, 2023
@VannTen VannTen force-pushed the feat/decouple_defaults_from_download branch from 7ef4a90 to 308ea0e Compare December 5, 2023 21:53
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 6, 2023
@VannTen VannTen force-pushed the feat/decouple_defaults_from_download branch from 308ea0e to f53e02b Compare December 6, 2023 13:45
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 6, 2023
@MrFreezeex
Copy link
Member

MrFreezeex commented Dec 7, 2023

Hmmm I think the CI failure might be legit 🤔

EDIT: Just saw the linked issue about this failure 👍

Avoids doing re-importing the download role on every invocation of
kubespray-defaults (and skipping everything).

This has a measurable effect on playbook performance.
@VannTen VannTen force-pushed the feat/decouple_defaults_from_download branch from f53e02b to 987268c Compare December 11, 2023 12:31
@VannTen
Copy link
Contributor Author

VannTen commented Dec 11, 2023

@MrFreezeex looks like CI will finally pass on this, can you review ? (Pretty please 🙏 )

Copy link
Member

@MrFreezeex MrFreezeex left a comment

Choose a reason for hiding this comment

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

Sure, thanks again!
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 11, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liupeng0518, MrFreezeex, VannTen

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 merged commit 5106922 into kubernetes-sigs:master Dec 11, 2023
64 checks passed
@yankay yankay mentioned this pull request Dec 15, 2023
pedro-peter pushed a commit to pedro-peter/kubespray that referenced this pull request May 8, 2024
* Decouple role kubespray-defaults from download

Avoids doing re-importing the download role on every invocation of
kubespray-defaults (and skipping everything).

This has a measurable effect on playbook performance.

* Update docs refering to moved download defaults
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubespray play spends a lot of time doing nothing
6 participants