Documentation ¶
Overview ¶
Package options provide a central point for defining flags for kubeadm cobra commands, no matter if hard coded commands or autogenerated command for phases.
New kubeadm flags should always be defined in this package as a constant before their usage, in order to enforce naming consistency across different commands and to control flag proliferation.
In addition to defining the flags, the package also contains set of utilities for flag management.
For additional details about how flags are managed in phases, please refer to the "k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow" package.
Index ¶
- Constants
- func AddCertificateDirFlag(fs *pflag.FlagSet, certsDir *string)
- func AddConfigFlag(fs *pflag.FlagSet, cfgPath *string)
- func AddControlPlanExtraArgsFlags(fs *pflag.FlagSet, ...)
- func AddFeatureGatesStringFlag(fs *pflag.FlagSet, featureGatesString *string)
- func AddIgnorePreflightErrorsFlag(fs *pflag.FlagSet, ignorePreflightErrors *[]string)
- func AddImageMetaFlags(fs *pflag.FlagSet, imageRepository *string)
- func AddKubeConfigDirFlag(fs *pflag.FlagSet, kubeConfigDir *string)
- func AddKubeConfigFlag(fs *pflag.FlagSet, kubeConfigFile *string)
- func AddKubeadmOtherFlags(flagSet *pflag.FlagSet, rootfsPath *string)
- func AddKubernetesVersionFlag(fs *pflag.FlagSet, kubernetesVersion *string)
- func AddPatchesFlag(fs *pflag.FlagSet, patchesDir *string)
- type BootstrapTokenOptions
- func (bto *BootstrapTokenOptions) AddDescriptionFlag(fs *pflag.FlagSet)
- func (bto *BootstrapTokenOptions) AddGroupsFlag(fs *pflag.FlagSet)
- func (bto *BootstrapTokenOptions) AddTTLFlag(fs *pflag.FlagSet)
- func (bto *BootstrapTokenOptions) AddTTLFlagWithName(fs *pflag.FlagSet, flagName string)
- func (bto *BootstrapTokenOptions) AddTokenFlag(fs *pflag.FlagSet)
- func (bto *BootstrapTokenOptions) AddUsagesFlag(fs *pflag.FlagSet)
- func (bto *BootstrapTokenOptions) ApplyTo(cfg *kubeadmapiv1.InitConfiguration) error
Constants ¶
const ( // APIServerAdvertiseAddress flag sets the IP address the API Server will advertise it's listening on. Specify '0.0.0.0' to use the address of the default network interface. APIServerAdvertiseAddress = "apiserver-advertise-address" // APIServerBindPort flag sets the port for the API Server to bind to. APIServerBindPort = "apiserver-bind-port" // APIServerCertSANs flag sets extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names. APIServerCertSANs = "apiserver-cert-extra-sans" // APIServerExtraArgs flag sets a extra flags to pass to the API Server or override default ones in form of <flagname>=<value>. APIServerExtraArgs = "apiserver-extra-args" // CertificatesDir flag sets the path where to save and read the certificates. CertificatesDir = "cert-dir" // CfgPath flag sets the path to kubeadm config file. CfgPath = "config" // ControllerManagerExtraArgs flag sets extra flags to pass to the Controller Manager or override default ones in form of <flagname>=<value>. ControllerManagerExtraArgs = "controller-manager-extra-args" // ControlPlaneEndpoint flag sets a stable IP address or DNS name for the control plane. ControlPlaneEndpoint = "control-plane-endpoint" // DryRun flag instructs kubeadm to don't apply any changes; just output what would be done. DryRun = "dry-run" // FeatureGatesString flag sets key=value pairs that describe feature gates for various features. FeatureGatesString = "feature-gates" // IgnorePreflightErrors sets the path a list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks. IgnorePreflightErrors = "ignore-preflight-errors" // ImageRepository sets the container registry to pull control plane images from. ImageRepository = "image-repository" // KubeconfigDir flag sets the path where to save the kubeconfig file. KubeconfigDir = "kubeconfig-dir" // KubeconfigPath flag sets the kubeconfig file to use when talking to the cluster. If the flag is not set, a set of standard locations are searched for an existing KubeConfig file. KubeconfigPath = "kubeconfig" // KubernetesVersion flag sets the Kubernetes version for the control plane. KubernetesVersion = "kubernetes-version" // NetworkingDNSDomain flag sets the domain for services, e.g. "myorg.internal". NetworkingDNSDomain = "service-dns-domain" // NetworkingServiceSubnet flag sets the range of IP address for service VIPs. NetworkingServiceSubnet = "service-cidr" // NetworkingPodSubnet flag sets the range of IP addresses for the pod network. If set, the control plane will automatically allocate CIDRs for every node. NetworkingPodSubnet = "pod-network-cidr" // NodeCRISocket flag sets the CRI socket to connect to. NodeCRISocket = "cri-socket" // NodeName flag sets the node name. NodeName = "node-name" // SchedulerExtraArgs flag sets extra flags to pass to the Scheduler or override default ones in form of <flagname>=<value>". SchedulerExtraArgs = "scheduler-extra-args" // SkipTokenPrint flag instructs kubeadm to skip printing of the default bootstrap token generated by 'kubeadm init'. SkipTokenPrint = "skip-token-print" // TokenStr flags sets both the discovery-token and the tls-bootstrap-token when those values are not provided TokenStr = "token" // TokenTTL flag sets the time to live for token TokenTTL = "token-ttl" // TokenUsages flag sets the usages of the token TokenUsages = "usages" // TokenGroups flag sets the authentication groups of the token TokenGroups = "groups" // TokenDescription flag sets the description of the token TokenDescription = "description" // TLSBootstrapToken flag sets the token used to temporarily authenticate with the Kubernetes Control Plane to submit a certificate signing request (CSR) for a locally created key pair TLSBootstrapToken = "tls-bootstrap-token" // TokenDiscovery flag sets the token used to validate cluster information fetched from the API server (for token-based discovery) TokenDiscovery = "discovery-token" // TokenDiscoveryCAHash flag instructs kubeadm to validate that the root CA public key matches this hash (for token-based discovery) TokenDiscoveryCAHash = "discovery-token-ca-cert-hash" // TokenDiscoverySkipCAHash flag instructs kubeadm to skip CA hash verification (for token-based discovery) TokenDiscoverySkipCAHash = "discovery-token-unsafe-skip-ca-verification" // FileDiscovery flag sets the file or URL from which to load cluster information (for file-based discovery) FileDiscovery = "discovery-file" // ControlPlane flag instructs kubeadm to create a new control plane instance on this node ControlPlane = "control-plane" // UploadCerts flag instructs kubeadm to upload certificates UploadCerts = "upload-certs" // CertificateKey flag sets the key used to encrypt and decrypt certificate secrets CertificateKey = "certificate-key" // SkipCertificateKeyPrint flag instructs kubeadm to skip printing certificate key used to encrypt certs by 'kubeadm init'. SkipCertificateKeyPrint = "skip-certificate-key-print" // ForceReset flag instructs kubeadm to reset the node without prompting for confirmation ForceReset = "force" // CertificateRenewal flag instructs kubeadm to execute certificate renewal during upgrades CertificateRenewal = "certificate-renewal" // EtcdUpgrade flag instructs kubeadm to execute etcd upgrade during upgrades EtcdUpgrade = "etcd-upgrade" // Patches flag sets the folder where kubeadm component patches are stored Patches = "patches" // PrintManifest flag instructs kubeadm to print the addon manifests to STDOUT instead of installing them. PrintManifest = "print-manifest" // CleanupTmpDir flag indicates whether reset will cleanup the tmp dir CleanupTmpDir = "cleanup-tmp-dir" // AllowExperimentalAPI flag can be used to allow experimental / work in progress APIs AllowExperimentalAPI = "allow-experimental-api" // AllowRCUpgrades enable this flag will allow upgrading to a release candidate version of Kubernetes. AllowRCUpgrades = "allow-release-candidate-upgrades" // AllowExperimentalUpgrades enable this flag will allow upgrading to an alpha/beta/release candidate version of Kubernetes. AllowExperimentalUpgrades = "allow-experimental-upgrades" // PrintConfig specifies whether the cluster configuration that will be used in the upgrade should be printed or not. PrintConfig = "print-config" )
Variables ¶
This section is empty.
Functions ¶
func AddCertificateDirFlag ¶ added in v1.12.0
AddCertificateDirFlag adds the --certs-dir flag to the given flagset
func AddConfigFlag ¶
AddConfigFlag adds the --config flag to the given flagset
func AddControlPlanExtraArgsFlags ¶ added in v1.13.0
func AddControlPlanExtraArgsFlags(fs *pflag.FlagSet, apiServerExtraArgs, controllerManagerExtraArgs, schedulerExtraArgs *map[string]string)
AddControlPlanExtraArgsFlags adds the ExtraArgs flags for control plane components
func AddFeatureGatesStringFlag ¶ added in v1.15.0
AddFeatureGatesStringFlag adds the --feature-gates flag to the given flagset
func AddIgnorePreflightErrorsFlag ¶ added in v1.12.0
AddIgnorePreflightErrorsFlag adds the --ignore-preflight-errors flag to the given flagset
func AddImageMetaFlags ¶ added in v1.13.0
AddImageMetaFlags adds the --image-repository flag to the given flagset
func AddKubeConfigDirFlag ¶ added in v1.13.0
AddKubeConfigDirFlag adds the --kubeconfig-dir flag to the given flagset
func AddKubeConfigFlag ¶
AddKubeConfigFlag adds the --kubeconfig flag to the given flagset
func AddKubeadmOtherFlags ¶ added in v1.16.0
AddKubeadmOtherFlags adds flags that are not bound to a configuration file to the given flagset
func AddKubernetesVersionFlag ¶ added in v1.15.0
AddKubernetesVersionFlag adds the --kubernetes-version flag to the given flagset
func AddPatchesFlag ¶ added in v1.19.0
AddPatchesFlag adds the --patches flag to the given flagset
Types ¶
type BootstrapTokenOptions ¶
type BootstrapTokenOptions struct { *bootstraptokenv1.BootstrapToken TokenStr string `datapolicy:"token"` }
BootstrapTokenOptions is a wrapper struct for adding bootstrap token-related flags to a FlagSet and applying the parsed flags to a InitConfiguration object later at runtime TODO: In the future, we might want to group the flags in a better way than adding them all individually like this
func NewBootstrapTokenOptions ¶
func NewBootstrapTokenOptions() *BootstrapTokenOptions
NewBootstrapTokenOptions creates a new BootstrapTokenOptions object with the default values
func (*BootstrapTokenOptions) AddDescriptionFlag ¶
func (bto *BootstrapTokenOptions) AddDescriptionFlag(fs *pflag.FlagSet)
AddDescriptionFlag adds the --description flag to the given flagset
func (*BootstrapTokenOptions) AddGroupsFlag ¶
func (bto *BootstrapTokenOptions) AddGroupsFlag(fs *pflag.FlagSet)
AddGroupsFlag adds the --groups flag to the given flagset
func (*BootstrapTokenOptions) AddTTLFlag ¶
func (bto *BootstrapTokenOptions) AddTTLFlag(fs *pflag.FlagSet)
AddTTLFlag adds the --token-ttl flag to the given flagset
func (*BootstrapTokenOptions) AddTTLFlagWithName ¶
func (bto *BootstrapTokenOptions) AddTTLFlagWithName(fs *pflag.FlagSet, flagName string)
AddTTLFlagWithName adds the --token-ttl flag with a custom flag name given flagset
func (*BootstrapTokenOptions) AddTokenFlag ¶
func (bto *BootstrapTokenOptions) AddTokenFlag(fs *pflag.FlagSet)
AddTokenFlag adds the --token flag to the given flagset
func (*BootstrapTokenOptions) AddUsagesFlag ¶
func (bto *BootstrapTokenOptions) AddUsagesFlag(fs *pflag.FlagSet)
AddUsagesFlag adds the --usages flag to the given flagset
func (*BootstrapTokenOptions) ApplyTo ¶
func (bto *BootstrapTokenOptions) ApplyTo(cfg *kubeadmapiv1.InitConfiguration) error
ApplyTo applies the values set internally in the BootstrapTokenOptions object to a InitConfiguration object at runtime If --token was specified in the CLI (as a string), it's parsed and validated before it's added to the BootstrapToken object.