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
kubeadm: add timeouts to v1beta4.UpgradeConfiguration #123595
Conversation
/hold |
/triage accepted |
// 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 | ||
|
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.
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}, |
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 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.
-
our global kubeconfig -> client timeout is 10s:
overrides := clientcmd.ConfigOverrides{Timeout: "10s"} -
our "get k8s version" from label is also hardcoded:
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())) |
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.
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()) |
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.
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 |
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.
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) { |
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.
same here, even if the defaulting part is not used on call sites.
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.
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 != "" { |
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.
this is common in similar tests, to just ignore checking the timeouts.
e721612
to
a7a2c79
Compare
/cc @carlory |
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.
only some typos.
// 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) { |
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.
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.
a7a2c79
to
99313be
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
LGTM label has been added. Git tree hash: 9573d2fd0ea295aeae04c0d4d397286e0bd5e4b4
|
[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 |
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.
/hold cancel
/retest |
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:
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?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: