type initOptions … const coreDNSPhase … const kubeProxyPhase … const addonPhase … var _ … type initData … // newCmdInit returns "kubeadm init" command. // NB. initOptions is exposed as parameter for allowing unit testing of // the newInitOptions method, that implements all the command options validation logic func newCmdInit(out io.Writer, initOptions *initOptions) *cobra.Command { … } // AddInitConfigFlags adds init flags bound to the config to the specified flagset func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1.InitConfiguration) { … } // AddClusterConfigFlags adds cluster flags bound to the config to the specified flagset func AddClusterConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1.ClusterConfiguration, featureGatesString *string) { … } // AddInitOtherFlags adds init flags that are not bound to a configuration file to the given flagset // Note: All flags that are not bound to the cfg object should be allowed in cmd/kubeadm/app/apis/kubeadm/validation/validation.go func AddInitOtherFlags(flagSet *flag.FlagSet, initOptions *initOptions) { … } // newInitOptions returns a struct ready for being used for creating cmd init flags. func newInitOptions() *initOptions { … } // newInitData returns a new initData struct to be used for the execution of the kubeadm init workflow. // This func takes care of validating initOptions passed to the command, and then it converts // options into the internal InitConfiguration type that is used as input all the phases in the kubeadm init workflow func newInitData(cmd *cobra.Command, args []string, initOptions *initOptions, out io.Writer) (*initData, error) { … } // UploadCerts returns Uploadcerts flag. func (d *initData) UploadCerts() bool { … } // CertificateKey returns the key used to encrypt the certs. func (d *initData) CertificateKey() string { … } // SetCertificateKey set the key used to encrypt the certs. func (d *initData) SetCertificateKey(key string) { … } // SkipCertificateKeyPrint returns the skipCertificateKeyPrint flag. func (d *initData) SkipCertificateKeyPrint() bool { … } // Cfg returns initConfiguration. func (d *initData) Cfg() *kubeadmapi.InitConfiguration { … } // DryRun returns the DryRun flag. func (d *initData) DryRun() bool { … } // SkipTokenPrint returns the SkipTokenPrint flag. func (d *initData) SkipTokenPrint() bool { … } // IgnorePreflightErrors returns the IgnorePreflightErrors flag. func (d *initData) IgnorePreflightErrors() sets.Set[string] { … } // CertificateWriteDir returns the path to the certificate folder or the temporary folder path in case of DryRun. func (d *initData) CertificateWriteDir() string { … } // CertificateDir returns the CertificateDir as originally specified by the user. func (d *initData) CertificateDir() string { … } // KubeConfigDir returns the path of the Kubernetes configuration folder or the temporary folder path in case of DryRun. func (d *initData) KubeConfigDir() string { … } // KubeConfigPath returns the path to the kubeconfig file to use for connecting to Kubernetes func (d *initData) KubeConfigPath() string { … } // ManifestDir returns the path where manifest should be stored or the temporary folder path in case of DryRun. func (d *initData) ManifestDir() string { … } // KubeletDir returns path of the kubelet configuration folder or the temporary folder in case of DryRun. func (d *initData) KubeletDir() string { … } // ExternalCA returns true if an external CA is provided by the user. func (d *initData) ExternalCA() bool { … } // OutputWriter returns the io.Writer used to write output to by this command. func (d *initData) OutputWriter() io.Writer { … } // getDryRunClient creates a fake client that answers some GET calls in order to be able to do the full init flow in dry-run mode. func getDryRunClient(d *initData) (clientset.Interface, error) { … } // Client returns a Kubernetes client to be used by kubeadm. // This function is implemented as a singleton, thus avoiding to recreate the client when it is used by different phases. // Important. This function must be called after the admin.conf kubeconfig file is created. func (d *initData) Client() (clientset.Interface, error) { … } // ClientWithoutBootstrap returns a dry-run client or a regular client from admin.conf. // Unlike Client(), it does not call EnsureAdminClusterRoleBinding() or sets d.client. // This means the client only has anonymous permissions and does not persist in initData. func (d *initData) ClientWithoutBootstrap() (clientset.Interface, error) { … } // Tokens returns an array of token strings. func (d *initData) Tokens() []string { … } // PatchesDir returns the folder where patches for components are stored func (d *initData) PatchesDir() string { … } // manageSkippedAddons syncs proxy and DNS "Disabled" status and skipPhases. func manageSkippedAddons(cfg *kubeadmapi.ClusterConfiguration, skipPhases []string) []string { … } func isPhaseInSkipPhases(phase string, skipPhases []string) bool { … }