mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
autogenerated move to reference the v1alpha2 API inside of kubeadm
This commit is contained in:
parent
96d2bbb450
commit
e28242a245
@ -30,7 +30,7 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
||||||
@ -129,7 +129,7 @@ func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Co
|
|||||||
|
|
||||||
// The default configuration is empty; everything should come from the file on disk
|
// The default configuration is empty; everything should come from the file on disk
|
||||||
glog.V(1).Infoln("[config] creating empty default configuration")
|
glog.V(1).Infoln("[config] creating empty default configuration")
|
||||||
defaultcfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
defaultcfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
// Upload the configuration using the file; don't care about the defaultcfg really
|
// Upload the configuration using the file; don't care about the defaultcfg really
|
||||||
glog.V(1).Infof("[config] uploading configuration")
|
glog.V(1).Infof("[config] uploading configuration")
|
||||||
err = uploadConfiguration(client, cfgPath, defaultcfg)
|
err = uploadConfiguration(client, cfgPath, defaultcfg)
|
||||||
@ -142,7 +142,7 @@ func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Co
|
|||||||
|
|
||||||
// NewCmdConfigUploadFromFlags returns cobra.Command for "kubeadm config upload from-flags" command
|
// NewCmdConfigUploadFromFlags returns cobra.Command for "kubeadm config upload from-flags" command
|
||||||
func NewCmdConfigUploadFromFlags(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
func NewCmdConfigUploadFromFlags(out io.Writer, kubeConfigFile *string) *cobra.Command {
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
kubeadmscheme.Scheme.Default(cfg)
|
kubeadmscheme.Scheme.Default(cfg)
|
||||||
|
|
||||||
var featureGatesString string
|
var featureGatesString string
|
||||||
@ -192,7 +192,7 @@ func RunConfigView(out io.Writer, client clientset.Interface) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// uploadConfiguration handles the uploading of the configuration internally
|
// uploadConfiguration handles the uploading of the configuration internally
|
||||||
func uploadConfiguration(client clientset.Interface, cfgPath string, defaultcfg *kubeadmapiv1alpha1.MasterConfiguration) error {
|
func uploadConfiguration(client clientset.Interface, cfgPath string, defaultcfg *kubeadmapiv1alpha2.MasterConfiguration) error {
|
||||||
|
|
||||||
// Default both statically and dynamically, convert to internal API type, and validate everything
|
// Default both statically and dynamically, convert to internal API type, and validate everything
|
||||||
// First argument is unset here as we shouldn't load a config file from disk
|
// First argument is unset here as we shouldn't load a config file from disk
|
||||||
@ -219,8 +219,8 @@ func NewCmdConfigImages(out io.Writer) *cobra.Command {
|
|||||||
|
|
||||||
// NewCmdConfigImagesList returns the "config images list" command
|
// NewCmdConfigImagesList returns the "config images list" command
|
||||||
func NewCmdConfigImagesList(out io.Writer) *cobra.Command {
|
func NewCmdConfigImagesList(out io.Writer) *cobra.Command {
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
kubeadmapiv1alpha1.SetDefaults_MasterConfiguration(cfg)
|
kubeadmapiv1alpha2.SetDefaults_MasterConfiguration(cfg)
|
||||||
var cfgPath, featureGatesString string
|
var cfgPath, featureGatesString string
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ func NewCmdConfigImagesList(out io.Writer) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewImagesList returns the underlying struct for the "kubeadm config images list" command
|
// NewImagesList returns the underlying struct for the "kubeadm config images list" command
|
||||||
func NewImagesList(cfgPath string, cfg *kubeadmapiv1alpha1.MasterConfiguration) (*ImagesList, error) {
|
func NewImagesList(cfgPath string, cfg *kubeadmapiv1alpha2.MasterConfiguration) (*ImagesList, error) {
|
||||||
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg)
|
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not convert cfg to an internal cfg: %v", err)
|
return nil, fmt.Errorf("could not convert cfg to an internal cfg: %v", err)
|
||||||
@ -270,7 +270,7 @@ func (i *ImagesList) Run(out io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddImagesListConfigFlags adds the flags that configure kubeadm (and affect the images kubeadm will use)
|
// AddImagesListConfigFlags adds the flags that configure kubeadm (and affect the images kubeadm will use)
|
||||||
func AddImagesListConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha1.MasterConfiguration, featureGatesString *string) {
|
func AddImagesListConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha2.MasterConfiguration, featureGatesString *string) {
|
||||||
flagSet.StringVar(
|
flagSet.StringVar(
|
||||||
&cfg.KubernetesVersion, "kubernetes-version", cfg.KubernetesVersion,
|
&cfg.KubernetesVersion, "kubernetes-version", cfg.KubernetesVersion,
|
||||||
`Choose a specific Kubernetes version for the control plane.`,
|
`Choose a specific Kubernetes version for the control plane.`,
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
|
|
||||||
"github.com/renstrom/dedent"
|
"github.com/renstrom/dedent"
|
||||||
|
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd"
|
"k8s.io/kubernetes/cmd/kubeadm/app/cmd"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
||||||
)
|
)
|
||||||
@ -65,7 +65,7 @@ func TestImagesListRunWithCustomConfigPath(t *testing.T) {
|
|||||||
":v1.9.1",
|
":v1.9.1",
|
||||||
},
|
},
|
||||||
configContents: []byte(dedent.Dedent(`
|
configContents: []byte(dedent.Dedent(`
|
||||||
apiVersion: kubeadm.k8s.io/v1alpha1
|
apiVersion: kubeadm.k8s.io/v1alpha2
|
||||||
kind: MasterConfiguration
|
kind: MasterConfiguration
|
||||||
kubernetesVersion: 1.9.1
|
kubernetesVersion: 1.9.1
|
||||||
`)),
|
`)),
|
||||||
@ -77,7 +77,7 @@ func TestImagesListRunWithCustomConfigPath(t *testing.T) {
|
|||||||
"coredns",
|
"coredns",
|
||||||
},
|
},
|
||||||
configContents: []byte(dedent.Dedent(`
|
configContents: []byte(dedent.Dedent(`
|
||||||
apiVersion: kubeadm.k8s.io/v1alpha1
|
apiVersion: kubeadm.k8s.io/v1alpha2
|
||||||
kind: MasterConfiguration
|
kind: MasterConfiguration
|
||||||
featureGates:
|
featureGates:
|
||||||
CoreDNS: True
|
CoreDNS: True
|
||||||
@ -99,7 +99,7 @@ func TestImagesListRunWithCustomConfigPath(t *testing.T) {
|
|||||||
t.Fatalf("Failed writing a config file: %v", err)
|
t.Fatalf("Failed writing a config file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
i, err := cmd.NewImagesList(configFilePath, &kubeadmapiv1alpha1.MasterConfiguration{})
|
i, err := cmd.NewImagesList(configFilePath, &kubeadmapiv1alpha2.MasterConfiguration{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed getting the kubeadm images command: %v", err)
|
t.Fatalf("Failed getting the kubeadm images command: %v", err)
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ func TestImagesListRunWithCustomConfigPath(t *testing.T) {
|
|||||||
func TestConfigImagesListRunWithoutPath(t *testing.T) {
|
func TestConfigImagesListRunWithoutPath(t *testing.T) {
|
||||||
testcases := []struct {
|
testcases := []struct {
|
||||||
name string
|
name string
|
||||||
cfg kubeadmapiv1alpha1.MasterConfiguration
|
cfg kubeadmapiv1alpha2.MasterConfiguration
|
||||||
expectedImages int
|
expectedImages int
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
@ -133,8 +133,8 @@ func TestConfigImagesListRunWithoutPath(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "external etcd configuration",
|
name: "external etcd configuration",
|
||||||
cfg: kubeadmapiv1alpha1.MasterConfiguration{
|
cfg: kubeadmapiv1alpha2.MasterConfiguration{
|
||||||
Etcd: kubeadmapiv1alpha1.Etcd{
|
Etcd: kubeadmapiv1alpha2.Etcd{
|
||||||
Endpoints: []string{"hi"},
|
Endpoints: []string{"hi"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -142,7 +142,7 @@ func TestConfigImagesListRunWithoutPath(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "coredns enabled",
|
name: "coredns enabled",
|
||||||
cfg: kubeadmapiv1alpha1.MasterConfiguration{
|
cfg: kubeadmapiv1alpha2.MasterConfiguration{
|
||||||
FeatureGates: map[string]bool{
|
FeatureGates: map[string]bool{
|
||||||
features.CoreDNS: true,
|
features.CoreDNS: true,
|
||||||
},
|
},
|
||||||
|
@ -36,7 +36,7 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
@ -114,7 +114,7 @@ var (
|
|||||||
|
|
||||||
// NewCmdInit returns "kubeadm init" command.
|
// NewCmdInit returns "kubeadm init" command.
|
||||||
func NewCmdInit(out io.Writer) *cobra.Command {
|
func NewCmdInit(out io.Writer) *cobra.Command {
|
||||||
externalcfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
externalcfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
kubeadmscheme.Scheme.Default(externalcfg)
|
kubeadmscheme.Scheme.Default(externalcfg)
|
||||||
|
|
||||||
var cfgPath string
|
var cfgPath string
|
||||||
@ -155,7 +155,7 @@ func NewCmdInit(out io.Writer) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddInitConfigFlags adds init flags bound to the config to the specified flagset
|
// AddInitConfigFlags adds init flags bound to the config to the specified flagset
|
||||||
func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha1.MasterConfiguration, featureGatesString *string) {
|
func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha2.MasterConfiguration, featureGatesString *string) {
|
||||||
flagSet.StringVar(
|
flagSet.StringVar(
|
||||||
&cfg.API.AdvertiseAddress, "apiserver-advertise-address", cfg.API.AdvertiseAddress,
|
&cfg.API.AdvertiseAddress, "apiserver-advertise-address", cfg.API.AdvertiseAddress,
|
||||||
"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.",
|
"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.",
|
||||||
@ -238,7 +238,7 @@ func AddInitOtherFlags(flagSet *flag.FlagSet, cfgPath *string, skipPreFlight, sk
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewInit validates given arguments and instantiates Init struct with provided information.
|
// NewInit validates given arguments and instantiates Init struct with provided information.
|
||||||
func NewInit(cfgPath string, externalcfg *kubeadmapiv1alpha1.MasterConfiguration, ignorePreflightErrors sets.String, skipTokenPrint, dryRun bool) (*Init, error) {
|
func NewInit(cfgPath string, externalcfg *kubeadmapiv1alpha2.MasterConfiguration, ignorePreflightErrors sets.String, skipTokenPrint, dryRun bool) (*Init, error) {
|
||||||
|
|
||||||
// Either use the config file if specified, or convert the defaults in the external to an internal cfg representation
|
// Either use the config file if specified, or convert the defaults in the external to an internal cfg representation
|
||||||
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, externalcfg)
|
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, externalcfg)
|
||||||
|
@ -33,7 +33,7 @@ import (
|
|||||||
certutil "k8s.io/client-go/util/cert"
|
certutil "k8s.io/client-go/util/cert"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/discovery"
|
"k8s.io/kubernetes/cmd/kubeadm/app/discovery"
|
||||||
@ -102,7 +102,7 @@ var (
|
|||||||
|
|
||||||
// NewCmdJoin returns "kubeadm join" command.
|
// NewCmdJoin returns "kubeadm join" command.
|
||||||
func NewCmdJoin(out io.Writer) *cobra.Command {
|
func NewCmdJoin(out io.Writer) *cobra.Command {
|
||||||
cfg := &kubeadmapiv1alpha1.NodeConfiguration{}
|
cfg := &kubeadmapiv1alpha2.NodeConfiguration{}
|
||||||
kubeadmscheme.Scheme.Default(cfg)
|
kubeadmscheme.Scheme.Default(cfg)
|
||||||
|
|
||||||
var skipPreFlight bool
|
var skipPreFlight bool
|
||||||
@ -129,7 +129,7 @@ func NewCmdJoin(out io.Writer) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewValidJoin validates the command line that are passed to the cobra command
|
// NewValidJoin validates the command line that are passed to the cobra command
|
||||||
func NewValidJoin(cfg *kubeadmapiv1alpha1.NodeConfiguration, args []string, skipPreFlight bool, cfgPath, featureGatesString string, ignorePreflightErrors []string) (*Join, error) {
|
func NewValidJoin(cfg *kubeadmapiv1alpha2.NodeConfiguration, args []string, skipPreFlight bool, cfgPath, featureGatesString string, ignorePreflightErrors []string) (*Join, error) {
|
||||||
cfg.DiscoveryTokenAPIServers = args
|
cfg.DiscoveryTokenAPIServers = args
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
@ -150,7 +150,7 @@ func NewValidJoin(cfg *kubeadmapiv1alpha1.NodeConfiguration, args []string, skip
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddJoinConfigFlags adds join flags bound to the config to the specified flagset
|
// AddJoinConfigFlags adds join flags bound to the config to the specified flagset
|
||||||
func AddJoinConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha1.NodeConfiguration, featureGatesString *string) {
|
func AddJoinConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha2.NodeConfiguration, featureGatesString *string) {
|
||||||
flagSet.StringVar(
|
flagSet.StringVar(
|
||||||
&cfg.DiscoveryFile, "discovery-file", "",
|
&cfg.DiscoveryFile, "discovery-file", "",
|
||||||
"A file or url from which to load cluster information.")
|
"A file or url from which to load cluster information.")
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -146,7 +146,7 @@ func TestNewValidJoin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
cfg := &kubeadmapiv1alpha1.NodeConfiguration{}
|
cfg := &kubeadmapiv1alpha2.NodeConfiguration{}
|
||||||
kubeadmscheme.Scheme.Default(cfg)
|
kubeadmscheme.Scheme.Default(cfg)
|
||||||
|
|
||||||
errorFormat := "Test case %q: NewValidJoin expected error: %v, saw: %v, error: %v"
|
errorFormat := "Test case %q: NewValidJoin expected error: %v, saw: %v, error: %v"
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
||||||
@ -94,7 +94,7 @@ func EnsureAllAddons(cfg *kubeadmapi.MasterConfiguration, client clientset.Inter
|
|||||||
|
|
||||||
// getAddonsSubCommands returns sub commands for addons phase
|
// getAddonsSubCommands returns sub commands for addons phase
|
||||||
func getAddonsSubCommands() []*cobra.Command {
|
func getAddonsSubCommands() []*cobra.Command {
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
// Default values for the cobra help text
|
// Default values for the cobra help text
|
||||||
kubeadmscheme.Scheme.Default(cfg)
|
kubeadmscheme.Scheme.Default(cfg)
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ func getAddonsSubCommands() []*cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// runAddonsCmdFunc creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
|
// runAddonsCmdFunc creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
|
||||||
func runAddonsCmdFunc(cmdFunc func(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error, cfg *kubeadmapiv1alpha1.MasterConfiguration, kubeConfigFile *string, cfgPath *string, featureGatesString *string) func(cmd *cobra.Command, args []string) {
|
func runAddonsCmdFunc(cmdFunc func(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error, cfg *kubeadmapiv1alpha2.MasterConfiguration, kubeConfigFile *string, cfgPath *string, featureGatesString *string) func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// the following statement build a clousure that wraps a call to a cmdFunc, binding
|
// the following statement build a clousure that wraps a call to a cmdFunc, binding
|
||||||
// the function itself with the specific parameters of each sub command.
|
// the function itself with the specific parameters of each sub command.
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
bootstrapapi "k8s.io/client-go/tools/bootstrap/token/api"
|
bootstrapapi "k8s.io/client-go/tools/bootstrap/token/api"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
@ -108,7 +108,7 @@ func NewCmdBootstrapToken() *cobra.Command {
|
|||||||
|
|
||||||
// NewSubCmdBootstrapTokenAll returns the Cobra command for running the token all sub-phase
|
// NewSubCmdBootstrapTokenAll returns the Cobra command for running the token all sub-phase
|
||||||
func NewSubCmdBootstrapTokenAll(kubeConfigFile *string) *cobra.Command {
|
func NewSubCmdBootstrapTokenAll(kubeConfigFile *string) *cobra.Command {
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{
|
||||||
// KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid
|
// KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid
|
||||||
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
||||||
KubernetesVersion: "v1.9.0",
|
KubernetesVersion: "v1.9.0",
|
||||||
@ -166,7 +166,7 @@ func NewSubCmdBootstrapTokenAll(kubeConfigFile *string) *cobra.Command {
|
|||||||
|
|
||||||
// NewSubCmdBootstrapToken returns the Cobra command for running the create token phase
|
// NewSubCmdBootstrapToken returns the Cobra command for running the create token phase
|
||||||
func NewSubCmdBootstrapToken(kubeConfigFile *string) *cobra.Command {
|
func NewSubCmdBootstrapToken(kubeConfigFile *string) *cobra.Command {
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{
|
||||||
// KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid
|
// KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid
|
||||||
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
||||||
KubernetesVersion: "v1.9.0",
|
KubernetesVersion: "v1.9.0",
|
||||||
@ -278,7 +278,7 @@ func NewSubCmdNodeBootstrapTokenAutoApprove(kubeConfigFile *string) *cobra.Comma
|
|||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func addBootstrapTokenFlags(flagSet *pflag.FlagSet, cfg *kubeadmapiv1alpha1.MasterConfiguration, cfgPath, description *string, skipTokenPrint *bool) {
|
func addBootstrapTokenFlags(flagSet *pflag.FlagSet, cfg *kubeadmapiv1alpha2.MasterConfiguration, cfgPath, description *string, skipTokenPrint *bool) {
|
||||||
flagSet.StringVar(
|
flagSet.StringVar(
|
||||||
cfgPath, "config", *cfgPath,
|
cfgPath, "config", *cfgPath,
|
||||||
"Path to kubeadm config file. WARNING: Usage of a configuration file is experimental",
|
"Path to kubeadm config file. WARNING: Usage of a configuration file is experimental",
|
||||||
@ -309,7 +309,7 @@ func addBootstrapTokenFlags(flagSet *pflag.FlagSet, cfg *kubeadmapiv1alpha1.Mast
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func createBootstrapToken(kubeConfigFile string, client clientset.Interface, cfgPath string, cfg *kubeadmapiv1alpha1.MasterConfiguration, description string, skipTokenPrint bool) error {
|
func createBootstrapToken(kubeConfigFile string, client clientset.Interface, cfgPath string, cfg *kubeadmapiv1alpha2.MasterConfiguration, description string, skipTokenPrint bool) error {
|
||||||
|
|
||||||
// This call returns the ready-to-use configuration based on the configuration file that might or might not exist and the default cfg populated by flags
|
// This call returns the ready-to-use configuration based on the configuration file that might or might not exist and the default cfg populated by flags
|
||||||
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg)
|
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg)
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
@ -148,7 +148,7 @@ func NewCmdCerts() *cobra.Command {
|
|||||||
// getCertsSubCommands returns sub commands for certs phase
|
// getCertsSubCommands returns sub commands for certs phase
|
||||||
func getCertsSubCommands(defaultKubernetesVersion string) []*cobra.Command {
|
func getCertsSubCommands(defaultKubernetesVersion string) []*cobra.Command {
|
||||||
|
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
|
|
||||||
// This is used for unit testing only...
|
// This is used for unit testing only...
|
||||||
// If we wouldn't set this to something, the code would dynamically look up the version from the internet
|
// If we wouldn't set this to something, the code would dynamically look up the version from the internet
|
||||||
@ -272,7 +272,7 @@ func getCertsSubCommands(defaultKubernetesVersion string) []*cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// runCmdFunc creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
|
// runCmdFunc creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
|
||||||
func runCmdFunc(cmdFunc func(cfg *kubeadmapi.MasterConfiguration) error, cfgPath *string, cfg *kubeadmapiv1alpha1.MasterConfiguration) func(cmd *cobra.Command, args []string) {
|
func runCmdFunc(cmdFunc func(cfg *kubeadmapi.MasterConfiguration) error, cfgPath *string, cfg *kubeadmapiv1alpha2.MasterConfiguration) func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// the following statement build a closure that wraps a call to a cmdFunc, binding
|
// the following statement build a closure that wraps a call to a cmdFunc, binding
|
||||||
// the function itself with the specific parameters of each sub command.
|
// the function itself with the specific parameters of each sub command.
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
utilflag "k8s.io/apiserver/pkg/util/flag"
|
utilflag "k8s.io/apiserver/pkg/util/flag"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
@ -79,7 +79,7 @@ func NewCmdControlplane() *cobra.Command {
|
|||||||
// getControlPlaneSubCommands returns sub commands for Controlplane phase
|
// getControlPlaneSubCommands returns sub commands for Controlplane phase
|
||||||
func getControlPlaneSubCommands(outDir, defaultKubernetesVersion string) []*cobra.Command {
|
func getControlPlaneSubCommands(outDir, defaultKubernetesVersion string) []*cobra.Command {
|
||||||
|
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
|
|
||||||
// This is used for unit testing only...
|
// This is used for unit testing only...
|
||||||
// If we wouldn't set this to something, the code would dynamically look up the version from the internet
|
// If we wouldn't set this to something, the code would dynamically look up the version from the internet
|
||||||
@ -169,7 +169,7 @@ func getControlPlaneSubCommands(outDir, defaultKubernetesVersion string) []*cobr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// runCmdControlPlane creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
|
// runCmdControlPlane creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
|
||||||
func runCmdControlPlane(cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error, outDir, cfgPath *string, featureGatesString *string, cfg *kubeadmapiv1alpha1.MasterConfiguration) func(cmd *cobra.Command, args []string) {
|
func runCmdControlPlane(cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error, outDir, cfgPath *string, featureGatesString *string, cfg *kubeadmapiv1alpha2.MasterConfiguration) func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// the following statement build a closure that wraps a call to a cmdFunc, binding
|
// the following statement build a closure that wraps a call to a cmdFunc, binding
|
||||||
// the function itself with the specific parameters of each sub command.
|
// the function itself with the specific parameters of each sub command.
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
etcdphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/etcd"
|
etcdphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/etcd"
|
||||||
@ -61,7 +61,7 @@ func NewCmdEtcd() *cobra.Command {
|
|||||||
// getEtcdSubCommands returns sub commands for etcd phase
|
// getEtcdSubCommands returns sub commands for etcd phase
|
||||||
func getEtcdSubCommands(outDir, defaultKubernetesVersion string) []*cobra.Command {
|
func getEtcdSubCommands(outDir, defaultKubernetesVersion string) []*cobra.Command {
|
||||||
|
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
|
|
||||||
// This is used for unit testing only...
|
// This is used for unit testing only...
|
||||||
// If we wouldn't set this to something, the code would dynamically look up the version from the internet
|
// If we wouldn't set this to something, the code would dynamically look up the version from the internet
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
|
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
kubeconfigphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/kubeconfig"
|
kubeconfigphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/kubeconfig"
|
||||||
@ -90,7 +90,7 @@ func NewCmdKubeConfig(out io.Writer) *cobra.Command {
|
|||||||
// getKubeConfigSubCommands returns sub commands for kubeconfig phase
|
// getKubeConfigSubCommands returns sub commands for kubeconfig phase
|
||||||
func getKubeConfigSubCommands(out io.Writer, outDir, defaultKubernetesVersion string) []*cobra.Command {
|
func getKubeConfigSubCommands(out io.Writer, outDir, defaultKubernetesVersion string) []*cobra.Command {
|
||||||
|
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
|
|
||||||
// This is used for unit testing only...
|
// This is used for unit testing only...
|
||||||
// If we wouldn't set this to something, the code would dynamically look up the version from the internet
|
// If we wouldn't set this to something, the code would dynamically look up the version from the internet
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
||||||
kubeletphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/kubelet"
|
kubeletphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/kubelet"
|
||||||
@ -91,7 +91,7 @@ func NewCmdKubeletWriteInitConfig() *cobra.Command {
|
|||||||
Long: kubeletWriteInitConfigLongDesc,
|
Long: kubeletWriteInitConfigLongDesc,
|
||||||
Example: kubeletWriteInitConfigExample,
|
Example: kubeletWriteInitConfigExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{
|
||||||
// KubernetesVersion is not used by kubelet init, but we set this explicitly to avoid
|
// KubernetesVersion is not used by kubelet init, but we set this explicitly to avoid
|
||||||
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
||||||
KubernetesVersion: "v1.9.0",
|
KubernetesVersion: "v1.9.0",
|
||||||
@ -125,7 +125,7 @@ func NewCmdKubeletUploadDynamicConfig() *cobra.Command {
|
|||||||
Long: kubeletUploadDynamicConfigLongDesc,
|
Long: kubeletUploadDynamicConfigLongDesc,
|
||||||
Example: kubeletUploadDynamicConfigExample,
|
Example: kubeletUploadDynamicConfigExample,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{
|
||||||
// KubernetesVersion is not used by kubelet upload, but we set this explicitly to avoid
|
// KubernetesVersion is not used by kubelet upload, but we set this explicitly to avoid
|
||||||
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
||||||
KubernetesVersion: "v1.9.0",
|
KubernetesVersion: "v1.9.0",
|
||||||
@ -154,7 +154,7 @@ func NewCmdKubeletUploadDynamicConfig() *cobra.Command {
|
|||||||
|
|
||||||
// NewCmdKubeletEnableDynamicConfig calls cobra.Command for enabling dynamic kubelet configuration on node
|
// NewCmdKubeletEnableDynamicConfig calls cobra.Command for enabling dynamic kubelet configuration on node
|
||||||
func NewCmdKubeletEnableDynamicConfig() *cobra.Command {
|
func NewCmdKubeletEnableDynamicConfig() *cobra.Command {
|
||||||
cfg := &kubeadmapiv1alpha1.NodeConfiguration{}
|
cfg := &kubeadmapiv1alpha2.NodeConfiguration{}
|
||||||
kubeadmscheme.Scheme.Default(cfg)
|
kubeadmscheme.Scheme.Default(cfg)
|
||||||
|
|
||||||
var cfgPath string
|
var cfgPath string
|
||||||
@ -182,7 +182,7 @@ func NewCmdKubeletEnableDynamicConfig() *cobra.Command {
|
|||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func getNodeName(cfgPath string, cfg *kubeadmapiv1alpha1.NodeConfiguration) (string, error) {
|
func getNodeName(cfgPath string, cfg *kubeadmapiv1alpha2.NodeConfiguration) (string, error) {
|
||||||
if cfgPath != "" {
|
if cfgPath != "" {
|
||||||
b, err := ioutil.ReadFile(cfgPath)
|
b, err := ioutil.ReadFile(cfgPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
markmasterphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/markmaster"
|
markmasterphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/markmaster"
|
||||||
@ -47,7 +47,7 @@ var (
|
|||||||
// NewCmdMarkMaster returns the Cobra command for running the mark-master phase
|
// NewCmdMarkMaster returns the Cobra command for running the mark-master phase
|
||||||
func NewCmdMarkMaster() *cobra.Command {
|
func NewCmdMarkMaster() *cobra.Command {
|
||||||
|
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{
|
||||||
// KubernetesVersion is not used by mark master, but we set this explicitly to avoid
|
// KubernetesVersion is not used by mark master, but we set this explicitly to avoid
|
||||||
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
||||||
KubernetesVersion: "v1.9.0",
|
KubernetesVersion: "v1.9.0",
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
@ -70,7 +70,7 @@ func NewCmdSelfhosting() *cobra.Command {
|
|||||||
// getSelfhostingSubCommand returns sub commands for Selfhosting phase
|
// getSelfhostingSubCommand returns sub commands for Selfhosting phase
|
||||||
func getSelfhostingSubCommand() *cobra.Command {
|
func getSelfhostingSubCommand() *cobra.Command {
|
||||||
|
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
// Default values for the cobra help text
|
// Default values for the cobra help text
|
||||||
kubeadmscheme.Scheme.Default(cfg)
|
kubeadmscheme.Scheme.Default(cfg)
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/phases/uploadconfig"
|
"k8s.io/kubernetes/cmd/kubeadm/app/phases/uploadconfig"
|
||||||
@ -62,7 +62,7 @@ func NewCmdUploadConfig() *cobra.Command {
|
|||||||
client, err := kubeconfigutil.ClientSetFromFile(kubeConfigFile)
|
client, err := kubeconfigutil.ClientSetFromFile(kubeConfigFile)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
defaultcfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
defaultcfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, defaultcfg)
|
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, defaultcfg)
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
|
@ -20,14 +20,14 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
||||||
configutil "k8s.io/kubernetes/cmd/kubeadm/app/util/config"
|
configutil "k8s.io/kubernetes/cmd/kubeadm/app/util/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// runCmdPhase creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
|
// runCmdPhase creates a cobra.Command Run function, by composing the call to the given cmdFunc with necessary additional steps (e.g preparation of input parameters)
|
||||||
func runCmdPhase(cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error, outDir, cfgPath *string, cfg *kubeadmapiv1alpha1.MasterConfiguration) func(cmd *cobra.Command, args []string) {
|
func runCmdPhase(cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error, outDir, cfgPath *string, cfg *kubeadmapiv1alpha2.MasterConfiguration) func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// the following statement build a closure that wraps a call to a cmdFunc, binding
|
// the following statement build a closure that wraps a call to a cmdFunc, binding
|
||||||
// the function itself with the specific parameters of each sub command.
|
// the function itself with the specific parameters of each sub command.
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
|
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
|
||||||
@ -71,7 +71,7 @@ func NewCmdReset(in io.Reader, out io.Writer) *cobra.Command {
|
|||||||
cmd.PersistentFlags().MarkDeprecated("skip-preflight-checks", "it is now equivalent to --ignore-preflight-errors=all")
|
cmd.PersistentFlags().MarkDeprecated("skip-preflight-checks", "it is now equivalent to --ignore-preflight-errors=all")
|
||||||
|
|
||||||
cmd.PersistentFlags().StringVar(
|
cmd.PersistentFlags().StringVar(
|
||||||
&certsDir, "cert-dir", kubeadmapiv1alpha1.DefaultCertificatesDir,
|
&certsDir, "cert-dir", kubeadmapiv1alpha2.DefaultCertificatesDir,
|
||||||
"The path to the directory where the certificates are stored. If specified, clean this directory.",
|
"The path to the directory where the certificates are stored. If specified, clean this directory.",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ func (r *Reset) Run(out io.Writer) error {
|
|||||||
|
|
||||||
// Remove contents from the config and pki directories
|
// Remove contents from the config and pki directories
|
||||||
glog.V(1).Infoln("[reset] removing contents from the config and pki directories")
|
glog.V(1).Infoln("[reset] removing contents from the config and pki directories")
|
||||||
if r.certsDir != kubeadmapiv1alpha1.DefaultCertificatesDir {
|
if r.certsDir != kubeadmapiv1alpha2.DefaultCertificatesDir {
|
||||||
glog.Warningf("[reset] WARNING: cleaning a non-default certificates directory: %q\n", r.certsDir)
|
glog.Warningf("[reset] WARNING: cleaning a non-default certificates directory: %q\n", r.certsDir)
|
||||||
}
|
}
|
||||||
resetConfigDir(kubeadmconstants.KubernetesDir, r.certsDir)
|
resetConfigDir(kubeadmconstants.KubernetesDir, r.certsDir)
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
|
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
|
||||||
@ -57,7 +57,7 @@ func assertDirEmpty(t *testing.T, path string) {
|
|||||||
|
|
||||||
func TestNewReset(t *testing.T) {
|
func TestNewReset(t *testing.T) {
|
||||||
var in io.Reader
|
var in io.Reader
|
||||||
certsDir := kubeadmapiv1alpha1.DefaultCertificatesDir
|
certsDir := kubeadmapiv1alpha2.DefaultCertificatesDir
|
||||||
criSocketPath := "/var/run/dockershim.sock"
|
criSocketPath := "/var/run/dockershim.sock"
|
||||||
skipPreFlight := false
|
skipPreFlight := false
|
||||||
forceReset := true
|
forceReset := true
|
||||||
|
@ -38,7 +38,7 @@ import (
|
|||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
@ -92,7 +92,7 @@ func NewCmdToken(out io.Writer, errW io.Writer) *cobra.Command {
|
|||||||
tokenCmd.PersistentFlags().BoolVar(&dryRun,
|
tokenCmd.PersistentFlags().BoolVar(&dryRun,
|
||||||
"dry-run", dryRun, "Whether to enable dry-run mode or not")
|
"dry-run", dryRun, "Whether to enable dry-run mode or not")
|
||||||
|
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{
|
||||||
// KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid
|
// KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid
|
||||||
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
||||||
KubernetesVersion: "v1.9.0",
|
KubernetesVersion: "v1.9.0",
|
||||||
@ -217,7 +217,7 @@ func NewCmdTokenGenerate(out io.Writer) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RunCreateToken generates a new bootstrap token and stores it as a secret on the server.
|
// RunCreateToken generates a new bootstrap token and stores it as a secret on the server.
|
||||||
func RunCreateToken(out io.Writer, client clientset.Interface, cfgPath string, cfg *kubeadmapiv1alpha1.MasterConfiguration, description string, printJoinCommand bool, kubeConfigFile string) error {
|
func RunCreateToken(out io.Writer, client clientset.Interface, cfgPath string, cfg *kubeadmapiv1alpha2.MasterConfiguration, description string, printJoinCommand bool, kubeConfigFile string) error {
|
||||||
// This call returns the ready-to-use configuration based on the configuration file that might or might not exist and the default cfg populated by flags
|
// This call returns the ready-to-use configuration based on the configuration file that might or might not exist and the default cfg populated by flags
|
||||||
glog.V(1).Infoln("[token] loading configurations")
|
glog.V(1).Infoln("[token] loading configurations")
|
||||||
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg)
|
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, cfg)
|
||||||
|
@ -38,7 +38,7 @@ import (
|
|||||||
core "k8s.io/client-go/testing"
|
core "k8s.io/client-go/testing"
|
||||||
bootstrapapi "k8s.io/client-go/tools/bootstrap/token/api"
|
bootstrapapi "k8s.io/client-go/tools/bootstrap/token/api"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -180,7 +180,7 @@ func TestRunCreateToken(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
cfg := &kubeadmapiv1alpha1.MasterConfiguration{
|
cfg := &kubeadmapiv1alpha2.MasterConfiguration{
|
||||||
|
|
||||||
// KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid
|
// KubernetesVersion is not used by bootstrap-token, but we set this explicitly to avoid
|
||||||
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
// the lookup of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
|
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
@ -87,7 +87,7 @@ func NewCmdApply(parentFlags *cmdUpgradeFlags) *cobra.Command {
|
|||||||
// If the version is specified in config file, pick up that value.
|
// If the version is specified in config file, pick up that value.
|
||||||
if flags.parent.cfgPath != "" {
|
if flags.parent.cfgPath != "" {
|
||||||
glog.V(1).Infof("fetching configuration from file", flags.parent.cfgPath)
|
glog.V(1).Infof("fetching configuration from file", flags.parent.cfgPath)
|
||||||
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(parentFlags.cfgPath, &kubeadmapiv1alpha1.MasterConfiguration{})
|
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(parentFlags.cfgPath, &kubeadmapiv1alpha2.MasterConfiguration{})
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
if cfg.KubernetesVersion != "" {
|
if cfg.KubernetesVersion != "" {
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade"
|
"k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
|
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
|
||||||
@ -101,10 +101,10 @@ func printConfiguration(cfg *kubeadmapi.MasterConfiguration, w io.Writer) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
externalcfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
externalcfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
kubeadmscheme.Scheme.Convert(cfg, externalcfg, nil)
|
kubeadmscheme.Scheme.Convert(cfg, externalcfg, nil)
|
||||||
|
|
||||||
cfgYaml, err := kubeadmutil.MarshalToYamlForCodecs(externalcfg, kubeadmapiv1alpha1.SchemeGroupVersion, kubeadmscheme.Codecs)
|
cfgYaml, err := kubeadmutil.MarshalToYamlForCodecs(externalcfg, kubeadmapiv1alpha2.SchemeGroupVersion, kubeadmscheme.Codecs)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
fmt.Fprintln(w, "[upgrade/config] Configuration used:")
|
fmt.Fprintln(w, "[upgrade/config] Configuration used:")
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ func TestPrintConfiguration(t *testing.T) {
|
|||||||
advertiseAddress: ""
|
advertiseAddress: ""
|
||||||
bindPort: 0
|
bindPort: 0
|
||||||
controlPlaneEndpoint: ""
|
controlPlaneEndpoint: ""
|
||||||
apiVersion: kubeadm.k8s.io/v1alpha1
|
apiVersion: kubeadm.k8s.io/v1alpha2
|
||||||
auditPolicy:
|
auditPolicy:
|
||||||
logDir: ""
|
logDir: ""
|
||||||
path: ""
|
path: ""
|
||||||
@ -82,7 +82,7 @@ func TestPrintConfiguration(t *testing.T) {
|
|||||||
advertiseAddress: ""
|
advertiseAddress: ""
|
||||||
bindPort: 0
|
bindPort: 0
|
||||||
controlPlaneEndpoint: ""
|
controlPlaneEndpoint: ""
|
||||||
apiVersion: kubeadm.k8s.io/v1alpha1
|
apiVersion: kubeadm.k8s.io/v1alpha2
|
||||||
auditPolicy:
|
auditPolicy:
|
||||||
logDir: ""
|
logDir: ""
|
||||||
path: ""
|
path: ""
|
||||||
@ -127,7 +127,7 @@ func TestPrintConfiguration(t *testing.T) {
|
|||||||
advertiseAddress: ""
|
advertiseAddress: ""
|
||||||
bindPort: 0
|
bindPort: 0
|
||||||
controlPlaneEndpoint: ""
|
controlPlaneEndpoint: ""
|
||||||
apiVersion: kubeadm.k8s.io/v1alpha1
|
apiVersion: kubeadm.k8s.io/v1alpha2
|
||||||
auditPolicy:
|
auditPolicy:
|
||||||
logDir: ""
|
logDir: ""
|
||||||
path: ""
|
path: ""
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade"
|
"k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade"
|
||||||
@ -60,7 +60,7 @@ func NewCmdPlan(parentFlags *cmdUpgradeFlags) *cobra.Command {
|
|||||||
// If the version is specified in config file, pick up that value.
|
// If the version is specified in config file, pick up that value.
|
||||||
if parentFlags.cfgPath != "" {
|
if parentFlags.cfgPath != "" {
|
||||||
glog.V(1).Infof("fetching configuration from file", parentFlags.cfgPath)
|
glog.V(1).Infof("fetching configuration from file", parentFlags.cfgPath)
|
||||||
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(parentFlags.cfgPath, &kubeadmapiv1alpha1.MasterConfiguration{})
|
cfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(parentFlags.cfgPath, &kubeadmapiv1alpha2.MasterConfiguration{})
|
||||||
kubeadmutil.CheckErr(err)
|
kubeadmutil.CheckErr(err)
|
||||||
|
|
||||||
if cfg.KubernetesVersion != "" {
|
if cfg.KubernetesVersion != "" {
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
clientsetfake "k8s.io/client-go/kubernetes/fake"
|
clientsetfake "k8s.io/client-go/kubernetes/fake"
|
||||||
core "k8s.io/client-go/testing"
|
core "k8s.io/client-go/testing"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
|
||||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/util/config"
|
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/util/config"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
api "k8s.io/kubernetes/pkg/apis/core"
|
||||||
@ -174,12 +174,12 @@ func TestEnsureProxyAddon(t *testing.T) {
|
|||||||
// Create a fake client and set up default test configuration
|
// Create a fake client and set up default test configuration
|
||||||
client := clientsetfake.NewSimpleClientset()
|
client := clientsetfake.NewSimpleClientset()
|
||||||
|
|
||||||
masterConfig := &kubeadmapiv1alpha1.MasterConfiguration{
|
masterConfig := &kubeadmapiv1alpha2.MasterConfiguration{
|
||||||
API: kubeadmapiv1alpha1.API{
|
API: kubeadmapiv1alpha2.API{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
BindPort: 1234,
|
BindPort: 1234,
|
||||||
},
|
},
|
||||||
KubeProxy: kubeadmapiv1alpha1.KubeProxy{
|
KubeProxy: kubeadmapiv1alpha2.KubeProxy{
|
||||||
Config: &kubeproxyconfigv1alpha1.KubeProxyConfiguration{
|
Config: &kubeproxyconfigv1alpha1.KubeProxyConfiguration{
|
||||||
BindAddress: "",
|
BindAddress: "",
|
||||||
HealthzBindAddress: "0.0.0.0:10256",
|
HealthzBindAddress: "0.0.0.0:10256",
|
||||||
@ -193,7 +193,7 @@ func TestEnsureProxyAddon(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Networking: kubeadmapiv1alpha1.Networking{
|
Networking: kubeadmapiv1alpha2.Networking{
|
||||||
PodSubnet: "5.6.7.8/24",
|
PodSubnet: "5.6.7.8/24",
|
||||||
},
|
},
|
||||||
ImageRepository: "someRepo",
|
ImageRepository: "someRepo",
|
||||||
@ -214,7 +214,7 @@ func TestEnsureProxyAddon(t *testing.T) {
|
|||||||
masterConfig.Networking.PodSubnet = "2001:101::/96"
|
masterConfig.Networking.PodSubnet = "2001:101::/96"
|
||||||
}
|
}
|
||||||
|
|
||||||
kubeadmapiv1alpha1.SetDefaults_MasterConfiguration(masterConfig)
|
kubeadmapiv1alpha2.SetDefaults_MasterConfiguration(masterConfig)
|
||||||
intMaster, err := cmdutil.ConfigFileAndDefaultsToInternalConfig("", masterConfig)
|
intMaster, err := cmdutil.ConfigFileAndDefaultsToInternalConfig("", masterConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf(" test failed to convert v1alpha1 to internal version")
|
t.Errorf(" test failed to convert v1alpha1 to internal version")
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/images"
|
"k8s.io/kubernetes/cmd/kubeadm/app/images"
|
||||||
@ -246,7 +246,7 @@ func getAPIServerCommand(cfg *kubeadmapi.MasterConfiguration) []string {
|
|||||||
defaultArguments["audit-policy-file"] = kubeadmconstants.GetStaticPodAuditPolicyFile()
|
defaultArguments["audit-policy-file"] = kubeadmconstants.GetStaticPodAuditPolicyFile()
|
||||||
defaultArguments["audit-log-path"] = filepath.Join(kubeadmconstants.StaticPodAuditPolicyLogDir, kubeadmconstants.AuditPolicyLogFile)
|
defaultArguments["audit-log-path"] = filepath.Join(kubeadmconstants.StaticPodAuditPolicyLogDir, kubeadmconstants.AuditPolicyLogFile)
|
||||||
if cfg.AuditPolicyConfiguration.LogMaxAge == nil {
|
if cfg.AuditPolicyConfiguration.LogMaxAge == nil {
|
||||||
defaultArguments["audit-log-maxage"] = fmt.Sprintf("%d", kubeadmapiv1alpha1.DefaultAuditPolicyLogMaxAge)
|
defaultArguments["audit-log-maxage"] = fmt.Sprintf("%d", kubeadmapiv1alpha2.DefaultAuditPolicyLogMaxAge)
|
||||||
} else {
|
} else {
|
||||||
defaultArguments["audit-log-maxage"] = fmt.Sprintf("%d", *cfg.AuditPolicyConfiguration.LogMaxAge)
|
defaultArguments["audit-log-maxage"] = fmt.Sprintf("%d", *cfg.AuditPolicyConfiguration.LogMaxAge)
|
||||||
}
|
}
|
||||||
@ -387,7 +387,7 @@ func getAuthzParameters(modes []string) []string {
|
|||||||
strset := sets.NewString(modes...)
|
strset := sets.NewString(modes...)
|
||||||
|
|
||||||
if len(modes) == 0 {
|
if len(modes) == 0 {
|
||||||
return []string{fmt.Sprintf("--authorization-mode=%s", kubeadmapiv1alpha1.DefaultAuthorizationModes)}
|
return []string{fmt.Sprintf("--authorization-mode=%s", kubeadmapiv1alpha2.DefaultAuthorizationModes)}
|
||||||
}
|
}
|
||||||
|
|
||||||
if strset.Has(authzmodes.ModeABAC) {
|
if strset.Has(authzmodes.ModeABAC) {
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
certutil "k8s.io/client-go/util/cert"
|
certutil "k8s.io/client-go/util/cert"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
"k8s.io/kubernetes/cmd/kubeadm/app/features"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/phases/addons/dns"
|
"k8s.io/kubernetes/cmd/kubeadm/app/phases/addons/dns"
|
||||||
@ -88,7 +88,7 @@ func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.MasterC
|
|||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
certAndKeyDir := kubeadmapiv1alpha1.DefaultCertificatesDir
|
certAndKeyDir := kubeadmapiv1alpha2.DefaultCertificatesDir
|
||||||
shouldBackup, err := shouldBackupAPIServerCertAndKey(certAndKeyDir)
|
shouldBackup, err := shouldBackupAPIServerCertAndKey(certAndKeyDir)
|
||||||
// Don't fail the upgrade phase if failing to determine to backup kube-apiserver cert and key.
|
// Don't fail the upgrade phase if failing to determine to backup kube-apiserver cert and key.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
certsphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/certs"
|
certsphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/certs"
|
||||||
controlplanephase "k8s.io/kubernetes/cmd/kubeadm/app/phases/controlplane"
|
controlplanephase "k8s.io/kubernetes/cmd/kubeadm/app/phases/controlplane"
|
||||||
@ -510,7 +510,7 @@ func getAPIServerHash(dir string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getConfig(version, certsDir, etcdDataDir string) (*kubeadmapi.MasterConfiguration, error) {
|
func getConfig(version, certsDir, etcdDataDir string) (*kubeadmapi.MasterConfiguration, error) {
|
||||||
externalcfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
externalcfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
internalcfg := &kubeadmapi.MasterConfiguration{}
|
internalcfg := &kubeadmapi.MasterConfiguration{}
|
||||||
if err := runtime.DecodeInto(kubeadmscheme.Codecs.UniversalDecoder(), []byte(fmt.Sprintf(testConfiguration, certsDir, etcdDataDir, version)), externalcfg); err != nil {
|
if err := runtime.DecodeInto(kubeadmscheme.Codecs.UniversalDecoder(), []byte(fmt.Sprintf(testConfiguration, certsDir, etcdDataDir, version)), externalcfg); err != nil {
|
||||||
return nil, fmt.Errorf("unable to decode config: %v", err)
|
return nil, fmt.Errorf("unable to decode config: %v", err)
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/util"
|
"k8s.io/kubernetes/cmd/kubeadm/app/util"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient"
|
"k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient"
|
||||||
@ -37,13 +37,13 @@ func UploadConfiguration(cfg *kubeadmapi.MasterConfiguration, client clientset.I
|
|||||||
glog.Infof("[uploadconfig] storing the configuration used in ConfigMap %q in the %q Namespace\n", kubeadmconstants.MasterConfigurationConfigMap, metav1.NamespaceSystem)
|
glog.Infof("[uploadconfig] storing the configuration used in ConfigMap %q in the %q Namespace\n", kubeadmconstants.MasterConfigurationConfigMap, metav1.NamespaceSystem)
|
||||||
|
|
||||||
// Convert cfg to the external version as that's the only version of the API that can be deserialized later
|
// Convert cfg to the external version as that's the only version of the API that can be deserialized later
|
||||||
externalcfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
externalcfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
kubeadmscheme.Scheme.Convert(cfg, externalcfg, nil)
|
kubeadmscheme.Scheme.Convert(cfg, externalcfg, nil)
|
||||||
|
|
||||||
// Removes sensitive info from the data that will be stored in the config map
|
// Removes sensitive info from the data that will be stored in the config map
|
||||||
externalcfg.Token = ""
|
externalcfg.Token = ""
|
||||||
|
|
||||||
cfgYaml, err := util.MarshalToYamlForCodecs(externalcfg, kubeadmapiv1alpha1.SchemeGroupVersion, scheme.Codecs)
|
cfgYaml, err := util.MarshalToYamlForCodecs(externalcfg, kubeadmapiv1alpha2.SchemeGroupVersion, scheme.Codecs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
core "k8s.io/client-go/testing"
|
core "k8s.io/client-go/testing"
|
||||||
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||||
kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
|
kubeadmapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha2"
|
||||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ func TestUploadConfiguration(t *testing.T) {
|
|||||||
t.Errorf("Fail to find ConfigMap key")
|
t.Errorf("Fail to find ConfigMap key")
|
||||||
}
|
}
|
||||||
|
|
||||||
decodedExtCfg := &kubeadmapiv1alpha1.MasterConfiguration{}
|
decodedExtCfg := &kubeadmapiv1alpha2.MasterConfiguration{}
|
||||||
decodedCfg := &kubeadmapi.MasterConfiguration{}
|
decodedCfg := &kubeadmapi.MasterConfiguration{}
|
||||||
|
|
||||||
if err := runtime.DecodeInto(kubeadmscheme.Codecs.UniversalDecoder(), []byte(configData), decodedExtCfg); err != nil {
|
if err := runtime.DecodeInto(kubeadmscheme.Codecs.UniversalDecoder(), []byte(configData), decodedExtCfg); err != nil {
|
||||||
@ -118,8 +118,8 @@ func TestUploadConfiguration(t *testing.T) {
|
|||||||
t.Errorf("Expected kind MasterConfiguration, got %v", decodedExtCfg.Kind)
|
t.Errorf("Expected kind MasterConfiguration, got %v", decodedExtCfg.Kind)
|
||||||
}
|
}
|
||||||
|
|
||||||
if decodedExtCfg.APIVersion != "kubeadm.k8s.io/v1alpha1" {
|
if decodedExtCfg.APIVersion != "kubeadm.k8s.io/v1alpha2" {
|
||||||
t.Errorf("Expected apiVersion kubeadm.k8s.io/v1alpha1, got %v", decodedExtCfg.APIVersion)
|
t.Errorf("Expected apiVersion kubeadm.k8s.io/v1alpha2, got %v", decodedExtCfg.APIVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -54,9 +54,9 @@ func SetInitDynamicDefaults(cfg *kubeadmapi.MasterConfiguration) error {
|
|||||||
cfg.API.AdvertiseAddress = ip.String()
|
cfg.API.AdvertiseAddress = ip.String()
|
||||||
ip = net.ParseIP(cfg.API.AdvertiseAddress)
|
ip = net.ParseIP(cfg.API.AdvertiseAddress)
|
||||||
if ip.To4() != nil {
|
if ip.To4() != nil {
|
||||||
cfg.KubeProxy.Config.BindAddress = kubeadmapiv1alpha1.DefaultProxyBindAddressv4
|
cfg.KubeProxy.Config.BindAddress = kubeadmapiv1alpha2.DefaultProxyBindAddressv4
|
||||||
} else {
|
} else {
|
||||||
cfg.KubeProxy.Config.BindAddress = kubeadmapiv1alpha1.DefaultProxyBindAddressv6
|
cfg.KubeProxy.Config.BindAddress = kubeadmapiv1alpha2.DefaultProxyBindAddressv6
|
||||||
}
|
}
|
||||||
// Resolve possible version labels and validate version string
|
// Resolve possible version labels and validate version string
|
||||||
err = NormalizeKubernetesVersion(cfg)
|
err = NormalizeKubernetesVersion(cfg)
|
||||||
@ -82,7 +82,7 @@ func SetInitDynamicDefaults(cfg *kubeadmapi.MasterConfiguration) error {
|
|||||||
// Then the external, versioned configuration is defaulted and converted to the internal type.
|
// Then the external, versioned configuration is defaulted and converted to the internal type.
|
||||||
// Right thereafter, the configuration is defaulted again with dynamic values (like IP addresses of a machine, etc)
|
// Right thereafter, the configuration is defaulted again with dynamic values (like IP addresses of a machine, etc)
|
||||||
// Lastly, the internal config is validated and returned.
|
// Lastly, the internal config is validated and returned.
|
||||||
func ConfigFileAndDefaultsToInternalConfig(cfgPath string, defaultversionedcfg *kubeadmapiv1alpha1.MasterConfiguration) (*kubeadmapi.MasterConfiguration, error) {
|
func ConfigFileAndDefaultsToInternalConfig(cfgPath string, defaultversionedcfg *kubeadmapiv1alpha2.MasterConfiguration) (*kubeadmapi.MasterConfiguration, error) {
|
||||||
internalcfg := &kubeadmapi.MasterConfiguration{}
|
internalcfg := &kubeadmapi.MasterConfiguration{}
|
||||||
|
|
||||||
if cfgPath != "" {
|
if cfgPath != "" {
|
||||||
|
@ -53,7 +53,7 @@ func SetupMasterConfigurationFile(t *testing.T, tmpdir string, cfg *kubeadmapi.M
|
|||||||
}
|
}
|
||||||
|
|
||||||
cfgTemplate := template.Must(template.New("init").Parse(dedent.Dedent(`
|
cfgTemplate := template.Must(template.New("init").Parse(dedent.Dedent(`
|
||||||
apiVersion: kubeadm.k8s.io/v1alpha1
|
apiVersion: kubeadm.k8s.io/v1alpha2
|
||||||
kind: MasterConfiguration
|
kind: MasterConfiguration
|
||||||
certificatesDir: {{.CertificatesDir}}
|
certificatesDir: {{.CertificatesDir}}
|
||||||
api:
|
api:
|
||||||
|
Loading…
Reference in New Issue
Block a user