mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #70341 from yagonobre/fix-typos
Fix typos on cmd/kubeadm
This commit is contained in:
commit
a95c0c36e5
@ -383,7 +383,7 @@ func NewCmdConfigView(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCmdConfigUploadFromFile verifies given kubernetes config file and returns cobra.Command for
|
// NewCmdConfigUploadFromFile verifies given Kubernetes config file and returns cobra.Command for
|
||||||
// "kubeadm config upload from-file" command
|
// "kubeadm config upload from-file" command
|
||||||
func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
||||||
var cfgPath string
|
var cfgPath string
|
||||||
@ -559,7 +559,7 @@ func NewCmdConfigImagesList(out io.Writer, mockK8sVersion *string) *cobra.Comman
|
|||||||
var cfgPath, featureGatesString string
|
var cfgPath, featureGatesString string
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
// This just sets the kubernetes version for unit testing so kubeadm won't try to
|
// This just sets the Kubernetes version for unit testing so kubeadm won't try to
|
||||||
// lookup the latest release from the internet.
|
// lookup the latest release from the internet.
|
||||||
if mockK8sVersion != nil {
|
if mockK8sVersion != nil {
|
||||||
externalcfg.KubernetesVersion = *mockK8sVersion
|
externalcfg.KubernetesVersion = *mockK8sVersion
|
||||||
|
@ -360,7 +360,7 @@ func (d initData) CertificateDir() string {
|
|||||||
return d.certificatesDir
|
return d.certificatesDir
|
||||||
}
|
}
|
||||||
|
|
||||||
// KubeConfigDir returns the path of the kubernetes configuration folder or the temporary folder path in case of DryRun.
|
// KubeConfigDir returns the path of the Kubernetes configuration folder or the temporary folder path in case of DryRun.
|
||||||
func (d initData) KubeConfigDir() string {
|
func (d initData) KubeConfigDir() string {
|
||||||
if d.dryRun {
|
if d.dryRun {
|
||||||
return d.dryRunDir
|
return d.dryRunDir
|
||||||
@ -368,7 +368,7 @@ func (d initData) KubeConfigDir() string {
|
|||||||
return kubeadmconstants.KubernetesDir
|
return kubeadmconstants.KubernetesDir
|
||||||
}
|
}
|
||||||
|
|
||||||
// KubeConfigDir returns the path where manifest should be stored or the temporary folder path in case of DryRun.
|
// ManifestDir returns the path where manifest should be stored or the temporary folder path in case of DryRun.
|
||||||
func (d initData) ManifestDir() string {
|
func (d initData) ManifestDir() string {
|
||||||
if d.dryRun {
|
if d.dryRun {
|
||||||
return d.dryRunDir
|
return d.dryRunDir
|
||||||
@ -447,7 +447,7 @@ func runInit(i *initData, out io.Writer) error {
|
|||||||
return errors.Wrap(err, "error printing files on dryrun")
|
return errors.Wrap(err, "error printing files on dryrun")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a kubernetes client and wait for the API server to be healthy (if not dryrunning)
|
// Create a Kubernetes client and wait for the API server to be healthy (if not dryrunning)
|
||||||
glog.V(1).Infof("creating Kubernetes client")
|
glog.V(1).Infof("creating Kubernetes client")
|
||||||
client, err := createClient(i.cfg, i.dryRun)
|
client, err := createClient(i.cfg, i.dryRun)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -84,7 +84,7 @@ var (
|
|||||||
* Certificate signing request was sent to apiserver and approval was received.
|
* Certificate signing request was sent to apiserver and approval was received.
|
||||||
* The Kubelet was informed of the new secure connection details.
|
* The Kubelet was informed of the new secure connection details.
|
||||||
* Master label and taint were applied to the new node.
|
* Master label and taint were applied to the new node.
|
||||||
* The kubernetes control plane instances scaled up.
|
* The Kubernetes control plane instances scaled up.
|
||||||
{{.etcdMessage}}
|
{{.etcdMessage}}
|
||||||
|
|
||||||
To start administering your cluster from this node, you need to run the following as a regular user:
|
To start administering your cluster from this node, you need to run the following as a regular user:
|
||||||
@ -324,7 +324,7 @@ func NewJoin(cfgPath string, defaultcfg *kubeadmapiv1beta1.JoinConfiguration, ig
|
|||||||
|
|
||||||
// Run executes worker node provisioning and tries to join an existing cluster.
|
// Run executes worker node provisioning and tries to join an existing cluster.
|
||||||
func (j *Join) Run(out io.Writer) error {
|
func (j *Join) Run(out io.Writer) error {
|
||||||
// Perform the Discovery, which turns a Bootstrap Token and optionally (and preferably) a CA cert hash into a KubeConfig
|
// Perform the Discovery, which turns a Bootstrap Token and optionally (and preferably) a CA cert hash into a kubeconfig
|
||||||
// file that may be used for the TLS Bootstrapping process the kubelet performs using the Certificates API.
|
// file that may be used for the TLS Bootstrapping process the kubelet performs using the Certificates API.
|
||||||
glog.V(1).Infoln("[join] discovering cluster-info")
|
glog.V(1).Infoln("[join] discovering cluster-info")
|
||||||
tlsBootstrapCfg, err := discovery.For(j.cfg)
|
tlsBootstrapCfg, err := discovery.For(j.cfg)
|
||||||
@ -336,7 +336,7 @@ func (j *Join) Run(out io.Writer) error {
|
|||||||
var initConfiguration *kubeadmapi.InitConfiguration
|
var initConfiguration *kubeadmapi.InitConfiguration
|
||||||
if j.cfg.ControlPlane == true {
|
if j.cfg.ControlPlane == true {
|
||||||
// Retrives the kubeadm configuration used during kubeadm init
|
// Retrives the kubeadm configuration used during kubeadm init
|
||||||
glog.V(1).Infoln("[join] retrieving KubeConfig objects")
|
glog.V(1).Infoln("[join] retrieving kubeconfig objects")
|
||||||
initConfiguration, err = j.FetchInitConfiguration(tlsBootstrapCfg)
|
initConfiguration, err = j.FetchInitConfiguration(tlsBootstrapCfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -364,7 +364,7 @@ func (j *Join) Run(out io.Writer) error {
|
|||||||
preflight.RunInitMasterChecks(utilsexec.New(), initConfiguration, j.ignorePreflightErrors)
|
preflight.RunInitMasterChecks(utilsexec.New(), initConfiguration, j.ignorePreflightErrors)
|
||||||
|
|
||||||
// Prepares the node for hosting a new control plane instance by writing necessary
|
// Prepares the node for hosting a new control plane instance by writing necessary
|
||||||
// KubeConfig files, and static pod manifests
|
// kubeconfig files, and static pod manifests
|
||||||
if err = j.PrepareForHostingControlPlane(initConfiguration); err != nil {
|
if err = j.PrepareForHostingControlPlane(initConfiguration); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -481,7 +481,7 @@ func (j *Join) PrepareForHostingControlPlane(initConfiguration *kubeadmapi.InitC
|
|||||||
|
|
||||||
client, err := kubeconfigutil.ClientSetFromFile(kubeConfigFile)
|
client, err := kubeconfigutil.ClientSetFromFile(kubeConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "couldn't create kubernetes client")
|
return errors.Wrap(err, "couldn't create Kubernetes client")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := etcdphase.CheckLocalEtcdClusterStatus(client, initConfiguration); err != nil {
|
if err := etcdphase.CheckLocalEtcdClusterStatus(client, initConfiguration); err != nil {
|
||||||
@ -545,7 +545,7 @@ func (j *Join) BootstrapKubelet(tlsBootstrapCfg *clientcmdapi.Config) error {
|
|||||||
kubeletphase.TryStartKubelet()
|
kubeletphase.TryStartKubelet()
|
||||||
|
|
||||||
// Now the kubelet will perform the TLS Bootstrap, transforming /etc/kubernetes/bootstrap-kubelet.conf to /etc/kubernetes/kubelet.conf
|
// Now the kubelet will perform the TLS Bootstrap, transforming /etc/kubernetes/bootstrap-kubelet.conf to /etc/kubernetes/kubelet.conf
|
||||||
// Wait for the kubelet to create the /etc/kubernetes/kubelet.conf KubeConfig file. If this process
|
// Wait for the kubelet to create the /etc/kubernetes/kubelet.conf kubeconfig file. If this process
|
||||||
// times out, display a somewhat user-friendly message.
|
// times out, display a somewhat user-friendly message.
|
||||||
waiter := apiclient.NewKubeWaiter(nil, kubeadmconstants.TLSBootstrapTimeout, os.Stdout)
|
waiter := apiclient.NewKubeWaiter(nil, kubeadmconstants.TLSBootstrapTimeout, os.Stdout)
|
||||||
if err := waitForKubeletAndFunc(waiter, waitForTLSBootstrappedClient); err != nil {
|
if err := waitForKubeletAndFunc(waiter, waitForTLSBootstrappedClient); err != nil {
|
||||||
@ -580,7 +580,7 @@ func (j *Join) PostInstallControlPlane(initConfiguration *kubeadmapi.InitConfigu
|
|||||||
|
|
||||||
client, err := kubeconfigutil.ClientSetFromFile(kubeConfigFile)
|
client, err := kubeconfigutil.ClientSetFromFile(kubeConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "couldn't create kubernetes client")
|
return errors.Wrap(err, "couldn't create Kubernetes client")
|
||||||
}
|
}
|
||||||
|
|
||||||
// in case of local etcd
|
// in case of local etcd
|
||||||
|
@ -20,7 +20,7 @@ import "github.com/spf13/pflag"
|
|||||||
|
|
||||||
// AddKubeConfigFlag adds the --kubeconfig flag to the given flagset
|
// AddKubeConfigFlag adds the --kubeconfig flag to the given flagset
|
||||||
func AddKubeConfigFlag(fs *pflag.FlagSet, kubeConfigFile *string) {
|
func AddKubeConfigFlag(fs *pflag.FlagSet, kubeConfigFile *string) {
|
||||||
fs.StringVar(kubeConfigFile, "kubeconfig", *kubeConfigFile, "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.")
|
fs.StringVar(kubeConfigFile, "kubeconfig", *kubeConfigFile, "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.")
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddConfigFlag adds the --config flag to the given flagset
|
// AddConfigFlag adds the --config flag to the given flagset
|
||||||
|
@ -95,7 +95,7 @@ func getSelfhostingSubCommand() *cobra.Command {
|
|||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets the kubernetes client
|
// Gets the Kubernetes client
|
||||||
kubeConfigFile = cmdutil.FindExistingKubeConfig(kubeConfigFile)
|
kubeConfigFile = cmdutil.FindExistingKubeConfig(kubeConfigFile)
|
||||||
client, err := kubeconfigutil.ClientSetFromFile(kubeConfigFile)
|
client, err := kubeconfigutil.ClientSetFromFile(kubeConfigFile)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
@ -24,7 +24,7 @@ For instance
|
|||||||
|
|
||||||
preflight Run master pre-flight checks
|
preflight Run master pre-flight checks
|
||||||
certs Generates all PKI assets necessary to establish the control plane
|
certs Generates all PKI assets necessary to establish the control plane
|
||||||
/ca Generates a self-signed kubernetes CA to provision identities for Kubernetes components
|
/ca Generates a self-signed Kubernetes CA to provision identities for Kubernetes components
|
||||||
/apiserver Generates an API server serving certificate and key
|
/apiserver Generates an API server serving certificate and key
|
||||||
...
|
...
|
||||||
kubeconfig Generates all kubeconfig files necessary to establish the control plane
|
kubeconfig Generates all kubeconfig files necessary to establish the control plane
|
||||||
|
@ -162,7 +162,7 @@ func (r *Reset) Run(out io.Writer, client clientset.Interface) error {
|
|||||||
glog.Errorf("[reset] failed to unmount mounted directories in %s: %s\n", kubeadmconstants.KubeletRunDirectory, string(umountOutputBytes))
|
glog.Errorf("[reset] failed to unmount mounted directories in %s: %s\n", kubeadmconstants.KubeletRunDirectory, string(umountOutputBytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Info("[reset] removing kubernetes-managed containers")
|
glog.V(1).Info("[reset] removing Kubernetes-managed containers")
|
||||||
if err := removeContainers(utilsexec.New(), r.criSocketPath); err != nil {
|
if err := removeContainers(utilsexec.New(), r.criSocketPath); err != nil {
|
||||||
glog.Errorf("[reset] failed to remove containers: %+v", err)
|
glog.Errorf("[reset] failed to remove containers: %+v", err)
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
|
|||||||
err = bto.ApplyTo(cfg)
|
err = bto.ApplyTo(cfg)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
glog.V(1).Infoln("[token] getting Clientsets from KubeConfig file")
|
glog.V(1).Infoln("[token] getting Clientsets from kubeconfig file")
|
||||||
kubeConfigFile = cmdutil.FindExistingKubeConfig(kubeConfigFile)
|
kubeConfigFile = cmdutil.FindExistingKubeConfig(kubeConfigFile)
|
||||||
client, err := getClientset(kubeConfigFile, dryRun)
|
client, err := getClientset(kubeConfigFile, dryRun)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
@ -34,7 +34,7 @@ var joinCommandTemplate = template.Must(template.New("join").Parse(`` +
|
|||||||
))
|
))
|
||||||
|
|
||||||
// GetJoinCommand returns the kubeadm join command for a given token and
|
// GetJoinCommand returns the kubeadm join command for a given token and
|
||||||
// and kubernetes cluster (the current cluster in the kubeconfig file)
|
// and Kubernetes cluster (the current cluster in the kubeconfig file)
|
||||||
func GetJoinCommand(kubeConfigFile string, token string, skipTokenPrint bool) (string, error) {
|
func GetJoinCommand(kubeConfigFile string, token string, skipTokenPrint bool) (string, error) {
|
||||||
// load the kubeconfig file to get the CA certificate and endpoint
|
// load the kubeconfig file to get the CA certificate and endpoint
|
||||||
config, err := clientcmd.LoadFromFile(kubeConfigFile)
|
config, err := clientcmd.LoadFromFile(kubeConfigFile)
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// KubeproxyKubeConfigFileName defines the file name for the kube-proxy's KubeConfig file
|
// KubeproxyKubeConfigFileName defines the file name for the kube-proxy's kubeconfig file
|
||||||
KubeproxyKubeConfigFileName = "/var/lib/kube-proxy/kubeconfig.conf"
|
KubeproxyKubeConfigFileName = "/var/lib/kube-proxy/kubeconfig.conf"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
|
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KubernetesDir is the directory kubernetes owns for storing various configuration files
|
// KubernetesDir is the directory Kubernetes owns for storing various configuration files
|
||||||
// This semi-constant MUST NOT be modified during runtime. It's a variable solely for use in unit testing.
|
// This semi-constant MUST NOT be modified during runtime. It's a variable solely for use in unit testing.
|
||||||
var KubernetesDir = "/etc/kubernetes"
|
var KubernetesDir = "/etc/kubernetes"
|
||||||
|
|
||||||
@ -135,18 +135,18 @@ const (
|
|||||||
// FrontProxyClientCertCommonName defines front proxy certificate common name
|
// FrontProxyClientCertCommonName defines front proxy certificate common name
|
||||||
FrontProxyClientCertCommonName = "front-proxy-client" //used as subject.commonname attribute (CN)
|
FrontProxyClientCertCommonName = "front-proxy-client" //used as subject.commonname attribute (CN)
|
||||||
|
|
||||||
// AdminKubeConfigFileName defines name for the KubeConfig aimed to be used by the superuser/admin of the cluster
|
// AdminKubeConfigFileName defines name for the kubeconfig aimed to be used by the superuser/admin of the cluster
|
||||||
AdminKubeConfigFileName = "admin.conf"
|
AdminKubeConfigFileName = "admin.conf"
|
||||||
// KubeletBootstrapKubeConfigFileName defines the file name for the KubeConfig that the kubelet will use to do
|
// KubeletBootstrapKubeConfigFileName defines the file name for the kubeconfig that the kubelet will use to do
|
||||||
// the TLS bootstrap to get itself an unique credential
|
// the TLS bootstrap to get itself an unique credential
|
||||||
KubeletBootstrapKubeConfigFileName = "bootstrap-kubelet.conf"
|
KubeletBootstrapKubeConfigFileName = "bootstrap-kubelet.conf"
|
||||||
|
|
||||||
// KubeletKubeConfigFileName defines the file name for the KubeConfig that the master kubelet will use for talking
|
// KubeletKubeConfigFileName defines the file name for the kubeconfig that the master kubelet will use for talking
|
||||||
// to the API server
|
// to the API server
|
||||||
KubeletKubeConfigFileName = "kubelet.conf"
|
KubeletKubeConfigFileName = "kubelet.conf"
|
||||||
// ControllerManagerKubeConfigFileName defines the file name for the controller manager's KubeConfig file
|
// ControllerManagerKubeConfigFileName defines the file name for the controller manager's kubeconfig file
|
||||||
ControllerManagerKubeConfigFileName = "controller-manager.conf"
|
ControllerManagerKubeConfigFileName = "controller-manager.conf"
|
||||||
// SchedulerKubeConfigFileName defines the file name for the scheduler's KubeConfig file
|
// SchedulerKubeConfigFileName defines the file name for the scheduler's kubeconfig file
|
||||||
SchedulerKubeConfigFileName = "scheduler.conf"
|
SchedulerKubeConfigFileName = "scheduler.conf"
|
||||||
|
|
||||||
// Some well-known users and groups in the core Kubernetes authorization system
|
// Some well-known users and groups in the core Kubernetes authorization system
|
||||||
@ -356,7 +356,7 @@ var (
|
|||||||
// MinimumKubeletVersion specifies the minimum version of kubelet which kubeadm supports
|
// MinimumKubeletVersion specifies the minimum version of kubelet which kubeadm supports
|
||||||
MinimumKubeletVersion = version.MustParseSemantic("v1.11.0")
|
MinimumKubeletVersion = version.MustParseSemantic("v1.11.0")
|
||||||
|
|
||||||
// SupportedEtcdVersion lists officially supported etcd versions with corresponding kubernetes releases
|
// SupportedEtcdVersion lists officially supported etcd versions with corresponding Kubernetes releases
|
||||||
SupportedEtcdVersion = map[uint8]string{
|
SupportedEtcdVersion = map[uint8]string{
|
||||||
10: "3.1.12",
|
10: "3.1.12",
|
||||||
11: "3.2.18",
|
11: "3.2.18",
|
||||||
@ -364,7 +364,7 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// EtcdSupportedVersion returns officially supported version of etcd for a specific kubernetes release
|
// EtcdSupportedVersion returns officially supported version of etcd for a specific Kubernetes release
|
||||||
// if passed version is not listed, the function returns nil and an error
|
// if passed version is not listed, the function returns nil and an error
|
||||||
func EtcdSupportedVersion(versionString string) (*version.Version, error) {
|
func EtcdSupportedVersion(versionString string) (*version.Version, error) {
|
||||||
kubernetesVersion, err := version.ParseSemantic(versionString)
|
kubernetesVersion, err := version.ParseSemantic(versionString)
|
||||||
@ -379,7 +379,7 @@ func EtcdSupportedVersion(versionString string) (*version.Version, error) {
|
|||||||
}
|
}
|
||||||
return etcdVersion, nil
|
return etcdVersion, nil
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("Unsupported or unknown kubernetes version(%v)", kubernetesVersion)
|
return nil, fmt.Errorf("Unsupported or unknown Kubernetes version(%v)", kubernetesVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetStaticPodDirectory returns the location on the disk where the Static Pod should be present
|
// GetStaticPodDirectory returns the location on the disk where the Static Pod should be present
|
||||||
|
@ -151,7 +151,7 @@ func TestEtcdSupportedVersion(t *testing.T) {
|
|||||||
{
|
{
|
||||||
kubernetesVersion: "1.99.0",
|
kubernetesVersion: "1.99.0",
|
||||||
expectedVersion: nil,
|
expectedVersion: nil,
|
||||||
expectedError: fmt.Errorf("Unsupported or unknown kubernetes version(1.99.0)"),
|
expectedError: fmt.Errorf("Unsupported or unknown Kubernetes version(1.99.0)"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
kubernetesVersion: "1.10.0",
|
kubernetesVersion: "1.10.0",
|
||||||
|
@ -32,7 +32,7 @@ import (
|
|||||||
// TokenUser defines token user
|
// TokenUser defines token user
|
||||||
const TokenUser = "tls-bootstrap-token-user"
|
const TokenUser = "tls-bootstrap-token-user"
|
||||||
|
|
||||||
// For returns a KubeConfig object that can be used for doing the TLS Bootstrap with the right credentials
|
// For returns a kubeconfig object that can be used for doing the TLS Bootstrap with the right credentials
|
||||||
// Also, before returning anything, it makes sure it can trust the API Server
|
// Also, before returning anything, it makes sure it can trust the API Server
|
||||||
func For(cfg *kubeadmapi.JoinConfiguration) (*clientcmdapi.Config, error) {
|
func For(cfg *kubeadmapi.JoinConfiguration) (*clientcmdapi.Config, error) {
|
||||||
// TODO: Print summary info about the CA certificate, along with the checksum signature
|
// TODO: Print summary info about the CA certificate, along with the checksum signature
|
||||||
|
@ -21,7 +21,6 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -53,7 +52,7 @@ func ValidateConfigInfo(config *clientcmdapi.Config, clustername string) (*clien
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the cluster object we've got from the cluster-info KubeConfig file
|
// This is the cluster object we've got from the cluster-info kubeconfig file
|
||||||
defaultCluster := kubeconfigutil.GetClusterFromKubeConfig(config)
|
defaultCluster := kubeconfigutil.GetClusterFromKubeConfig(config)
|
||||||
|
|
||||||
// Create a new kubeconfig object from the given, just copy over the server and the CA cert
|
// Create a new kubeconfig object from the given, just copy over the server and the CA cert
|
||||||
@ -153,14 +152,14 @@ func tryParseClusterInfoFromConfigMap(cm *v1.ConfigMap) (*clientcmdapi.Config, e
|
|||||||
return parsedKubeConfig, nil
|
return parsedKubeConfig, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// validateKubeConfig makes sure the user-provided KubeConfig file is valid
|
// validateKubeConfig makes sure the user-provided kubeconfig file is valid
|
||||||
func validateKubeConfig(config *clientcmdapi.Config) error {
|
func validateKubeConfig(config *clientcmdapi.Config) error {
|
||||||
if len(config.Clusters) < 1 {
|
if len(config.Clusters) < 1 {
|
||||||
return errors.New("the provided cluster-info KubeConfig file must have at least one Cluster defined")
|
return errors.New("the provided cluster-info kubeconfig file must have at least one Cluster defined")
|
||||||
}
|
}
|
||||||
defaultCluster := kubeconfigutil.GetClusterFromKubeConfig(config)
|
defaultCluster := kubeconfigutil.GetClusterFromKubeConfig(config)
|
||||||
if defaultCluster == nil {
|
if defaultCluster == nil {
|
||||||
return errors.New("the provided cluster-info KubeConfig file must have an unnamed Cluster or a CurrentContext that specifies a non-nil Cluster")
|
return errors.New("the provided cluster-info kubeconfig file must have an unnamed Cluster or a CurrentContext that specifies a non-nil Cluster")
|
||||||
}
|
}
|
||||||
return clientcmd.Validate(*config)
|
return clientcmd.Validate(*config)
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ func RetrieveValidatedConfigInfo(cfg *kubeadmapi.JoinConfiguration) (*clientcmda
|
|||||||
return baseKubeConfig, nil
|
return baseKubeConfig, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// buildInsecureBootstrapKubeConfig makes a KubeConfig object that connects insecurely to the API Server for bootstrapping purposes
|
// buildInsecureBootstrapKubeConfig makes a kubeconfig object that connects insecurely to the API Server for bootstrapping purposes
|
||||||
func buildInsecureBootstrapKubeConfig(endpoint, clustername string) *clientcmdapi.Config {
|
func buildInsecureBootstrapKubeConfig(endpoint, clustername string) *clientcmdapi.Config {
|
||||||
masterEndpoint := fmt.Sprintf("https://%s", endpoint)
|
masterEndpoint := fmt.Sprintf("https://%s", endpoint)
|
||||||
bootstrapConfig := kubeconfigutil.CreateBasic(masterEndpoint, clustername, BootstrapUser, []byte{})
|
bootstrapConfig := kubeconfigutil.CreateBasic(masterEndpoint, clustername, BootstrapUser, []byte{})
|
||||||
@ -177,7 +177,7 @@ func buildInsecureBootstrapKubeConfig(endpoint, clustername string) *clientcmdap
|
|||||||
return bootstrapConfig
|
return bootstrapConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// buildSecureBootstrapKubeConfig makes a KubeConfig object that connects securely to the API Server for bootstrapping purposes (validating with the specified CA)
|
// buildSecureBootstrapKubeConfig makes a kubeconfig object that connects securely to the API Server for bootstrapping purposes (validating with the specified CA)
|
||||||
func buildSecureBootstrapKubeConfig(endpoint string, caCert []byte, clustername string) *clientcmdapi.Config {
|
func buildSecureBootstrapKubeConfig(endpoint string, caCert []byte, clustername string) *clientcmdapi.Config {
|
||||||
masterEndpoint := fmt.Sprintf("https://%s", endpoint)
|
masterEndpoint := fmt.Sprintf("https://%s", endpoint)
|
||||||
bootstrapConfig := kubeconfigutil.CreateBasic(masterEndpoint, clustername, BootstrapUser, caCert)
|
bootstrapConfig := kubeconfigutil.CreateBasic(masterEndpoint, clustername, BootstrapUser, caCert)
|
||||||
|
@ -74,7 +74,7 @@ type Feature struct {
|
|||||||
// FeatureList represents a list of feature gates
|
// FeatureList represents a list of feature gates
|
||||||
type FeatureList map[string]Feature
|
type FeatureList map[string]Feature
|
||||||
|
|
||||||
// ValidateVersion ensures that a feature gate list is compatible with the chosen kubernetes version
|
// ValidateVersion ensures that a feature gate list is compatible with the chosen Kubernetes version
|
||||||
func ValidateVersion(allFeatures FeatureList, requestedFeatures map[string]bool, requestedVersion string) error {
|
func ValidateVersion(allFeatures FeatureList, requestedFeatures map[string]bool, requestedVersion string) error {
|
||||||
if requestedVersion == "" {
|
if requestedVersion == "" {
|
||||||
return nil
|
return nil
|
||||||
@ -87,7 +87,7 @@ func ValidateVersion(allFeatures FeatureList, requestedFeatures map[string]bool,
|
|||||||
if minVersion := allFeatures[k].MinimumVersion; minVersion != nil {
|
if minVersion := allFeatures[k].MinimumVersion; minVersion != nil {
|
||||||
if !parsedExpVersion.AtLeast(minVersion) {
|
if !parsedExpVersion.AtLeast(minVersion) {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"the requested kubernetes version (%s) is incompatible with the %s feature gate, which needs %s as a minimum",
|
"the requested Kubernetes version (%s) is incompatible with the %s feature gate, which needs %s as a minimum",
|
||||||
requestedVersion, k, minVersion)
|
requestedVersion, k, minVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,16 +236,16 @@ var (
|
|||||||
// KubeadmCertRootCA is the definition of the Kubernetes Root CA for the API Server and kubelet.
|
// KubeadmCertRootCA is the definition of the Kubernetes Root CA for the API Server and kubelet.
|
||||||
KubeadmCertRootCA = KubeadmCert{
|
KubeadmCertRootCA = KubeadmCert{
|
||||||
Name: "ca",
|
Name: "ca",
|
||||||
LongName: "self-signed kubernetes CA to provision identities for other kuberenets components",
|
LongName: "self-signed Kubernetes CA to provision identities for other Kubernets components",
|
||||||
BaseName: kubeadmconstants.CACertAndKeyBaseName,
|
BaseName: kubeadmconstants.CACertAndKeyBaseName,
|
||||||
config: certutil.Config{
|
config: certutil.Config{
|
||||||
CommonName: "kubernetes",
|
CommonName: "kubernetes",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// KubeadmCertAPIServer is the definition of the cert used to serve the kubernetes API.
|
// KubeadmCertAPIServer is the definition of the cert used to serve the Kubernetes API.
|
||||||
KubeadmCertAPIServer = KubeadmCert{
|
KubeadmCertAPIServer = KubeadmCert{
|
||||||
Name: "apiserver",
|
Name: "apiserver",
|
||||||
LongName: "certificate for serving the kubernetes API",
|
LongName: "certificate for serving the Kubernetes API",
|
||||||
BaseName: kubeadmconstants.APIServerCertAndKeyBaseName,
|
BaseName: kubeadmconstants.APIServerCertAndKeyBaseName,
|
||||||
CAName: "ca",
|
CAName: "ca",
|
||||||
config: certutil.Config{
|
config: certutil.Config{
|
||||||
|
@ -26,8 +26,8 @@ package certs
|
|||||||
.APIServerCertSANs is an optional parameter for adding DNS names and IPs to the API Server serving cert SAN
|
.APIServerCertSANs is an optional parameter for adding DNS names and IPs to the API Server serving cert SAN
|
||||||
.Etcd.Local.ServerCertSANs is an optional parameter for adding DNS names and IPs to the etcd serving cert SAN
|
.Etcd.Local.ServerCertSANs is an optional parameter for adding DNS names and IPs to the etcd serving cert SAN
|
||||||
.Etcd.Local.PeerCertSANs is an optional parameter for adding DNS names and IPs to the etcd peer cert SAN
|
.Etcd.Local.PeerCertSANs is an optional parameter for adding DNS names and IPs to the etcd peer cert SAN
|
||||||
.Networking.DNSDomain is needed for knowing which DNS name the internal kubernetes service has
|
.Networking.DNSDomain is needed for knowing which DNS name the internal Kubernetes service has
|
||||||
.Networking.ServiceSubnet is needed for knowing which IP the internal kubernetes service is going to point to
|
.Networking.ServiceSubnet is needed for knowing which IP the internal Kubernetes service is going to point to
|
||||||
.CertificatesDir is required for knowing where all certificates should be stored
|
.CertificatesDir is required for knowing where all certificates should be stored
|
||||||
|
|
||||||
OUTPUTS:
|
OUTPUTS:
|
||||||
|
@ -22,8 +22,8 @@ package kubeconfig
|
|||||||
|
|
||||||
INPUTS:
|
INPUTS:
|
||||||
From InitConfiguration
|
From InitConfiguration
|
||||||
The Master API Server endpoint (AdvertiseAddress + BindPort) is required so the KubeConfig file knows where to find the master
|
The Master API Server endpoint (AdvertiseAddress + BindPort) is required so the kubeconfig file knows where to find the master
|
||||||
The KubernetesDir path is required for knowing where to put the KubeConfig files
|
The KubernetesDir path is required for knowing where to put the kubeconfig files
|
||||||
The PKIPath is required for knowing where all certificates should be stored
|
The PKIPath is required for knowing where all certificates should be stored
|
||||||
|
|
||||||
OUTPUTS:
|
OUTPUTS:
|
||||||
|
@ -116,7 +116,7 @@ func createKubeConfigFiles(outDir string, cfg *kubeadmapi.InitConfiguration, kub
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// writes the KubeConfig to disk if it not exists
|
// writes the kubeconfig to disk if it not exists
|
||||||
if err = createKubeConfigFileIfNotExists(outDir, kubeConfigFileName, config); err != nil {
|
if err = createKubeConfigFileIfNotExists(outDir, kubeConfigFileName, config); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ func buildKubeConfigFromSpec(spec *kubeConfigSpec, clustername string) (*clientc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// createKubeConfigFileIfNotExists saves the KubeConfig object into a file if there isn't any file at the given path.
|
// createKubeConfigFileIfNotExists saves the KubeConfig object into a file if there isn't any file at the given path.
|
||||||
// If there already is a KubeConfig file at the given path; kubeadm tries to load it and check if the values in the
|
// If there already is a kubeconfig file at the given path; kubeadm tries to load it and check if the values in the
|
||||||
// existing and the expected config equals. If they do; kubeadm will just skip writing the file as it's up-to-date,
|
// existing and the expected config equals. If they do; kubeadm will just skip writing the file as it's up-to-date,
|
||||||
// but if a file exists but has old content or isn't a kubeconfig file, this function returns an error.
|
// but if a file exists but has old content or isn't a kubeconfig file, this function returns an error.
|
||||||
func createKubeConfigFileIfNotExists(outDir, filename string, config *clientcmdapi.Config) error {
|
func createKubeConfigFileIfNotExists(outDir, filename string, config *clientcmdapi.Config) error {
|
||||||
@ -257,7 +257,7 @@ func createKubeConfigFileIfNotExists(outDir, filename string, config *clientcmda
|
|||||||
// kubeadm doesn't validate the existing kubeconfig file more than this (kubeadm trusts the client certs to be valid)
|
// kubeadm doesn't validate the existing kubeconfig file more than this (kubeadm trusts the client certs to be valid)
|
||||||
// Basically, if we find a kubeconfig file with the same path; the same CA cert and the same server URL;
|
// Basically, if we find a kubeconfig file with the same path; the same CA cert and the same server URL;
|
||||||
// kubeadm thinks those files are equal and doesn't bother writing a new file
|
// kubeadm thinks those files are equal and doesn't bother writing a new file
|
||||||
fmt.Printf("[kubeconfig] Using existing up-to-date KubeConfig file: %q\n", kubeConfigFilePath)
|
fmt.Printf("[kubeconfig] Using existing up-to-date kubeconfig file: %q\n", kubeConfigFilePath)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ func writeKubeConfigFromSpec(out io.Writer, spec *kubeConfigSpec, clustername st
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// writes the KubeConfig to disk if it not exists
|
// writes the kubeconfig to disk if it not exists
|
||||||
configBytes, err := clientcmd.Write(*config)
|
configBytes, err := clientcmd.Write(*config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failure while serializing admin kubeconfig")
|
return errors.Wrap(err, "failure while serializing admin kubeconfig")
|
||||||
|
@ -249,7 +249,7 @@ func TestCreateKubeConfigFileIfNotExists(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes the KubeConfig file to disk
|
// Writes the kubeconfig file to disk
|
||||||
err := createKubeConfigFileIfNotExists(tmpdir, "test.conf", test.kubeConfig)
|
err := createKubeConfigFileIfNotExists(tmpdir, "test.conf", test.kubeConfig)
|
||||||
if test.expectedError && err == nil {
|
if test.expectedError && err == nil {
|
||||||
t.Errorf("createKubeConfigFileIfNotExists didn't failed when expected to fail")
|
t.Errorf("createKubeConfigFileIfNotExists didn't failed when expected to fail")
|
||||||
|
@ -302,7 +302,7 @@ func minorUpgradePossibleWithPatchRelease(stableVersion, patchVersion *versionut
|
|||||||
func getSuggestedEtcdVersion(kubernetesVersion string) string {
|
func getSuggestedEtcdVersion(kubernetesVersion string) string {
|
||||||
etcdVersion, err := kubeadmconstants.EtcdSupportedVersion(kubernetesVersion)
|
etcdVersion, err := kubeadmconstants.EtcdSupportedVersion(kubernetesVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("[upgrade/versions] WARNING: No recommended etcd for requested kubernetes version (%s)\n", kubernetesVersion)
|
fmt.Printf("[upgrade/versions] WARNING: No recommended etcd for requested Kubernetes version (%s)\n", kubernetesVersion)
|
||||||
return "N/A"
|
return "N/A"
|
||||||
}
|
}
|
||||||
return etcdVersion.String()
|
return etcdVersion.String()
|
||||||
|
@ -732,7 +732,7 @@ func TestGetAvailableUpgrades(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Instantiating a fake etcd cluster for being able to get etcd version for a corresponding
|
// Instantiating a fake etcd cluster for being able to get etcd version for a corresponding
|
||||||
// kubernetes release.
|
// Kubernetes release.
|
||||||
for _, rt := range tests {
|
for _, rt := range tests {
|
||||||
t.Run(rt.name, func(t *testing.T) {
|
t.Run(rt.name, func(t *testing.T) {
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ func performEtcdStaticPodUpgrade(client clientset.Interface, waiter apiclient.Wa
|
|||||||
// Need to check currently used version and version from constants, if differs then upgrade
|
// Need to check currently used version and version from constants, if differs then upgrade
|
||||||
desiredEtcdVersion, err := constants.EtcdSupportedVersion(cfg.KubernetesVersion)
|
desiredEtcdVersion, err := constants.EtcdSupportedVersion(cfg.KubernetesVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return true, errors.Wrap(err, "failed to retrieve an etcd version for the target kubernetes version")
|
return true, errors.Wrap(err, "failed to retrieve an etcd version for the target Kubernetes version")
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets the etcd version of the local/stacked etcd member running on the current machine
|
// gets the etcd version of the local/stacked etcd member running on the current machine
|
||||||
|
@ -557,7 +557,7 @@ func (sysver SystemVerificationCheck) Check() (warnings, errors []error) {
|
|||||||
return warns, nil
|
return warns, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// KubernetesVersionCheck validates kubernetes and kubeadm versions
|
// KubernetesVersionCheck validates Kubernetes and kubeadm versions
|
||||||
type KubernetesVersionCheck struct {
|
type KubernetesVersionCheck struct {
|
||||||
KubeadmVersion string
|
KubeadmVersion string
|
||||||
KubernetesVersion string
|
KubernetesVersion string
|
||||||
@ -568,9 +568,9 @@ func (KubernetesVersionCheck) Name() string {
|
|||||||
return "KubernetesVersion"
|
return "KubernetesVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check validates kubernetes and kubeadm versions
|
// Check validates Kubernetes and kubeadm versions
|
||||||
func (kubever KubernetesVersionCheck) Check() (warnings, errors []error) {
|
func (kubever KubernetesVersionCheck) Check() (warnings, errors []error) {
|
||||||
glog.V(1).Infoln("validating kubernetes and kubeadm version")
|
glog.V(1).Infoln("validating Kubernetes and kubeadm version")
|
||||||
// Skip this check for "super-custom builds", where apimachinery/the overall codebase version is not set.
|
// Skip this check for "super-custom builds", where apimachinery/the overall codebase version is not set.
|
||||||
if strings.HasPrefix(kubever.KubeadmVersion, "v0.0.0") {
|
if strings.HasPrefix(kubever.KubeadmVersion, "v0.0.0") {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@ -583,7 +583,7 @@ func (kubever KubernetesVersionCheck) Check() (warnings, errors []error) {
|
|||||||
|
|
||||||
k8sVersion, err := versionutil.ParseSemantic(kubever.KubernetesVersion)
|
k8sVersion, err := versionutil.ParseSemantic(kubever.KubernetesVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, []error{fmt.Errorf("couldn't parse kubernetes version %q: %v", kubever.KubernetesVersion, err)}
|
return nil, []error{fmt.Errorf("couldn't parse Kubernetes version %q: %v", kubever.KubernetesVersion, err)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if k8sVersion greater or equal than the first unsupported versions by current version of kubeadm,
|
// Checks if k8sVersion greater or equal than the first unsupported versions by current version of kubeadm,
|
||||||
@ -592,7 +592,7 @@ func (kubever KubernetesVersionCheck) Check() (warnings, errors []error) {
|
|||||||
// thus setting the value to x.y.0-0 we are defining the very first patch - prereleases within x.y minor release.
|
// thus setting the value to x.y.0-0 we are defining the very first patch - prereleases within x.y minor release.
|
||||||
firstUnsupportedVersion := versionutil.MustParseSemantic(fmt.Sprintf("%d.%d.%s", kadmVersion.Major(), kadmVersion.Minor()+1, "0-0"))
|
firstUnsupportedVersion := versionutil.MustParseSemantic(fmt.Sprintf("%d.%d.%s", kadmVersion.Major(), kadmVersion.Minor()+1, "0-0"))
|
||||||
if k8sVersion.AtLeast(firstUnsupportedVersion) {
|
if k8sVersion.AtLeast(firstUnsupportedVersion) {
|
||||||
return []error{fmt.Errorf("kubernetes version is greater than kubeadm version. Please consider to upgrade kubeadm. kubernetes version: %s. Kubeadm version: %d.%d.x", k8sVersion, kadmVersion.Components()[0], kadmVersion.Components()[1])}, nil
|
return []error{fmt.Errorf("Kubernetes version is greater than kubeadm version. Please consider to upgrade kubeadm. Kubernetes version: %s. Kubeadm version: %d.%d.x", k8sVersion, kadmVersion.Components()[0], kadmVersion.Components()[1])}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@ -623,7 +623,7 @@ func (kubever KubeletVersionCheck) Check() (warnings, errors []error) {
|
|||||||
if kubever.KubernetesVersion != "" {
|
if kubever.KubernetesVersion != "" {
|
||||||
k8sVersion, err := versionutil.ParseSemantic(kubever.KubernetesVersion)
|
k8sVersion, err := versionutil.ParseSemantic(kubever.KubernetesVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, []error{fmt.Errorf("couldn't parse kubernetes version %q: %v", kubever.KubernetesVersion, err)}
|
return nil, []error{fmt.Errorf("couldn't parse Kubernetes version %q: %v", kubever.KubernetesVersion, err)}
|
||||||
}
|
}
|
||||||
if kubeletVersion.Major() > k8sVersion.Major() || kubeletVersion.Minor() > k8sVersion.Minor() {
|
if kubeletVersion.Major() > k8sVersion.Major() || kubeletVersion.Minor() > k8sVersion.Minor() {
|
||||||
return nil, []error{fmt.Errorf("the kubelet version is higher than the control plane version. This is not a supported version skew and may lead to a malfunctional cluster. Kubelet version: %q Control plane version: %q", kubeletVersion, k8sVersion)}
|
return nil, []error{fmt.Errorf("the kubelet version is higher than the control plane version. This is not a supported version skew and may lead to a malfunctional cluster. Kubelet version: %q Control plane version: %q", kubeletVersion, k8sVersion)}
|
||||||
|
@ -673,13 +673,13 @@ func TestKubeletVersionCheck(t *testing.T) {
|
|||||||
|
|
||||||
switch {
|
switch {
|
||||||
case warnings != nil && !tc.expectWarnings:
|
case warnings != nil && !tc.expectWarnings:
|
||||||
t.Errorf("KubeletVersionCheck: unexpected warnings for kubelet version %q and kubernetes version %q. Warnings: %v", tc.kubeletVersion, tc.k8sVersion, warnings)
|
t.Errorf("KubeletVersionCheck: unexpected warnings for kubelet version %q and Kubernetes version %q. Warnings: %v", tc.kubeletVersion, tc.k8sVersion, warnings)
|
||||||
case warnings == nil && tc.expectWarnings:
|
case warnings == nil && tc.expectWarnings:
|
||||||
t.Errorf("KubeletVersionCheck: expected warnings for kubelet version %q and kubernetes version %q but got nothing", tc.kubeletVersion, tc.k8sVersion)
|
t.Errorf("KubeletVersionCheck: expected warnings for kubelet version %q and Kubernetes version %q but got nothing", tc.kubeletVersion, tc.k8sVersion)
|
||||||
case errors != nil && !tc.expectErrors:
|
case errors != nil && !tc.expectErrors:
|
||||||
t.Errorf("KubeletVersionCheck: unexpected errors for kubelet version %q and kubernetes version %q. errors: %v", tc.kubeletVersion, tc.k8sVersion, errors)
|
t.Errorf("KubeletVersionCheck: unexpected errors for kubelet version %q and Kubernetes version %q. errors: %v", tc.kubeletVersion, tc.k8sVersion, errors)
|
||||||
case errors == nil && tc.expectErrors:
|
case errors == nil && tc.expectErrors:
|
||||||
t.Errorf("KubeletVersionCheck: expected errors for kubelet version %q and kubernetes version %q but got nothing", tc.kubeletVersion, tc.k8sVersion)
|
t.Errorf("KubeletVersionCheck: expected errors for kubelet version %q and Kubernetes version %q but got nothing", tc.kubeletVersion, tc.k8sVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ func (idr *InitDryRunGetter) HandleListAction(action core.ListAction) (bool, run
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handleKubernetesService returns a faked Kubernetes service in order to be able to continue running kubeadm init.
|
// handleKubernetesService returns a faked Kubernetes service in order to be able to continue running kubeadm init.
|
||||||
// The kube-dns addon code GETs the kubernetes service in order to extract the service subnet
|
// The kube-dns addon code GETs the Kubernetes service in order to extract the service subnet
|
||||||
func (idr *InitDryRunGetter) handleKubernetesService(action core.GetAction) (bool, runtime.Object, error) {
|
func (idr *InitDryRunGetter) handleKubernetesService(action core.GetAction) (bool, runtime.Object, error) {
|
||||||
if action.GetName() != "kubernetes" || action.GetNamespace() != metav1.NamespaceDefault || action.GetResource().Resource != "services" {
|
if action.GetName() != "kubernetes" || action.GetNamespace() != metav1.NamespaceDefault || action.GetResource().Resource != "services" {
|
||||||
// We can't handle this event
|
// We can't handle this event
|
||||||
|
@ -128,7 +128,7 @@ func NormalizeKubernetesVersion(cfg *kubeadmapi.ClusterConfiguration) error {
|
|||||||
// Parse the given kubernetes version and make sure it's higher than the lowest supported
|
// Parse the given kubernetes version and make sure it's higher than the lowest supported
|
||||||
k8sVersion, err := version.ParseSemantic(cfg.KubernetesVersion)
|
k8sVersion, err := version.ParseSemantic(cfg.KubernetesVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "couldn't parse kubernetes version %q", cfg.KubernetesVersion)
|
return errors.Wrapf(err, "couldn't parse Kubernetes version %q", cfg.KubernetesVersion)
|
||||||
}
|
}
|
||||||
if k8sVersion.LessThan(constants.MinimumControlPlaneVersion) {
|
if k8sVersion.LessThan(constants.MinimumControlPlaneVersion) {
|
||||||
return errors.Errorf("this version of kubeadm only supports deploying clusters with the control plane version >= %s. Current version: %s", constants.MinimumControlPlaneVersion.String(), cfg.KubernetesVersion)
|
return errors.Errorf("this version of kubeadm only supports deploying clusters with the control plane version >= %s. Current version: %s", constants.MinimumControlPlaneVersion.String(), cfg.KubernetesVersion)
|
||||||
|
@ -68,7 +68,7 @@ func CreateWithToken(serverURL, clusterName, userName string, caCert []byte, tok
|
|||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClientSetFromFile returns a ready-to-use client from a KubeConfig file
|
// ClientSetFromFile returns a ready-to-use client from a kubeconfig file
|
||||||
func ClientSetFromFile(path string) (*clientset.Clientset, error) {
|
func ClientSetFromFile(path string) (*clientset.Clientset, error) {
|
||||||
config, err := clientcmd.LoadFromFile(path)
|
config, err := clientcmd.LoadFromFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user