Rename kubeadmapiext to the more explicit kubeadmapiv1alpha1

parent feeee503
...@@ -29,7 +29,7 @@ import ( ...@@ -29,7 +29,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
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 ...@@ -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 := &kubeadmapiext.MasterConfiguration{} defaultcfg := &kubeadmapiv1alpha1.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 ...@@ -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 := &kubeadmapiext.MasterConfiguration{} cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
legacyscheme.Scheme.Default(cfg) legacyscheme.Scheme.Default(cfg)
var featureGatesString string var featureGatesString string
...@@ -192,7 +192,7 @@ func RunConfigView(out io.Writer, client clientset.Interface) error { ...@@ -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 *kubeadmapiext.MasterConfiguration) error { func uploadConfiguration(client clientset.Interface, cfgPath string, defaultcfg *kubeadmapiv1alpha1.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
...@@ -208,8 +208,8 @@ func uploadConfiguration(client clientset.Interface, cfgPath string, defaultcfg ...@@ -208,8 +208,8 @@ func uploadConfiguration(client clientset.Interface, cfgPath string, defaultcfg
// NewCmdConfigListImages returns the "kubeadm images" command // NewCmdConfigListImages returns the "kubeadm images" command
func NewCmdConfigListImages(out io.Writer) *cobra.Command { func NewCmdConfigListImages(out io.Writer) *cobra.Command {
cfg := &kubeadmapiext.MasterConfiguration{} cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
kubeadmapiext.SetDefaults_MasterConfiguration(cfg) kubeadmapiv1alpha1.SetDefaults_MasterConfiguration(cfg)
var cfgPath, featureGatesString string var cfgPath, featureGatesString string
var err error var err error
...@@ -232,7 +232,7 @@ func NewCmdConfigListImages(out io.Writer) *cobra.Command { ...@@ -232,7 +232,7 @@ func NewCmdConfigListImages(out io.Writer) *cobra.Command {
} }
// NewListImages returns a "kubeadm images" command // NewListImages returns a "kubeadm images" command
func NewListImages(cfgPath string, cfg *kubeadmapiext.MasterConfiguration) (*ListImages, error) { func NewListImages(cfgPath string, cfg *kubeadmapiv1alpha1.MasterConfiguration) (*ListImages, 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)
...@@ -259,7 +259,7 @@ func (i *ListImages) Run(out io.Writer) error { ...@@ -259,7 +259,7 @@ func (i *ListImages) Run(out io.Writer) error {
} }
// AddListImagesConfigFlag adds the flags that configure kubeadm // AddListImagesConfigFlag adds the flags that configure kubeadm
func AddListImagesConfigFlag(flagSet *flag.FlagSet, cfg *kubeadmapiext.MasterConfiguration, featureGatesString *string) { func AddListImagesConfigFlag(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha1.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 ( ...@@ -26,7 +26,7 @@ import (
"github.com/renstrom/dedent" "github.com/renstrom/dedent"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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"
) )
...@@ -99,7 +99,7 @@ func TestListImagesRunWithCustomConfigPath(t *testing.T) { ...@@ -99,7 +99,7 @@ func TestListImagesRunWithCustomConfigPath(t *testing.T) {
t.Fatalf("Failed writing a config file: %v", err) t.Fatalf("Failed writing a config file: %v", err)
} }
i, err := cmd.NewListImages(configFilePath, &kubeadmapiext.MasterConfiguration{}) i, err := cmd.NewListImages(configFilePath, &kubeadmapiv1alpha1.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 TestListImagesRunWithCustomConfigPath(t *testing.T) { ...@@ -124,7 +124,7 @@ func TestListImagesRunWithCustomConfigPath(t *testing.T) {
func TestConfigListImagesRunWithoutPath(t *testing.T) { func TestConfigListImagesRunWithoutPath(t *testing.T) {
testcases := []struct { testcases := []struct {
name string name string
cfg kubeadmapiext.MasterConfiguration cfg kubeadmapiv1alpha1.MasterConfiguration
expectedImages int expectedImages int
}{ }{
{ {
...@@ -133,8 +133,8 @@ func TestConfigListImagesRunWithoutPath(t *testing.T) { ...@@ -133,8 +133,8 @@ func TestConfigListImagesRunWithoutPath(t *testing.T) {
}, },
{ {
name: "external etcd configuration", name: "external etcd configuration",
cfg: kubeadmapiext.MasterConfiguration{ cfg: kubeadmapiv1alpha1.MasterConfiguration{
Etcd: kubeadmapiext.Etcd{ Etcd: kubeadmapiv1alpha1.Etcd{
Endpoints: []string{"hi"}, Endpoints: []string{"hi"},
}, },
}, },
...@@ -142,7 +142,7 @@ func TestConfigListImagesRunWithoutPath(t *testing.T) { ...@@ -142,7 +142,7 @@ func TestConfigListImagesRunWithoutPath(t *testing.T) {
}, },
{ {
name: "coredns enabled", name: "coredns enabled",
cfg: kubeadmapiext.MasterConfiguration{ cfg: kubeadmapiv1alpha1.MasterConfiguration{
FeatureGates: map[string]bool{ FeatureGates: map[string]bool{
features.CoreDNS: true, features.CoreDNS: true,
}, },
......
...@@ -36,7 +36,7 @@ import ( ...@@ -36,7 +36,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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"
...@@ -116,7 +116,7 @@ var ( ...@@ -116,7 +116,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 {
cfg := &kubeadmapiext.MasterConfiguration{} cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
legacyscheme.Scheme.Default(cfg) legacyscheme.Scheme.Default(cfg)
var cfgPath string var cfgPath string
...@@ -156,7 +156,7 @@ func NewCmdInit(out io.Writer) *cobra.Command { ...@@ -156,7 +156,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 *kubeadmapiext.MasterConfiguration, featureGatesString *string) { func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha1.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.",
......
...@@ -32,7 +32,7 @@ import ( ...@@ -32,7 +32,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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 ( ...@@ -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 := &kubeadmapiext.NodeConfiguration{} cfg := &kubeadmapiv1alpha1.NodeConfiguration{}
legacyscheme.Scheme.Default(cfg) legacyscheme.Scheme.Default(cfg)
var skipPreFlight bool var skipPreFlight bool
...@@ -129,7 +129,7 @@ func NewCmdJoin(out io.Writer) *cobra.Command { ...@@ -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 *kubeadmapiext.NodeConfiguration, args []string, skipPreFlight bool, cfgPath, featureGatesString string, ignorePreflightErrors []string) (*Join, error) { func NewValidJoin(cfg *kubeadmapiv1alpha1.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 *kubeadmapiext.NodeConfiguration, args []string, skipPreFl ...@@ -150,7 +150,7 @@ func NewValidJoin(cfg *kubeadmapiext.NodeConfiguration, args []string, skipPreFl
} }
// 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 *kubeadmapiext.NodeConfiguration, featureGatesString *string) { func AddJoinConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1alpha1.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.")
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,7 @@ import (
"testing" "testing"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/legacyscheme"
) )
...@@ -146,7 +146,7 @@ func TestNewValidJoin(t *testing.T) { ...@@ -146,7 +146,7 @@ func TestNewValidJoin(t *testing.T) {
} }
var out bytes.Buffer var out bytes.Buffer
cfg := &kubeadmapiext.NodeConfiguration{} cfg := &kubeadmapiv1alpha1.NodeConfiguration{}
legacyscheme.Scheme.Default(cfg) legacyscheme.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"
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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 ...@@ -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 := &kubeadmapiext.MasterConfiguration{} cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
// Default values for the cobra help text // Default values for the cobra help text
legacyscheme.Scheme.Default(cfg) legacyscheme.Scheme.Default(cfg)
...@@ -164,7 +164,7 @@ func getAddonsSubCommands() []*cobra.Command { ...@@ -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 *kubeadmapiext.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 *kubeadmapiv1alpha1.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.
......
...@@ -27,7 +27,7 @@ import ( ...@@ -27,7 +27,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{ cfg := &kubeadmapiv1alpha1.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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{ cfg := &kubeadmapiv1alpha1.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 ...@@ -278,7 +278,7 @@ func NewSubCmdNodeBootstrapTokenAutoApprove(kubeConfigFile *string) *cobra.Comma
return cmd return cmd
} }
func addBootstrapTokenFlags(flagSet *pflag.FlagSet, cfg *kubeadmapiext.MasterConfiguration, cfgPath, description *string, skipTokenPrint *bool) { func addBootstrapTokenFlags(flagSet *pflag.FlagSet, cfg *kubeadmapiv1alpha1.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 *kubeadmapiext.MasterCon ...@@ -309,7 +309,7 @@ func addBootstrapTokenFlags(flagSet *pflag.FlagSet, cfg *kubeadmapiext.MasterCon
) )
} }
func createBootstrapToken(kubeConfigFile string, client clientset.Interface, cfgPath string, cfg *kubeadmapiext.MasterConfiguration, description string, skipTokenPrint bool) error { func createBootstrapToken(kubeConfigFile string, client clientset.Interface, cfgPath string, cfg *kubeadmapiv1alpha1.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)
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ 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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{} cfg := &kubeadmapiv1alpha1.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 { ...@@ -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 *kubeadmapiext.MasterConfiguration) func(cmd *cobra.Command, args []string) { func runCmdFunc(cmdFunc func(cfg *kubeadmapi.MasterConfiguration) error, cfgPath *string, cfg *kubeadmapiv1alpha1.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.
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{} cfg := &kubeadmapiv1alpha1.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 ...@@ -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 *kubeadmapiext.MasterConfiguration) func(cmd *cobra.Command, args []string) { func runCmdControlPlane(cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error, outDir, cfgPath *string, featureGatesString *string, cfg *kubeadmapiv1alpha1.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.
......
...@@ -22,7 +22,7 @@ import ( ...@@ -22,7 +22,7 @@ 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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{} cfg := &kubeadmapiv1alpha1.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 ( ...@@ -24,7 +24,7 @@ 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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{} cfg := &kubeadmapiv1alpha1.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
......
...@@ -23,7 +23,7 @@ import ( ...@@ -23,7 +23,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{ cfg := &kubeadmapiv1alpha1.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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{ cfg := &kubeadmapiv1alpha1.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 { ...@@ -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 := &kubeadmapiext.NodeConfiguration{} cfg := &kubeadmapiv1alpha1.NodeConfiguration{}
legacyscheme.Scheme.Default(cfg) legacyscheme.Scheme.Default(cfg)
var cfgPath string var cfgPath string
...@@ -182,7 +182,7 @@ func NewCmdKubeletEnableDynamicConfig() *cobra.Command { ...@@ -182,7 +182,7 @@ func NewCmdKubeletEnableDynamicConfig() *cobra.Command {
return cmd return cmd
} }
func getNodeName(cfgPath string, cfg *kubeadmapiext.NodeConfiguration) (string, error) { func getNodeName(cfgPath string, cfg *kubeadmapiv1alpha1.NodeConfiguration) (string, error) {
if cfgPath != "" { if cfgPath != "" {
b, err := ioutil.ReadFile(cfgPath) b, err := ioutil.ReadFile(cfgPath)
if err != nil { if err != nil {
......
...@@ -19,7 +19,7 @@ package phases ...@@ -19,7 +19,7 @@ package phases
import ( import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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 ( ...@@ -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 := &kubeadmapiext.MasterConfiguration{ cfg := &kubeadmapiv1alpha1.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",
......
...@@ -23,7 +23,7 @@ import ( ...@@ -23,7 +23,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{} cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
// Default values for the cobra help text // Default values for the cobra help text
legacyscheme.Scheme.Default(cfg) legacyscheme.Scheme.Default(cfg)
......
...@@ -22,7 +22,7 @@ import ( ...@@ -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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{} defaultcfg := &kubeadmapiv1alpha1.MasterConfiguration{}
internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, defaultcfg) internalcfg, err := configutil.ConfigFileAndDefaultsToInternalConfig(cfgPath, defaultcfg)
kubeadmutil.CheckErr(err) kubeadmutil.CheckErr(err)
......
...@@ -20,14 +20,14 @@ import ( ...@@ -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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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 *kubeadmapiext.MasterConfiguration) func(cmd *cobra.Command, args []string) { func runCmdPhase(cmdFunc func(outDir string, cfg *kubeadmapi.MasterConfiguration) error, outDir, cfgPath *string, cfg *kubeadmapiv1alpha1.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 ( ...@@ -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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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 { ...@@ -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", kubeadmapiext.DefaultCertificatesDir, &certsDir, "cert-dir", kubeadmapiv1alpha1.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 { ...@@ -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 != kubeadmapiext.DefaultCertificatesDir { if r.certsDir != kubeadmapiv1alpha1.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 ( ...@@ -25,7 +25,7 @@ import (
"strings" "strings"
"testing" "testing"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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) { ...@@ -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 := kubeadmapiext.DefaultCertificatesDir certsDir := kubeadmapiv1alpha1.DefaultCertificatesDir
criSocketPath := "/var/run/dockershim.sock" criSocketPath := "/var/run/dockershim.sock"
skipPreFlight := false skipPreFlight := false
forceReset := true forceReset := true
......
...@@ -37,7 +37,7 @@ import ( ...@@ -37,7 +37,7 @@ import (
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"
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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 { ...@@ -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 := &kubeadmapiext.MasterConfiguration{ cfg := &kubeadmapiv1alpha1.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 { ...@@ -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 *kubeadmapiext.MasterConfiguration, description string, printJoinCommand bool, kubeConfigFile string) error { func RunCreateToken(out io.Writer, client clientset.Interface, cfgPath string, cfg *kubeadmapiv1alpha1.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 ( ...@@ -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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
) )
const ( const (
...@@ -180,7 +180,7 @@ func TestRunCreateToken(t *testing.T) { ...@@ -180,7 +180,7 @@ func TestRunCreateToken(t *testing.T) {
}, },
} }
for _, tc := range testCases { for _, tc := range testCases {
cfg := &kubeadmapiext.MasterConfiguration{ cfg := &kubeadmapiv1alpha1.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
......
...@@ -29,7 +29,7 @@ import ( ...@@ -29,7 +29,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
fakediscovery "k8s.io/client-go/discovery/fake" fakediscovery "k8s.io/client-go/discovery/fake"
clientset "k8s.io/client-go/kubernetes" clientset "k8s.io/client-go/kubernetes"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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"
...@@ -42,7 +42,7 @@ import ( ...@@ -42,7 +42,7 @@ import (
// TODO - Restructure or rename upgradeVariables // TODO - Restructure or rename upgradeVariables
type upgradeVariables struct { type upgradeVariables struct {
client clientset.Interface client clientset.Interface
cfg *kubeadmapiext.MasterConfiguration cfg *kubeadmapiv1alpha1.MasterConfiguration
versionGetter upgrade.VersionGetter versionGetter upgrade.VersionGetter
waiter apiclient.Waiter waiter apiclient.Waiter
} }
...@@ -94,7 +94,7 @@ func enforceRequirements(flags *cmdUpgradeFlags, dryRun bool, newK8sVersion stri ...@@ -94,7 +94,7 @@ func enforceRequirements(flags *cmdUpgradeFlags, dryRun bool, newK8sVersion stri
} }
// printConfiguration prints the external version of the API to yaml // printConfiguration prints the external version of the API to yaml
func printConfiguration(cfg *kubeadmapiext.MasterConfiguration, w io.Writer) { func printConfiguration(cfg *kubeadmapiv1alpha1.MasterConfiguration, w io.Writer) {
// Short-circuit if cfg is nil, so we can safely get the value of the pointer below // Short-circuit if cfg is nil, so we can safely get the value of the pointer below
if cfg == nil { if cfg == nil {
return return
......
...@@ -20,12 +20,12 @@ import ( ...@@ -20,12 +20,12 @@ import (
"bytes" "bytes"
"testing" "testing"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
) )
func TestPrintConfiguration(t *testing.T) { func TestPrintConfiguration(t *testing.T) {
var tests = []struct { var tests = []struct {
cfg *kubeadmapiext.MasterConfiguration cfg *kubeadmapiv1alpha1.MasterConfiguration
buf *bytes.Buffer buf *bytes.Buffer
expectedBytes []byte expectedBytes []byte
}{ }{
...@@ -34,7 +34,7 @@ func TestPrintConfiguration(t *testing.T) { ...@@ -34,7 +34,7 @@ func TestPrintConfiguration(t *testing.T) {
expectedBytes: []byte(""), expectedBytes: []byte(""),
}, },
{ {
cfg: &kubeadmapiext.MasterConfiguration{ cfg: &kubeadmapiv1alpha1.MasterConfiguration{
KubernetesVersion: "v1.7.1", KubernetesVersion: "v1.7.1",
}, },
expectedBytes: []byte(`[upgrade/config] Configuration used: expectedBytes: []byte(`[upgrade/config] Configuration used:
...@@ -69,9 +69,9 @@ func TestPrintConfiguration(t *testing.T) { ...@@ -69,9 +69,9 @@ func TestPrintConfiguration(t *testing.T) {
`), `),
}, },
{ {
cfg: &kubeadmapiext.MasterConfiguration{ cfg: &kubeadmapiv1alpha1.MasterConfiguration{
KubernetesVersion: "v1.7.1", KubernetesVersion: "v1.7.1",
Networking: kubeadmapiext.Networking{ Networking: kubeadmapiv1alpha1.Networking{
ServiceSubnet: "10.96.0.1/12", ServiceSubnet: "10.96.0.1/12",
}, },
}, },
...@@ -107,10 +107,10 @@ func TestPrintConfiguration(t *testing.T) { ...@@ -107,10 +107,10 @@ func TestPrintConfiguration(t *testing.T) {
`), `),
}, },
{ {
cfg: &kubeadmapiext.MasterConfiguration{ cfg: &kubeadmapiv1alpha1.MasterConfiguration{
KubernetesVersion: "v1.7.1", KubernetesVersion: "v1.7.1",
Etcd: kubeadmapiext.Etcd{ Etcd: kubeadmapiv1alpha1.Etcd{
SelfHosted: &kubeadmapiext.SelfHostedEtcd{ SelfHosted: &kubeadmapiv1alpha1.SelfHostedEtcd{
CertificatesDir: "/var/foo", CertificatesDir: "/var/foo",
ClusterServiceName: "foo", ClusterServiceName: "foo",
EtcdVersion: "v0.1.0", EtcdVersion: "v0.1.0",
......
...@@ -26,7 +26,7 @@ import ( ...@@ -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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
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) { ...@@ -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 := &kubeadmapiext.MasterConfiguration{ masterConfig := &kubeadmapiv1alpha1.MasterConfiguration{
API: kubeadmapiext.API{ API: kubeadmapiv1alpha1.API{
AdvertiseAddress: "1.2.3.4", AdvertiseAddress: "1.2.3.4",
BindPort: 1234, BindPort: 1234,
}, },
KubeProxy: kubeadmapiext.KubeProxy{ KubeProxy: kubeadmapiv1alpha1.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) { ...@@ -193,7 +193,7 @@ func TestEnsureProxyAddon(t *testing.T) {
}, },
}, },
}, },
Networking: kubeadmapiext.Networking{ Networking: kubeadmapiv1alpha1.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) { ...@@ -214,7 +214,7 @@ func TestEnsureProxyAddon(t *testing.T) {
masterConfig.Networking.PodSubnet = "2001:101::/96" masterConfig.Networking.PodSubnet = "2001:101::/96"
} }
kubeadmapiext.SetDefaults_MasterConfiguration(masterConfig) kubeadmapiv1alpha1.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 ( ...@@ -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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
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 { ...@@ -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", kubeadmapiext.DefaultAuditPolicyLogMaxAge) defaultArguments["audit-log-maxage"] = fmt.Sprintf("%d", kubeadmapiv1alpha1.DefaultAuditPolicyLogMaxAge)
} else { } else {
defaultArguments["audit-log-maxage"] = fmt.Sprintf("%d", *cfg.AuditPolicyConfiguration.LogMaxAge) defaultArguments["audit-log-maxage"] = fmt.Sprintf("%d", *cfg.AuditPolicyConfiguration.LogMaxAge)
} }
...@@ -390,7 +390,7 @@ func getAuthzParameters(modes []string) []string { ...@@ -390,7 +390,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", kubeadmapiext.DefaultAuthorizationModes)} return []string{fmt.Sprintf("--authorization-mode=%s", kubeadmapiv1alpha1.DefaultAuthorizationModes)}
} }
if strset.Has(authzmodes.ModeABAC) { if strset.Has(authzmodes.ModeABAC) {
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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"
configutil "k8s.io/kubernetes/cmd/kubeadm/app/util/config" configutil "k8s.io/kubernetes/cmd/kubeadm/app/util/config"
...@@ -33,7 +33,7 @@ import ( ...@@ -33,7 +33,7 @@ import (
) )
// FetchConfiguration fetches configuration required for upgrading your cluster from a file (which has precedence) or a ConfigMap in the cluster // FetchConfiguration fetches configuration required for upgrading your cluster from a file (which has precedence) or a ConfigMap in the cluster
func FetchConfiguration(client clientset.Interface, w io.Writer, cfgPath string) (*kubeadmapiext.MasterConfiguration, error) { func FetchConfiguration(client clientset.Interface, w io.Writer, cfgPath string) (*kubeadmapiv1alpha1.MasterConfiguration, error) {
fmt.Println("[upgrade/config] Making sure the configuration is correct:") fmt.Println("[upgrade/config] Making sure the configuration is correct:")
// Load the configuration from a file or the cluster // Load the configuration from a file or the cluster
...@@ -52,7 +52,7 @@ func FetchConfiguration(client clientset.Interface, w io.Writer, cfgPath string) ...@@ -52,7 +52,7 @@ func FetchConfiguration(client clientset.Interface, w io.Writer, cfgPath string)
} }
// FetchConfigurationFromFile fetch configuration from a file // FetchConfigurationFromFile fetch configuration from a file
func FetchConfigurationFromFile(cfgPath string) (*kubeadmapiext.MasterConfiguration, error) { func FetchConfigurationFromFile(cfgPath string) (*kubeadmapiv1alpha1.MasterConfiguration, error) {
// Load the configuration from a file or the cluster // Load the configuration from a file or the cluster
configBytes, err := ioutil.ReadFile(cfgPath) configBytes, err := ioutil.ReadFile(cfgPath)
if err != nil { if err != nil {
...@@ -97,17 +97,17 @@ func loadConfigurationBytes(client clientset.Interface, w io.Writer, cfgPath str ...@@ -97,17 +97,17 @@ func loadConfigurationBytes(client clientset.Interface, w io.Writer, cfgPath str
} }
// bytesToValidatedMasterConfig converts a byte array to an external, defaulted and validated configuration object // bytesToValidatedMasterConfig converts a byte array to an external, defaulted and validated configuration object
func bytesToValidatedMasterConfig(b []byte) (*kubeadmapiext.MasterConfiguration, error) { func bytesToValidatedMasterConfig(b []byte) (*kubeadmapiv1alpha1.MasterConfiguration, error) {
cfg := &kubeadmapiext.MasterConfiguration{} cfg := &kubeadmapiv1alpha1.MasterConfiguration{}
finalCfg := &kubeadmapiext.MasterConfiguration{} finalCfg := &kubeadmapiv1alpha1.MasterConfiguration{}
internalcfg := &kubeadmapi.MasterConfiguration{} internalcfg := &kubeadmapi.MasterConfiguration{}
decoded, err := kubeadmapiext.LoadYAML(b) decoded, err := kubeadmapiv1alpha1.LoadYAML(b)
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to decode config from bytes: %v", err) return nil, fmt.Errorf("unable to decode config from bytes: %v", err)
} }
if err := kubeadmapiext.Migrate(decoded, cfg); err != nil { if err := kubeadmapiv1alpha1.Migrate(decoded, cfg); err != nil {
return nil, fmt.Errorf("unable to migrate config from previous version: %v", err) return nil, fmt.Errorf("unable to migrate config from previous version: %v", err)
} }
// Default and convert to the internal version // Default and convert to the internal version
......
...@@ -28,7 +28,7 @@ import ( ...@@ -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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
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 ...@@ -88,7 +88,7 @@ func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.MasterC
errs = append(errs, err) errs = append(errs, err)
} }
certAndKeyDir := kubeadmapiext.DefaultCertificatesDir certAndKeyDir := kubeadmapiv1alpha1.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 {
......
...@@ -30,7 +30,7 @@ import ( ...@@ -30,7 +30,7 @@ import (
"github.com/coreos/etcd/pkg/transport" "github.com/coreos/etcd/pkg/transport"
"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"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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"
...@@ -485,7 +485,7 @@ func getAPIServerHash(dir string) (string, error) { ...@@ -485,7 +485,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 := &kubeadmapiext.MasterConfiguration{} externalcfg := &kubeadmapiv1alpha1.MasterConfiguration{}
internalcfg := &kubeadmapi.MasterConfiguration{} internalcfg := &kubeadmapi.MasterConfiguration{}
if err := runtime.DecodeInto(legacyscheme.Codecs.UniversalDecoder(), []byte(fmt.Sprintf(testConfiguration, certsDir, etcdDataDir, version)), externalcfg); err != nil { if err := runtime.DecodeInto(legacyscheme.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)
......
...@@ -24,7 +24,7 @@ import ( ...@@ -24,7 +24,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"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme" "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
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 ...@@ -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 := &kubeadmapiext.MasterConfiguration{} externalcfg := &kubeadmapiv1alpha1.MasterConfiguration{}
legacyscheme.Scheme.Convert(cfg, externalcfg, nil) legacyscheme.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, kubeadmapiext.SchemeGroupVersion, scheme.Codecs) cfgYaml, err := util.MarshalToYamlForCodecs(externalcfg, kubeadmapiv1alpha1.SchemeGroupVersion, scheme.Codecs)
if err != nil { if err != nil {
return err return err
} }
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
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"
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants" kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/api/legacyscheme"
) )
...@@ -96,7 +96,7 @@ func TestUploadConfiguration(t *testing.T) { ...@@ -96,7 +96,7 @@ func TestUploadConfiguration(t *testing.T) {
t.Errorf("Fail to find ConfigMap key") t.Errorf("Fail to find ConfigMap key")
} }
decodedExtCfg := &kubeadmapiext.MasterConfiguration{} decodedExtCfg := &kubeadmapiv1alpha1.MasterConfiguration{}
decodedCfg := &kubeadmapi.MasterConfiguration{} decodedCfg := &kubeadmapi.MasterConfiguration{}
if err := runtime.DecodeInto(legacyscheme.Codecs.UniversalDecoder(), []byte(configData), decodedExtCfg); err != nil { if err := runtime.DecodeInto(legacyscheme.Codecs.UniversalDecoder(), []byte(configData), decodedExtCfg); err != nil {
......
...@@ -26,7 +26,7 @@ import ( ...@@ -26,7 +26,7 @@ import (
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
netutil "k8s.io/apimachinery/pkg/util/net" netutil "k8s.io/apimachinery/pkg/util/net"
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
kubeadmapiext "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1" kubeadmapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1alpha1"
"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"
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util" kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
...@@ -53,9 +53,9 @@ func SetInitDynamicDefaults(cfg *kubeadmapi.MasterConfiguration) error { ...@@ -53,9 +53,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 = kubeadmapiext.DefaultProxyBindAddressv4 cfg.KubeProxy.Config.BindAddress = kubeadmapiv1alpha1.DefaultProxyBindAddressv4
} else { } else {
cfg.KubeProxy.Config.BindAddress = kubeadmapiext.DefaultProxyBindAddressv6 cfg.KubeProxy.Config.BindAddress = kubeadmapiv1alpha1.DefaultProxyBindAddressv6
} }
// Resolve possible version labels and validate version string // Resolve possible version labels and validate version string
err = NormalizeKubernetesVersion(cfg) err = NormalizeKubernetesVersion(cfg)
...@@ -77,7 +77,7 @@ func SetInitDynamicDefaults(cfg *kubeadmapi.MasterConfiguration) error { ...@@ -77,7 +77,7 @@ func SetInitDynamicDefaults(cfg *kubeadmapi.MasterConfiguration) error {
} }
// TryLoadMasterConfiguration tries to loads a Master configuration from the given file (if defined) // TryLoadMasterConfiguration tries to loads a Master configuration from the given file (if defined)
func TryLoadMasterConfiguration(cfgPath string, cfg *kubeadmapiext.MasterConfiguration) error { func TryLoadMasterConfiguration(cfgPath string, cfg *kubeadmapiv1alpha1.MasterConfiguration) error {
if cfgPath != "" { if cfgPath != "" {
b, err := ioutil.ReadFile(cfgPath) b, err := ioutil.ReadFile(cfgPath)
...@@ -97,7 +97,7 @@ func TryLoadMasterConfiguration(cfgPath string, cfg *kubeadmapiext.MasterConfigu ...@@ -97,7 +97,7 @@ func TryLoadMasterConfiguration(cfgPath string, cfg *kubeadmapiext.MasterConfigu
// 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 *kubeadmapiext.MasterConfiguration) (*kubeadmapi.MasterConfiguration, error) { func ConfigFileAndDefaultsToInternalConfig(cfgPath string, defaultversionedcfg *kubeadmapiv1alpha1.MasterConfiguration) (*kubeadmapi.MasterConfiguration, error) {
glog.V(1).Infoln("configuring files and defaults to internal config") glog.V(1).Infoln("configuring files and defaults to internal config")
internalcfg := &kubeadmapi.MasterConfiguration{} internalcfg := &kubeadmapi.MasterConfiguration{}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment