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

kubeadm: add timeouts to v1beta4.UpgradeConfiguration #123595

Merged

Conversation

neolit123
Copy link
Member

@neolit123 neolit123 commented Feb 29, 2024

What type of PR is this?

/kind feature cleanup

What this PR does / why we need it:

Follow the same process of adding the Timeouts struct
to UpgradeConfiguration similarly to how it was done for
other API Kinds.

In the Timeouts struct include one new timeout:

  • UpgradeManifests
    StaticPodMirroringTimeout and StaticPodMirroringRetryInterval
    are use for just an API call to get Pods(). The already existing
    constants.KubernetesAPICallRetryInterval
    and kubeadmapi.GetActiveTimeouts().KubernetesAPICall.Duration
    can be used for that instead.

Which issue(s) this PR fixes:

xref:

Special notes for your reviewer:

NONE

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 29, 2024
@neolit123
Copy link
Member Author

/hold
/cc @SataQiu @pacoxu @calvin0327
PTAL

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 29, 2024
@neolit123
Copy link
Member Author

/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 29, 2024
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubeadm sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 29, 2024
Comment on lines -226 to -232
// StaticPodMirroringTimeout specifies how much time kubeadm should wait for the static pods
// to be mirrored on the API server.
StaticPodMirroringTimeout = 30 * time.Second
// StaticPodMirroringRetryInterval specifies how often to check if static pods are mirrored at the
// API server.
StaticPodMirroringRetryInterval = 500 * time.Millisecond

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 commits is just a cleanup to use the general k8s API-call for static pod get() calls too.

@@ -32,6 +32,7 @@ func SetDefaultTimeouts(t **Timeouts) {
EtcdAPICall: &metav1.Duration{Duration: constants.EtcdAPICallTimeout},
TLSBootstrap: &metav1.Duration{Duration: constants.TLSBootstrapTimeout},
Discovery: &metav1.Duration{Duration: constants.DiscoveryTimeout},
UpgradeManifests: &metav1.Duration{Duration: constants.UpgradeManifestsTimeout},
Copy link
Member Author

Choose a reason for hiding this comment

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

i could not find anything else that is worth adding. if you find something LMK.

well...there are two more things that can be added, but they might be a bit tricky because they are used very early in the command execution.

getReleaseVersionTimeout = 10 * time.Second

@@ -57,7 +58,9 @@ func TestRunDiff(t *testing.T) {
testUpgradeDiffConfigContents := []byte(fmt.Sprintf(`
apiVersion: %s
kind: UpgradeConfiguration
contextLines: 4`, kubeadmapiv1.SchemeGroupVersion.String()))
diff:
contextLines: 4`, kubeadmapiv1.SchemeGroupVersion.String()))
Copy link
Member Author

Choose a reason for hiding this comment

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

side bug.

@@ -390,11 +390,13 @@ func isKubeadmPrereleaseVersion(versionInfo *apimachineryversion.Info, k8sVersio
func prepareStaticVariables(config any) {
switch c := config.(type) {
case *kubeadmapi.InitConfiguration:
kubeadmapi.SetActiveTimeouts(c.Timeouts.DeepCopy())
Copy link
Member Author

Choose a reason for hiding this comment

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

these deepcopy are removed because SetActiveTimeouts() already creates a deepcopy.

@@ -38,17 +38,6 @@ import (

var componentCfgGV = sets.New(kubeproxyconfig.GroupName, kubeletconfig.GroupName)

// DefaultUpgradeConfiguration return a default UpgradeConfiguration
Copy link
Member Author

Choose a reason for hiding this comment

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

some of the refactors of this file is to make it look like other xxconfigruation.go files in the same package.

// Then the external, versioned configuration is defaulted and converted to the internal type.
// Right thereafter, the configuration is defaulted again with dynamic values
// Lastly, the internal config is validated and returned.
func LoadOrDefaultUpgradeConfiguration(cfgPath string, defaultversionedcfg *kubeadmapiv1.UpgradeConfiguration, opts LoadOrDefaultConfigurationOptions) (*kubeadmapi.UpgradeConfiguration, error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

same here, even if the defaulting part is not used on call sites.

Copy link
Member

Choose a reason for hiding this comment

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

The refactor seems to be unrelated, but good to have.

@@ -96,7 +98,7 @@ func TestDocMapToUpgradeConfiguration(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error of DocMapToUpgradeConfiguration: %v\nconfig: %s", err, string(b))
}
if diff := cmp.Diff(*cfg, tc.expectedCfg); diff != "" {
if diff := cmp.Diff(*cfg, tc.expectedCfg, cmpopts.IgnoreFields(kubeadmapi.UpgradeConfiguration{}, "Timeouts")); diff != "" {
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 is common in similar tests, to just ignore checking the timeouts.

@neolit123 neolit123 force-pushed the 1.30-add-timeouts-upgradeconfig branch from e721612 to a7a2c79 Compare February 29, 2024 18:38
@pacoxu
Copy link
Member

pacoxu commented Mar 1, 2024

/cc @carlory

Copy link
Member

@pacoxu pacoxu left a comment

Choose a reason for hiding this comment

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

only some typos.

cmd/kubeadm/app/apis/kubeadm/types.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/apis/kubeadm/v1beta4/types.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/constants/constants.go Outdated Show resolved Hide resolved
// Then the external, versioned configuration is defaulted and converted to the internal type.
// Right thereafter, the configuration is defaulted again with dynamic values
// Lastly, the internal config is validated and returned.
func LoadOrDefaultUpgradeConfiguration(cfgPath string, defaultversionedcfg *kubeadmapiv1.UpgradeConfiguration, opts LoadOrDefaultConfigurationOptions) (*kubeadmapi.UpgradeConfiguration, error) {
Copy link
Member

Choose a reason for hiding this comment

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

The refactor seems to be unrelated, but good to have.

Follow the same process of adding the Timeouts struct
to UpgradeConfiguration similarly to how it was done for
other API Kinds.

In the Timeouts struct include one new timeout:
- UpgradeManifests
StaticPodMirroringTimeout and StaticPodMirroringRetryInterval
are use for just an API call to get Pods(). The already existing
constants.KubernetesAPICallRetryInterval
and kubeadmapi.GetActiveTimeouts().KubernetesAPICall.Duration
can be used for that instead.
@neolit123 neolit123 force-pushed the 1.30-add-timeouts-upgradeconfig branch from a7a2c79 to 99313be Compare March 1, 2024 11:04
@neolit123
Copy link
Member Author

updated. 3 more days before CF.

/cc @SataQiu @pacoxu

@k8s-ci-robot k8s-ci-robot requested a review from pacoxu March 3, 2024 07:53
Copy link
Member

@pacoxu pacoxu left a comment

Choose a reason for hiding this comment

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

/lgtm

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

LGTM label has been added.

Git tree hash: 9573d2fd0ea295aeae04c0d4d397286e0bd5e4b4

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: neolit123, pacoxu

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

Copy link
Member Author

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 4, 2024
@neolit123
Copy link
Member Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit 9d39ce0 into kubernetes:master Mar 4, 2024
14 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.30 milestone Mar 4, 2024
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. area/kubeadm 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. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants