-
Notifications
You must be signed in to change notification settings - Fork 40.4k
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
[WIP] - Kubeadm phase ga #61631
[WIP] - Kubeadm phase ga #61631
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fabriziopandini Assign the PR to them by writing 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 |
ad82c42
to
3622b9b
Compare
@fabriziopandini Is there any way we can split up this PR into smaller chunks? 134 files is a lot to parse in one go! 😄 🤔 |
@jamiehannaford I'm going to remove temporarly auto-generated docs from the PR; this reduce the number of changes significantly, even if some check will complain. The following commits will contains the relevant changes:
An this will sum up to about 2000 lines of code for the full kubeadm init & phases, plus some deleted files. |
3622b9b
to
e3e4d88
Compare
@fabriziopandini: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
|
||
// HasByArgOrAlias returns true if the given phase (identified by phase.Arg) | ||
// is included in the workflow | ||
func (w PhaseWorkflow) HasByArgOrAlias(arg string) bool { |
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.
any reason this isn't HasOrgOrAlias
like the individual phases?
return dryrun.NewWaiter() | ||
} | ||
|
||
timeout := 30 * time.Minute |
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.
should these be constants maybe?
"upload-config", // because in this case it is not allowed to change the KubernetesVersion | ||
} | ||
|
||
// initWorkflow defines the main init workflow as a sequence of ordered phases |
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.
maybe call this kubeadm init workflow, to distinguish it from generic "initializer" functions?
Example: pc.Example, | ||
Args: pc.validateArgs(pc.PhaseArgsValidator, pc.ArgsValidator), // triggers separated validation for for phaseArgs and other custom/positional args. | ||
ValidArgs: pc.ValidArgs, | ||
RunE: func(cmd *cobra.Command, args []string) 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.
if we wanted to have seperate help functions, we could just programatically generate and nest a bunch of commands here using the same logic.
|
||
// descriptionWithPhases returns the PhasedCommand long description with the addition of the | ||
// message for using phases | ||
func (pc *PhasedCommandBuilder) descriptionWithPhases() 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.
be nice to have an example of what this looks like in comments, maybe?
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.
nevermind, found it in doc.go
|
||
if customArgValidator != nil { | ||
if err := customArgValidator(cmd, customArgs); err != nil { | ||
return fmt.Errorf("invalid args: %v", err) |
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.
guessing this codebase doesn't use pkg/error
?
// MasterConfiguration returns the MasterConfiguration instance. | ||
func (f *MasterConfigurationFactory) MasterConfiguration() *kubeadmapi.MasterConfiguration { | ||
if f.masterConfigurationInstance == nil { | ||
panic("Invalid operation. InitMasterConfiguration must be executed before GetMasterConfiguration") |
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.
Maybe we want to make the panic info more clear? I think users may not be sure what happened or what to do when they see this info.
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 as below
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.
first round. I'll try to have a deeper look at this soon when I have time.
// All the methods implementing the phases use this object as a receiver, so all the attributes | ||
// of this object will be passed through the init phases. | ||
type initContext struct { | ||
// init input parameters |
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.
can we document each field?
factory.ClientFactory | ||
factory.WaiterFactory | ||
|
||
// worklow flags to be shared across init phases |
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.
workflow
Run: func(cmd *cobra.Command, args []string) { | ||
// Phases provides the definition of the command workflow as a sequence of ordered phases | ||
Phases: context.initWorkflow(), | ||
// RunPhases provide the function the executes the entire command logic (all the phases) or |
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.
provides the function that
legacyscheme.Scheme.Default(cfg) | ||
internalcfg := &kubeadmapi.MasterConfiguration{} | ||
legacyscheme.Scheme.Convert(cfg, internalcfg, nil) | ||
// If --config file is passed, errors if any overlapping flag is used too (mixedArguments) |
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.
an error is thrown
|
||
// If the kubernetes version is not used in the phasesToRun, inhibits kubernetes version lookup | ||
// (an unnecessary access to internet in those cases) - by setting it to a default value - | ||
context.inhibitVersionLookupWhenPossible(phasesToRun, cfg) |
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.
can we replace inhibit
with prevent
?
@fabriziopandini: PR needs rebase. 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. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle rotten |
/hold |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this PR. In response to this:
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. |
What this PR does / why we need it:
This PR prototypes the approach described in KEP kubeadm phases to beta.
As a result you can execute
kubeadm init [flags]
as today - for executing the entire init workflow -, or usekubeadm init [phases] [flags]
for executing only single steps of the workflow. e.g.Which issue(s) this PR fixes:
Fixes #kubernetes/kubeadm#454
Special notes for your reviewer:
/CC @kubernetes/sig-cluster-lifecycle-pr-reviews
The following commits contains the relevant changes:
Other commits contains deleted files (many!) and autogenerate files.
The kubeadm init help shows all the available phases:
Release note: