mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Merge pull request #70761 from luxas/rename_apiendpoint
kubeadm v1beta1: InitConfiguration.APIEndpoint -> LocalAPIEndpoint
This commit is contained in:
commit
54fe139d4e
@ -46,8 +46,13 @@ type InitConfiguration struct {
|
|||||||
// NodeRegistration holds fields that relate to registering the new master node to the cluster
|
// NodeRegistration holds fields that relate to registering the new master node to the cluster
|
||||||
NodeRegistration NodeRegistrationOptions
|
NodeRegistration NodeRegistrationOptions
|
||||||
|
|
||||||
// APIEndpoint represents the endpoint of the instance of the API server to be deployed on this node.
|
// LocalAPIEndpoint represents the endpoint of the API server instance that's deployed on this control plane node
|
||||||
APIEndpoint APIEndpoint
|
// In HA setups, this differs from ClusterConfiguration.ControlPlaneEndpoint in the sense that ControlPlaneEndpoint
|
||||||
|
// is the global endpoint for the cluster, which then loadbalances the requests to each individual API server. This
|
||||||
|
// configuration object lets you customize what IP/DNS name and port the local API server advertises it's accessible
|
||||||
|
// on. By default, kubeadm tries to auto-detect the IP of the default interface and use that, but in case that process
|
||||||
|
// fails you may set the desired value here.
|
||||||
|
LocalAPIEndpoint APIEndpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
@ -24,6 +24,20 @@ import (
|
|||||||
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func Convert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error {
|
||||||
|
if err := autoConvert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration(in, out, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return Convert_v1alpha3_APIEndpoint_To_kubeadm_APIEndpoint(&in.APIEndpoint, &out.LocalAPIEndpoint, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Convert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error {
|
||||||
|
if err := autoConvert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(in, out, s); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return Convert_kubeadm_APIEndpoint_To_v1alpha3_APIEndpoint(&in.LocalAPIEndpoint, &out.APIEndpoint, s)
|
||||||
|
}
|
||||||
|
|
||||||
func Convert_v1alpha3_JoinConfiguration_To_kubeadm_JoinConfiguration(in *JoinConfiguration, out *kubeadm.JoinConfiguration, s conversion.Scope) error {
|
func Convert_v1alpha3_JoinConfiguration_To_kubeadm_JoinConfiguration(in *JoinConfiguration, out *kubeadm.JoinConfiguration, s conversion.Scope) error {
|
||||||
if err := autoConvert_v1alpha3_JoinConfiguration_To_kubeadm_JoinConfiguration(in, out, s); err != nil {
|
if err := autoConvert_v1alpha3_JoinConfiguration_To_kubeadm_JoinConfiguration(in, out, s); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -187,6 +187,11 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.AddConversionFunc((*kubeadm.InitConfiguration)(nil), (*InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(a.(*kubeadm.InitConfiguration), b.(*InitConfiguration), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.AddConversionFunc((*kubeadm.JoinConfiguration)(nil), (*JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
if err := s.AddConversionFunc((*kubeadm.JoinConfiguration)(nil), (*JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
return Convert_kubeadm_JoinConfiguration_To_v1alpha3_JoinConfiguration(a.(*kubeadm.JoinConfiguration), b.(*JoinConfiguration), scope)
|
return Convert_kubeadm_JoinConfiguration_To_v1alpha3_JoinConfiguration(a.(*kubeadm.JoinConfiguration), b.(*JoinConfiguration), scope)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@ -202,6 +207,11 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.AddConversionFunc((*InitConfiguration)(nil), (*kubeadm.InitConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration(a.(*InitConfiguration), b.(*kubeadm.InitConfiguration), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.AddConversionFunc((*JoinConfiguration)(nil), (*kubeadm.JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
if err := s.AddConversionFunc((*JoinConfiguration)(nil), (*kubeadm.JoinConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
return Convert_v1alpha3_JoinConfiguration_To_kubeadm_JoinConfiguration(a.(*JoinConfiguration), b.(*kubeadm.JoinConfiguration), scope)
|
return Convert_v1alpha3_JoinConfiguration_To_kubeadm_JoinConfiguration(a.(*JoinConfiguration), b.(*kubeadm.JoinConfiguration), scope)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@ -454,17 +464,10 @@ func autoConvert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration(in *Ini
|
|||||||
if err := Convert_v1alpha3_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
if err := Convert_v1alpha3_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := Convert_v1alpha3_APIEndpoint_To_kubeadm_APIEndpoint(&in.APIEndpoint, &out.APIEndpoint, s); err != nil {
|
// WARNING: in.APIEndpoint requires manual conversion: does not exist in peer-type
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration is an autogenerated conversion function.
|
|
||||||
func Convert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error {
|
|
||||||
return autoConvert_v1alpha3_InitConfiguration_To_kubeadm_InitConfiguration(in, out, s)
|
|
||||||
}
|
|
||||||
|
|
||||||
func autoConvert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error {
|
func autoConvert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error {
|
||||||
if err := Convert_kubeadm_ClusterConfiguration_To_v1alpha3_ClusterConfiguration(&in.ClusterConfiguration, &out.ClusterConfiguration, s); err != nil {
|
if err := Convert_kubeadm_ClusterConfiguration_To_v1alpha3_ClusterConfiguration(&in.ClusterConfiguration, &out.ClusterConfiguration, s); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -473,17 +476,10 @@ func autoConvert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(in *kub
|
|||||||
if err := Convert_kubeadm_NodeRegistrationOptions_To_v1alpha3_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
if err := Convert_kubeadm_NodeRegistrationOptions_To_v1alpha3_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := Convert_kubeadm_APIEndpoint_To_v1alpha3_APIEndpoint(&in.APIEndpoint, &out.APIEndpoint, s); err != nil {
|
// WARNING: in.LocalAPIEndpoint requires manual conversion: does not exist in peer-type
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration is an autogenerated conversion function.
|
|
||||||
func Convert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error {
|
|
||||||
return autoConvert_kubeadm_InitConfiguration_To_v1alpha3_InitConfiguration(in, out, s)
|
|
||||||
}
|
|
||||||
|
|
||||||
func autoConvert_v1alpha3_JoinConfiguration_To_kubeadm_JoinConfiguration(in *JoinConfiguration, out *kubeadm.JoinConfiguration, s conversion.Scope) error {
|
func autoConvert_v1alpha3_JoinConfiguration_To_kubeadm_JoinConfiguration(in *JoinConfiguration, out *kubeadm.JoinConfiguration, s conversion.Scope) error {
|
||||||
if err := Convert_v1alpha3_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
if err := Convert_v1alpha3_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -70,7 +70,7 @@ func SetDefaults_InitConfiguration(obj *InitConfiguration) {
|
|||||||
SetDefaults_ClusterConfiguration(&obj.ClusterConfiguration)
|
SetDefaults_ClusterConfiguration(&obj.ClusterConfiguration)
|
||||||
SetDefaults_NodeRegistrationOptions(&obj.NodeRegistration)
|
SetDefaults_NodeRegistrationOptions(&obj.NodeRegistration)
|
||||||
SetDefaults_BootstrapTokens(obj)
|
SetDefaults_BootstrapTokens(obj)
|
||||||
SetDefaults_APIEndpoint(&obj.APIEndpoint)
|
SetDefaults_APIEndpoint(&obj.LocalAPIEndpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDefaults_ClusterConfiguration assigns default values for the ClusterConfiguration
|
// SetDefaults_ClusterConfiguration assigns default values for the ClusterConfiguration
|
||||||
|
@ -45,8 +45,13 @@ type InitConfiguration struct {
|
|||||||
// NodeRegistration holds fields that relate to registering the new master node to the cluster
|
// NodeRegistration holds fields that relate to registering the new master node to the cluster
|
||||||
NodeRegistration NodeRegistrationOptions `json:"nodeRegistration,omitempty"`
|
NodeRegistration NodeRegistrationOptions `json:"nodeRegistration,omitempty"`
|
||||||
|
|
||||||
// APIEndpoint represents the endpoint of the instance of the API server to be deployed on this node.
|
// LocalAPIEndpoint represents the endpoint of the API server instance that's deployed on this control plane node
|
||||||
APIEndpoint APIEndpoint `json:"apiEndpoint,omitempty"`
|
// In HA setups, this differs from ClusterConfiguration.ControlPlaneEndpoint in the sense that ControlPlaneEndpoint
|
||||||
|
// is the global endpoint for the cluster, which then loadbalances the requests to each individual API server. This
|
||||||
|
// configuration object lets you customize what IP/DNS name and port the local API server advertises it's accessible
|
||||||
|
// on. By default, kubeadm tries to auto-detect the IP of the default interface and use that, but in case that process
|
||||||
|
// fails you may set the desired value here.
|
||||||
|
LocalAPIEndpoint APIEndpoint `json:"localAPIEndpoint,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
@ -624,7 +624,7 @@ func autoConvert_v1beta1_InitConfiguration_To_kubeadm_InitConfiguration(in *Init
|
|||||||
if err := Convert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
if err := Convert_v1beta1_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := Convert_v1beta1_APIEndpoint_To_kubeadm_APIEndpoint(&in.APIEndpoint, &out.APIEndpoint, s); err != nil {
|
if err := Convert_v1beta1_APIEndpoint_To_kubeadm_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -643,7 +643,7 @@ func autoConvert_kubeadm_InitConfiguration_To_v1beta1_InitConfiguration(in *kube
|
|||||||
if err := Convert_kubeadm_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
if err := Convert_kubeadm_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := Convert_kubeadm_APIEndpoint_To_v1beta1_APIEndpoint(&in.APIEndpoint, &out.APIEndpoint, s); err != nil {
|
if err := Convert_kubeadm_APIEndpoint_To_v1beta1_APIEndpoint(&in.LocalAPIEndpoint, &out.LocalAPIEndpoint, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -388,7 +388,7 @@ func (in *InitConfiguration) DeepCopyInto(out *InitConfiguration) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.NodeRegistration.DeepCopyInto(&out.NodeRegistration)
|
in.NodeRegistration.DeepCopyInto(&out.NodeRegistration)
|
||||||
out.APIEndpoint = in.APIEndpoint
|
out.LocalAPIEndpoint = in.LocalAPIEndpoint
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ func SetObjectDefaults_InitConfiguration(in *InitConfiguration) {
|
|||||||
SetDefaults_BootstrapToken(a)
|
SetDefaults_BootstrapToken(a)
|
||||||
}
|
}
|
||||||
SetDefaults_NodeRegistrationOptions(&in.NodeRegistration)
|
SetDefaults_NodeRegistrationOptions(&in.NodeRegistration)
|
||||||
SetDefaults_APIEndpoint(&in.APIEndpoint)
|
SetDefaults_APIEndpoint(&in.LocalAPIEndpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetObjectDefaults_JoinConfiguration(in *JoinConfiguration) {
|
func SetObjectDefaults_JoinConfiguration(in *JoinConfiguration) {
|
||||||
|
@ -49,7 +49,7 @@ func ValidateInitConfiguration(c *kubeadm.InitConfiguration) field.ErrorList {
|
|||||||
allErrs = append(allErrs, ValidateNodeRegistrationOptions(&c.NodeRegistration, field.NewPath("nodeRegistration"))...)
|
allErrs = append(allErrs, ValidateNodeRegistrationOptions(&c.NodeRegistration, field.NewPath("nodeRegistration"))...)
|
||||||
allErrs = append(allErrs, ValidateBootstrapTokens(c.BootstrapTokens, field.NewPath("bootstrapTokens"))...)
|
allErrs = append(allErrs, ValidateBootstrapTokens(c.BootstrapTokens, field.NewPath("bootstrapTokens"))...)
|
||||||
allErrs = append(allErrs, ValidateClusterConfiguration(&c.ClusterConfiguration)...)
|
allErrs = append(allErrs, ValidateClusterConfiguration(&c.ClusterConfiguration)...)
|
||||||
allErrs = append(allErrs, ValidateAPIEndpoint(&c.APIEndpoint, field.NewPath("apiEndpoint"))...)
|
allErrs = append(allErrs, ValidateAPIEndpoint(&c.LocalAPIEndpoint, field.NewPath("localAPIEndpoint"))...)
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ func TestValidateInitConfiguration(t *testing.T) {
|
|||||||
&kubeadm.InitConfiguration{}, false},
|
&kubeadm.InitConfiguration{}, false},
|
||||||
{"invalid missing token with IPv4 service subnet",
|
{"invalid missing token with IPv4 service subnet",
|
||||||
&kubeadm.InitConfiguration{
|
&kubeadm.InitConfiguration{
|
||||||
APIEndpoint: kubeadm.APIEndpoint{
|
LocalAPIEndpoint: kubeadm.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
BindPort: 6443,
|
BindPort: 6443,
|
||||||
},
|
},
|
||||||
@ -374,7 +374,7 @@ func TestValidateInitConfiguration(t *testing.T) {
|
|||||||
}, false},
|
}, false},
|
||||||
{"invalid missing token with IPv6 service subnet",
|
{"invalid missing token with IPv6 service subnet",
|
||||||
&kubeadm.InitConfiguration{
|
&kubeadm.InitConfiguration{
|
||||||
APIEndpoint: kubeadm.APIEndpoint{
|
LocalAPIEndpoint: kubeadm.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
BindPort: 6443,
|
BindPort: 6443,
|
||||||
},
|
},
|
||||||
@ -389,7 +389,7 @@ func TestValidateInitConfiguration(t *testing.T) {
|
|||||||
}, false},
|
}, false},
|
||||||
{"invalid missing node name",
|
{"invalid missing node name",
|
||||||
&kubeadm.InitConfiguration{
|
&kubeadm.InitConfiguration{
|
||||||
APIEndpoint: kubeadm.APIEndpoint{
|
LocalAPIEndpoint: kubeadm.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
BindPort: 6443,
|
BindPort: 6443,
|
||||||
},
|
},
|
||||||
@ -403,7 +403,7 @@ func TestValidateInitConfiguration(t *testing.T) {
|
|||||||
}, false},
|
}, false},
|
||||||
{"valid master configuration with incorrect IPv4 pod subnet",
|
{"valid master configuration with incorrect IPv4 pod subnet",
|
||||||
&kubeadm.InitConfiguration{
|
&kubeadm.InitConfiguration{
|
||||||
APIEndpoint: kubeadm.APIEndpoint{
|
LocalAPIEndpoint: kubeadm.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
BindPort: 6443,
|
BindPort: 6443,
|
||||||
},
|
},
|
||||||
@ -419,7 +419,7 @@ func TestValidateInitConfiguration(t *testing.T) {
|
|||||||
}, false},
|
}, false},
|
||||||
{"valid master configuration with IPv4 service subnet",
|
{"valid master configuration with IPv4 service subnet",
|
||||||
&kubeadm.InitConfiguration{
|
&kubeadm.InitConfiguration{
|
||||||
APIEndpoint: kubeadm.APIEndpoint{
|
LocalAPIEndpoint: kubeadm.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
BindPort: 6443,
|
BindPort: 6443,
|
||||||
},
|
},
|
||||||
@ -466,7 +466,7 @@ func TestValidateInitConfiguration(t *testing.T) {
|
|||||||
}, true},
|
}, true},
|
||||||
{"valid master configuration using IPv6 service subnet",
|
{"valid master configuration using IPv6 service subnet",
|
||||||
&kubeadm.InitConfiguration{
|
&kubeadm.InitConfiguration{
|
||||||
APIEndpoint: kubeadm.APIEndpoint{
|
LocalAPIEndpoint: kubeadm.APIEndpoint{
|
||||||
AdvertiseAddress: "1:2:3::4",
|
AdvertiseAddress: "1:2:3::4",
|
||||||
BindPort: 3446,
|
BindPort: 3446,
|
||||||
},
|
},
|
||||||
|
@ -417,7 +417,7 @@ func (in *InitConfiguration) DeepCopyInto(out *InitConfiguration) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.NodeRegistration.DeepCopyInto(&out.NodeRegistration)
|
in.NodeRegistration.DeepCopyInto(&out.NodeRegistration)
|
||||||
out.APIEndpoint = in.APIEndpoint
|
out.LocalAPIEndpoint = in.LocalAPIEndpoint
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,8 +96,8 @@ func newCmdUserKubeConfig(out io.Writer) *cobra.Command {
|
|||||||
|
|
||||||
// Add flags to the command
|
// Add flags to the command
|
||||||
cmd.Flags().StringVar(&cfg.CertificatesDir, "cert-dir", cfg.CertificatesDir, "The path where certificates are stored")
|
cmd.Flags().StringVar(&cfg.CertificatesDir, "cert-dir", cfg.CertificatesDir, "The path where certificates are stored")
|
||||||
cmd.Flags().StringVar(&cfg.APIEndpoint.AdvertiseAddress, "apiserver-advertise-address", cfg.APIEndpoint.AdvertiseAddress, "The IP address the API server is accessible on")
|
cmd.Flags().StringVar(&cfg.LocalAPIEndpoint.AdvertiseAddress, "apiserver-advertise-address", cfg.LocalAPIEndpoint.AdvertiseAddress, "The IP address the API server is accessible on")
|
||||||
cmd.Flags().Int32Var(&cfg.APIEndpoint.BindPort, "apiserver-bind-port", cfg.APIEndpoint.BindPort, "The port the API server is accessible on")
|
cmd.Flags().Int32Var(&cfg.LocalAPIEndpoint.BindPort, "apiserver-bind-port", cfg.LocalAPIEndpoint.BindPort, "The port the API server is accessible on")
|
||||||
cmd.Flags().StringVar(&token, "token", token, "The token that should be used as the authentication mechanism for this kubeconfig, instead of client certificates")
|
cmd.Flags().StringVar(&token, "token", token, "The token that should be used as the authentication mechanism for this kubeconfig, instead of client certificates")
|
||||||
cmd.Flags().StringVar(&clientName, "client-name", clientName, "The name of user. It will be used as the CN if client certificates are created")
|
cmd.Flags().StringVar(&clientName, "client-name", clientName, "The name of user. It will be used as the CN if client certificates are created")
|
||||||
cmd.Flags().StringSliceVar(&organizations, "org", organizations, "The orgnizations of the client certificate. It will be used as the O if client certificates are created")
|
cmd.Flags().StringSliceVar(&organizations, "org", organizations, "The orgnizations of the client certificate. It will be used as the O if client certificates are created")
|
||||||
|
@ -243,7 +243,7 @@ func getAllAPIObjectNames() []string {
|
|||||||
func getDefaultedInitConfig() (*kubeadmapi.InitConfiguration, error) {
|
func getDefaultedInitConfig() (*kubeadmapi.InitConfiguration, error) {
|
||||||
return configutil.ConfigFileAndDefaultsToInternalConfig("", &kubeadmapiv1beta1.InitConfiguration{
|
return configutil.ConfigFileAndDefaultsToInternalConfig("", &kubeadmapiv1beta1.InitConfiguration{
|
||||||
// TODO: Probably move to getDefaultedClusterConfig?
|
// TODO: Probably move to getDefaultedClusterConfig?
|
||||||
APIEndpoint: kubeadmapiv1beta1.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapiv1beta1.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapiv1beta1.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapiv1beta1.ClusterConfiguration{
|
||||||
KubernetesVersion: fmt.Sprintf("v1.%d.0", constants.MinimumControlPlaneVersion.Minor()+1),
|
KubernetesVersion: fmt.Sprintf("v1.%d.0", constants.MinimumControlPlaneVersion.Minor()+1),
|
||||||
},
|
},
|
||||||
|
@ -199,11 +199,11 @@ 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 *kubeadmapiv1beta1.InitConfiguration, featureGatesString *string) {
|
func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1beta1.InitConfiguration, featureGatesString *string) {
|
||||||
flagSet.StringVar(
|
flagSet.StringVar(
|
||||||
&cfg.APIEndpoint.AdvertiseAddress, options.APIServerAdvertiseAddress, cfg.APIEndpoint.AdvertiseAddress,
|
&cfg.LocalAPIEndpoint.AdvertiseAddress, options.APIServerAdvertiseAddress, cfg.LocalAPIEndpoint.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.",
|
||||||
)
|
)
|
||||||
flagSet.Int32Var(
|
flagSet.Int32Var(
|
||||||
&cfg.APIEndpoint.BindPort, options.APIServerBindPort, cfg.APIEndpoint.BindPort,
|
&cfg.LocalAPIEndpoint.BindPort, options.APIServerBindPort, cfg.LocalAPIEndpoint.BindPort,
|
||||||
"Port for the API Server to bind to.",
|
"Port for the API Server to bind to.",
|
||||||
)
|
)
|
||||||
flagSet.StringVar(
|
flagSet.StringVar(
|
||||||
@ -313,7 +313,7 @@ func newInitData(cmd *cobra.Command, options *initOptions, out io.Writer) (initD
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return initData{}, err
|
return initData{}, err
|
||||||
}
|
}
|
||||||
if err := configutil.VerifyAPIServerBindAddress(cfg.APIEndpoint.AdvertiseAddress); err != nil {
|
if err := configutil.VerifyAPIServerBindAddress(cfg.LocalAPIEndpoint.AdvertiseAddress); err != nil {
|
||||||
return initData{}, err
|
return initData{}, err
|
||||||
}
|
}
|
||||||
if err := features.ValidateVersion(features.InitFeatureGates, cfg.FeatureGates, cfg.KubernetesVersion); err != nil {
|
if err := features.ValidateVersion(features.InitFeatureGates, cfg.FeatureGates, cfg.KubernetesVersion); err != nil {
|
||||||
|
@ -609,7 +609,7 @@ func fetchInitConfigurationFromJoinConfiguration(cfg *kubeadmapi.JoinConfigurati
|
|||||||
|
|
||||||
// injects into the kubeadm configuration the information about the joining node
|
// injects into the kubeadm configuration the information about the joining node
|
||||||
initConfiguration.NodeRegistration = cfg.NodeRegistration
|
initConfiguration.NodeRegistration = cfg.NodeRegistration
|
||||||
initConfiguration.APIEndpoint = cfg.APIEndpoint
|
initConfiguration.LocalAPIEndpoint = cfg.APIEndpoint
|
||||||
|
|
||||||
return initConfiguration, tlsBootstrapCfg, nil
|
return initConfiguration, tlsBootstrapCfg, nil
|
||||||
}
|
}
|
||||||
|
@ -149,8 +149,8 @@ func getAddonsSubCommands() []*cobra.Command {
|
|||||||
cmd.Flags().StringVar(&cfg.ImageRepository, "image-repository", cfg.ImageRepository, `Choose a container registry to pull control plane images from`)
|
cmd.Flags().StringVar(&cfg.ImageRepository, "image-repository", cfg.ImageRepository, `Choose a container registry to pull control plane images from`)
|
||||||
|
|
||||||
if properties.use == "all" || properties.use == "kube-proxy" {
|
if properties.use == "all" || properties.use == "kube-proxy" {
|
||||||
cmd.Flags().StringVar(&cfg.APIEndpoint.AdvertiseAddress, "apiserver-advertise-address", cfg.APIEndpoint.AdvertiseAddress, `The IP address the API server is accessible on`)
|
cmd.Flags().StringVar(&cfg.LocalAPIEndpoint.AdvertiseAddress, "apiserver-advertise-address", cfg.LocalAPIEndpoint.AdvertiseAddress, `The IP address the API server is accessible on`)
|
||||||
cmd.Flags().Int32Var(&cfg.APIEndpoint.BindPort, "apiserver-bind-port", cfg.APIEndpoint.BindPort, `The port the API server is accessible on`)
|
cmd.Flags().Int32Var(&cfg.LocalAPIEndpoint.BindPort, "apiserver-bind-port", cfg.LocalAPIEndpoint.BindPort, `The port the API server is accessible on`)
|
||||||
cmd.Flags().StringVar(&cfg.Networking.PodSubnet, "pod-network-cidr", cfg.Networking.PodSubnet, `The range of IP addresses used for the Pod network`)
|
cmd.Flags().StringVar(&cfg.Networking.PodSubnet, "pod-network-cidr", cfg.Networking.PodSubnet, `The range of IP addresses used for the Pod network`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ func getCertPhaseFlags(name string) []string {
|
|||||||
func getSANDescription(certSpec *certsphase.KubeadmCert) string {
|
func getSANDescription(certSpec *certsphase.KubeadmCert) string {
|
||||||
//Defaulted config we will use to get SAN certs
|
//Defaulted config we will use to get SAN certs
|
||||||
defaultConfig := &kubeadmapiv1beta1.InitConfiguration{
|
defaultConfig := &kubeadmapiv1beta1.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapiv1beta1.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapiv1beta1.APIEndpoint{
|
||||||
// GetAPIServerAltNames errors without an AdvertiseAddress; this is as good as any.
|
// GetAPIServerAltNames errors without an AdvertiseAddress; this is as good as any.
|
||||||
AdvertiseAddress: "127.0.0.1",
|
AdvertiseAddress: "127.0.0.1",
|
||||||
},
|
},
|
||||||
|
@ -174,7 +174,7 @@ func TestEnsureProxyAddon(t *testing.T) {
|
|||||||
client := clientsetfake.NewSimpleClientset()
|
client := clientsetfake.NewSimpleClientset()
|
||||||
// TODO: Consider using a YAML file instead for this that makes it possible to specify YAML documents for the ComponentConfigs
|
// TODO: Consider using a YAML file instead for this that makes it possible to specify YAML documents for the ComponentConfigs
|
||||||
masterConfig := &kubeadmapiv1beta1.InitConfiguration{
|
masterConfig := &kubeadmapiv1beta1.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapiv1beta1.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapiv1beta1.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
BindPort: 1234,
|
BindPort: 1234,
|
||||||
},
|
},
|
||||||
@ -194,9 +194,9 @@ func TestEnsureProxyAddon(t *testing.T) {
|
|||||||
return true, nil, apierrors.NewUnauthorized("")
|
return true, nil, apierrors.NewUnauthorized("")
|
||||||
})
|
})
|
||||||
case InvalidMasterEndpoint:
|
case InvalidMasterEndpoint:
|
||||||
masterConfig.APIEndpoint.AdvertiseAddress = "1.2.3"
|
masterConfig.LocalAPIEndpoint.AdvertiseAddress = "1.2.3"
|
||||||
case IPv6SetBindAddress:
|
case IPv6SetBindAddress:
|
||||||
masterConfig.APIEndpoint.AdvertiseAddress = "1:2::3:4"
|
masterConfig.LocalAPIEndpoint.AdvertiseAddress = "1:2::3:4"
|
||||||
masterConfig.Networking.PodSubnet = "2001:101::/96"
|
masterConfig.Networking.PodSubnet = "2001:101::/96"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ func TestUsingExternalCA(t *testing.T) {
|
|||||||
defer os.RemoveAll(dir)
|
defer os.RemoveAll(dir)
|
||||||
|
|
||||||
cfg := &kubeadmapi.InitConfiguration{
|
cfg := &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
||||||
CertificatesDir: dir,
|
CertificatesDir: dir,
|
||||||
@ -675,7 +675,7 @@ func TestCreateCertificateFilesMethods(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpdir)
|
defer os.RemoveAll(tmpdir)
|
||||||
|
|
||||||
cfg := &kubeadmapi.InitConfiguration{
|
cfg := &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Etcd: kubeadmapi.Etcd{Local: &kubeadmapi.LocalEtcd{}},
|
Etcd: kubeadmapi.Etcd{Local: &kubeadmapi.LocalEtcd{}},
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
||||||
|
@ -60,7 +60,7 @@ func GetStaticPodSpecs(cfg *kubeadmapi.InitConfiguration, k8sVersion *version.Ve
|
|||||||
ImagePullPolicy: v1.PullIfNotPresent,
|
ImagePullPolicy: v1.PullIfNotPresent,
|
||||||
Command: getAPIServerCommand(cfg),
|
Command: getAPIServerCommand(cfg),
|
||||||
VolumeMounts: staticpodutil.VolumeMountMapToSlice(mounts.GetVolumeMounts(kubeadmconstants.KubeAPIServer)),
|
VolumeMounts: staticpodutil.VolumeMountMapToSlice(mounts.GetVolumeMounts(kubeadmconstants.KubeAPIServer)),
|
||||||
LivenessProbe: staticpodutil.ComponentProbe(cfg, kubeadmconstants.KubeAPIServer, int(cfg.APIEndpoint.BindPort), "/healthz", v1.URISchemeHTTPS),
|
LivenessProbe: staticpodutil.ComponentProbe(cfg, kubeadmconstants.KubeAPIServer, int(cfg.LocalAPIEndpoint.BindPort), "/healthz", v1.URISchemeHTTPS),
|
||||||
Resources: staticpodutil.ComponentResources("250m"),
|
Resources: staticpodutil.ComponentResources("250m"),
|
||||||
Env: getProxyEnvVars(),
|
Env: getProxyEnvVars(),
|
||||||
}, mounts.GetVolumes(kubeadmconstants.KubeAPIServer)),
|
}, mounts.GetVolumes(kubeadmconstants.KubeAPIServer)),
|
||||||
@ -122,7 +122,7 @@ func CreateStaticPodFiles(manifestDir string, cfg *kubeadmapi.InitConfiguration,
|
|||||||
// getAPIServerCommand builds the right API server command from the given config object and version
|
// getAPIServerCommand builds the right API server command from the given config object and version
|
||||||
func getAPIServerCommand(cfg *kubeadmapi.InitConfiguration) []string {
|
func getAPIServerCommand(cfg *kubeadmapi.InitConfiguration) []string {
|
||||||
defaultArguments := map[string]string{
|
defaultArguments := map[string]string{
|
||||||
"advertise-address": cfg.APIEndpoint.AdvertiseAddress,
|
"advertise-address": cfg.LocalAPIEndpoint.AdvertiseAddress,
|
||||||
"insecure-port": "0",
|
"insecure-port": "0",
|
||||||
"enable-admission-plugins": "NodeRestriction",
|
"enable-admission-plugins": "NodeRestriction",
|
||||||
"service-cluster-ip-range": cfg.Networking.ServiceSubnet,
|
"service-cluster-ip-range": cfg.Networking.ServiceSubnet,
|
||||||
@ -133,7 +133,7 @@ func getAPIServerCommand(cfg *kubeadmapi.InitConfiguration) []string {
|
|||||||
"kubelet-client-certificate": filepath.Join(cfg.CertificatesDir, kubeadmconstants.APIServerKubeletClientCertName),
|
"kubelet-client-certificate": filepath.Join(cfg.CertificatesDir, kubeadmconstants.APIServerKubeletClientCertName),
|
||||||
"kubelet-client-key": filepath.Join(cfg.CertificatesDir, kubeadmconstants.APIServerKubeletClientKeyName),
|
"kubelet-client-key": filepath.Join(cfg.CertificatesDir, kubeadmconstants.APIServerKubeletClientKeyName),
|
||||||
"enable-bootstrap-token-auth": "true",
|
"enable-bootstrap-token-auth": "true",
|
||||||
"secure-port": fmt.Sprintf("%d", cfg.APIEndpoint.BindPort),
|
"secure-port": fmt.Sprintf("%d", cfg.LocalAPIEndpoint.BindPort),
|
||||||
"allow-privileged": "true",
|
"allow-privileged": "true",
|
||||||
"kubelet-preferred-address-types": "InternalIP,ExternalIP,Hostname",
|
"kubelet-preferred-address-types": "InternalIP,ExternalIP,Hostname",
|
||||||
// add options to configure the front proxy. Without the generated client cert, this will never be useable
|
// add options to configure the front proxy. Without the generated client cert, this will never be useable
|
||||||
|
@ -146,7 +146,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "testing defaults",
|
name: "testing defaults",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
CertificatesDir: testCertsDir,
|
CertificatesDir: testCertsDir,
|
||||||
@ -185,7 +185,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "ignores the audit policy if the feature gate is not enabled",
|
name: "ignores the audit policy if the feature gate is not enabled",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "4.3.2.1"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "4.3.2.1"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
CertificatesDir: testCertsDir,
|
CertificatesDir: testCertsDir,
|
||||||
@ -229,7 +229,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "ipv6 advertise address",
|
name: "ipv6 advertise address",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
CertificatesDir: testCertsDir,
|
CertificatesDir: testCertsDir,
|
||||||
@ -268,7 +268,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "an external etcd with custom ca, certs and keys",
|
name: "an external etcd with custom ca, certs and keys",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
Etcd: kubeadmapi.Etcd{
|
Etcd: kubeadmapi.Etcd{
|
||||||
@ -315,7 +315,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "an insecure etcd",
|
name: "an insecure etcd",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
Etcd: kubeadmapi.Etcd{
|
Etcd: kubeadmapi.Etcd{
|
||||||
@ -356,7 +356,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "auditing is enabled with a custom log max age of 0",
|
name: "auditing is enabled with a custom log max age of 0",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "2001:db8::1"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
FeatureGates: map[string]bool{features.Auditing: true},
|
FeatureGates: map[string]bool{features.Auditing: true},
|
||||||
@ -402,7 +402,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "ensure the DynamicKubelet flag gets passed through",
|
name: "ensure the DynamicKubelet flag gets passed through",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
CertificatesDir: testCertsDir,
|
CertificatesDir: testCertsDir,
|
||||||
@ -443,7 +443,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "test APIServer.ExtraArgs works as expected",
|
name: "test APIServer.ExtraArgs works as expected",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
CertificatesDir: testCertsDir,
|
CertificatesDir: testCertsDir,
|
||||||
@ -497,7 +497,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "authorization-mode extra-args ABAC",
|
name: "authorization-mode extra-args ABAC",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
CertificatesDir: testCertsDir,
|
CertificatesDir: testCertsDir,
|
||||||
@ -543,7 +543,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "insecure-port extra-args",
|
name: "insecure-port extra-args",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
CertificatesDir: testCertsDir,
|
CertificatesDir: testCertsDir,
|
||||||
@ -589,7 +589,7 @@ func TestGetAPIServerCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "authorization-mode extra-args Webhook",
|
name: "authorization-mode extra-args Webhook",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{BindPort: 123, AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "bar"},
|
||||||
CertificatesDir: testCertsDir,
|
CertificatesDir: testCertsDir,
|
||||||
@ -971,7 +971,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "caKeyPresent-false for v1.12.0-beta.2",
|
name: "caKeyPresent-false for v1.12.0-beta.2",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
KubernetesVersion: "v1.12.0-beta.2",
|
KubernetesVersion: "v1.12.0-beta.2",
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
||||||
@ -1000,7 +1000,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "caKeyPresent true for v1.12.0-beta.2",
|
name: "caKeyPresent true for v1.12.0-beta.2",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
KubernetesVersion: "v1.12.0-beta.2",
|
KubernetesVersion: "v1.12.0-beta.2",
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
||||||
@ -1029,7 +1029,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "caKeyPresent-false for v1.11.3",
|
name: "caKeyPresent-false for v1.11.3",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
KubernetesVersion: "v1.11.3",
|
KubernetesVersion: "v1.11.3",
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
||||||
@ -1054,7 +1054,7 @@ func TestGetControllerManagerCommandExternalCA(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "caKeyPresent true for v1.11.3",
|
name: "caKeyPresent true for v1.11.3",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
KubernetesVersion: "v1.11.3",
|
KubernetesVersion: "v1.11.3",
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
||||||
|
@ -90,7 +90,7 @@ func CreateStackedEtcdStaticPodManifestFile(client clientset.Interface, manifest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// notifies the other members of the etcd cluster about the joining member
|
// notifies the other members of the etcd cluster about the joining member
|
||||||
etcdPeerAddress := fmt.Sprintf("https://%s:%d", cfg.APIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort)
|
etcdPeerAddress := fmt.Sprintf("https://%s:%d", cfg.LocalAPIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort)
|
||||||
|
|
||||||
glog.V(1).Infof("Adding etcd member: %s", etcdPeerAddress)
|
glog.V(1).Infof("Adding etcd member: %s", etcdPeerAddress)
|
||||||
initialCluster, err := etcdClient.AddMember(cfg.NodeRegistration.Name, etcdPeerAddress)
|
initialCluster, err := etcdClient.AddMember(cfg.NodeRegistration.Name, etcdPeerAddress)
|
||||||
@ -141,10 +141,10 @@ func GetEtcdPodSpec(cfg *kubeadmapi.InitConfiguration, initialCluster []etcdutil
|
|||||||
func getEtcdCommand(cfg *kubeadmapi.InitConfiguration, initialCluster []etcdutil.Member) []string {
|
func getEtcdCommand(cfg *kubeadmapi.InitConfiguration, initialCluster []etcdutil.Member) []string {
|
||||||
defaultArguments := map[string]string{
|
defaultArguments := map[string]string{
|
||||||
"name": cfg.GetNodeName(),
|
"name": cfg.GetNodeName(),
|
||||||
"listen-client-urls": fmt.Sprintf("https://127.0.0.1:%d,https://%s:%d", kubeadmconstants.EtcdListenClientPort, cfg.APIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenClientPort),
|
"listen-client-urls": fmt.Sprintf("https://127.0.0.1:%d,https://%s:%d", kubeadmconstants.EtcdListenClientPort, cfg.LocalAPIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenClientPort),
|
||||||
"advertise-client-urls": fmt.Sprintf("https://%s:%d", cfg.APIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenClientPort),
|
"advertise-client-urls": fmt.Sprintf("https://%s:%d", cfg.LocalAPIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenClientPort),
|
||||||
"listen-peer-urls": fmt.Sprintf("https://%s:%d", cfg.APIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort),
|
"listen-peer-urls": fmt.Sprintf("https://%s:%d", cfg.LocalAPIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort),
|
||||||
"initial-advertise-peer-urls": fmt.Sprintf("https://%s:%d", cfg.APIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort),
|
"initial-advertise-peer-urls": fmt.Sprintf("https://%s:%d", cfg.LocalAPIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort),
|
||||||
"data-dir": cfg.Etcd.Local.DataDir,
|
"data-dir": cfg.Etcd.Local.DataDir,
|
||||||
"cert-file": filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdServerCertName),
|
"cert-file": filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdServerCertName),
|
||||||
"key-file": filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdServerKeyName),
|
"key-file": filepath.Join(cfg.CertificatesDir, kubeadmconstants.EtcdServerKeyName),
|
||||||
@ -158,7 +158,7 @@ func getEtcdCommand(cfg *kubeadmapi.InitConfiguration, initialCluster []etcdutil
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(initialCluster) == 0 {
|
if len(initialCluster) == 0 {
|
||||||
defaultArguments["initial-cluster"] = fmt.Sprintf("%s=https://%s:%d", cfg.GetNodeName(), cfg.APIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort)
|
defaultArguments["initial-cluster"] = fmt.Sprintf("%s=https://%s:%d", cfg.GetNodeName(), cfg.LocalAPIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort)
|
||||||
} else {
|
} else {
|
||||||
// NB. the joining etcd instance should be part of the initialCluster list
|
// NB. the joining etcd instance should be part of the initialCluster list
|
||||||
endpoints := []string{}
|
endpoints := []string{}
|
||||||
|
@ -124,7 +124,7 @@ func TestGetEtcdCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "Default args - with empty etcd initial cluster",
|
name: "Default args - with empty etcd initial cluster",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
},
|
},
|
||||||
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
||||||
@ -161,7 +161,7 @@ func TestGetEtcdCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "Default args - With an existing etcd cluster",
|
name: "Default args - With an existing etcd cluster",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
},
|
},
|
||||||
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
||||||
@ -203,7 +203,7 @@ func TestGetEtcdCommand(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "Extra args",
|
name: "Extra args",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
},
|
},
|
||||||
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
||||||
|
@ -69,14 +69,14 @@ func TestGetKubeConfigSpecs(t *testing.T) {
|
|||||||
// Creates Master Configurations pointing to the pkidir folder
|
// Creates Master Configurations pointing to the pkidir folder
|
||||||
cfgs := []*kubeadmapi.InitConfiguration{
|
cfgs := []*kubeadmapi.InitConfiguration{
|
||||||
{
|
{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
CertificatesDir: pkidir,
|
CertificatesDir: pkidir,
|
||||||
},
|
},
|
||||||
NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"},
|
NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
ControlPlaneEndpoint: "api.k8s.io",
|
ControlPlaneEndpoint: "api.k8s.io",
|
||||||
CertificatesDir: pkidir,
|
CertificatesDir: pkidir,
|
||||||
@ -84,7 +84,7 @@ func TestGetKubeConfigSpecs(t *testing.T) {
|
|||||||
NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"},
|
NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
ControlPlaneEndpoint: "api.k8s.io:4321",
|
ControlPlaneEndpoint: "api.k8s.io:4321",
|
||||||
CertificatesDir: pkidir,
|
CertificatesDir: pkidir,
|
||||||
@ -92,7 +92,7 @@ func TestGetKubeConfigSpecs(t *testing.T) {
|
|||||||
NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"},
|
NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
ControlPlaneEndpoint: "api.k8s.io",
|
ControlPlaneEndpoint: "api.k8s.io",
|
||||||
CertificatesDir: pkidir,
|
CertificatesDir: pkidir,
|
||||||
@ -100,7 +100,7 @@ func TestGetKubeConfigSpecs(t *testing.T) {
|
|||||||
NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"},
|
NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-node-name"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
ControlPlaneEndpoint: "api.k8s.io:4321",
|
ControlPlaneEndpoint: "api.k8s.io:4321",
|
||||||
CertificatesDir: pkidir,
|
CertificatesDir: pkidir,
|
||||||
@ -307,7 +307,7 @@ func TestCreateKubeconfigFilesAndWrappers(t *testing.T) {
|
|||||||
|
|
||||||
// Creates a Master Configuration pointing to the pkidir folder
|
// Creates a Master Configuration pointing to the pkidir folder
|
||||||
cfg := &kubeadmapi.InitConfiguration{
|
cfg := &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
CertificatesDir: pkidir,
|
CertificatesDir: pkidir,
|
||||||
},
|
},
|
||||||
@ -384,7 +384,7 @@ func TestWriteKubeConfig(t *testing.T) {
|
|||||||
|
|
||||||
// Creates a Master Configuration pointing to the pkidir folder
|
// Creates a Master Configuration pointing to the pkidir folder
|
||||||
cfg := &kubeadmapi.InitConfiguration{
|
cfg := &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4", BindPort: 1234},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
CertificatesDir: pkidir,
|
CertificatesDir: pkidir,
|
||||||
},
|
},
|
||||||
@ -506,7 +506,7 @@ func TestValidateKubeconfigsForExternalCA(t *testing.T) {
|
|||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
CertificatesDir: pkiDir,
|
CertificatesDir: pkiDir,
|
||||||
},
|
},
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
BindPort: 1234,
|
BindPort: 1234,
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
},
|
},
|
||||||
|
@ -130,7 +130,7 @@ func TestRollbackFiles(t *testing.T) {
|
|||||||
|
|
||||||
func TestShouldBackupAPIServerCertAndKey(t *testing.T) {
|
func TestShouldBackupAPIServerCertAndKey(t *testing.T) {
|
||||||
cfg := &kubeadmapi.InitConfiguration{
|
cfg := &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
||||||
},
|
},
|
||||||
|
@ -282,7 +282,7 @@ func performEtcdStaticPodUpgrade(client clientset.Interface, waiter apiclient.Wa
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return true, errors.Wrap(err, "failed to retrieve the current etcd version")
|
return true, errors.Wrap(err, "failed to retrieve the current etcd version")
|
||||||
}
|
}
|
||||||
currentEtcdVersionStr, ok := currentEtcdVersions[fmt.Sprintf("https://%s:%d", cfg.APIEndpoint.AdvertiseAddress, constants.EtcdListenClientPort)]
|
currentEtcdVersionStr, ok := currentEtcdVersions[fmt.Sprintf("https://%s:%d", cfg.LocalAPIEndpoint.AdvertiseAddress, constants.EtcdListenClientPort)]
|
||||||
if !ok {
|
if !ok {
|
||||||
fmt.Println(currentEtcdVersions)
|
fmt.Println(currentEtcdVersions)
|
||||||
return true, errors.Wrap(err, "failed to retrieve the current etcd version")
|
return true, errors.Wrap(err, "failed to retrieve the current etcd version")
|
||||||
|
@ -65,7 +65,7 @@ func UploadConfiguration(cfg *kubeadmapi.InitConfiguration, client clientset.Int
|
|||||||
if clusterStatus.APIEndpoints == nil {
|
if clusterStatus.APIEndpoints == nil {
|
||||||
clusterStatus.APIEndpoints = map[string]kubeadmapi.APIEndpoint{}
|
clusterStatus.APIEndpoints = map[string]kubeadmapi.APIEndpoint{}
|
||||||
}
|
}
|
||||||
clusterStatus.APIEndpoints[cfg.NodeRegistration.Name] = cfg.APIEndpoint
|
clusterStatus.APIEndpoints[cfg.NodeRegistration.Name] = cfg.LocalAPIEndpoint
|
||||||
|
|
||||||
// Marshal the ClusterStatus back into YAML
|
// Marshal the ClusterStatus back into YAML
|
||||||
clusterStatusYaml, err := configutil.MarshalKubeadmConfigObject(clusterStatus)
|
clusterStatusYaml, err := configutil.MarshalKubeadmConfigObject(clusterStatus)
|
||||||
|
@ -65,7 +65,7 @@ func TestUploadConfiguration(t *testing.T) {
|
|||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t2 *testing.T) {
|
t.Run(tt.name, func(t2 *testing.T) {
|
||||||
initialcfg := &kubeadmapiv1beta1.InitConfiguration{
|
initialcfg := &kubeadmapiv1beta1.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapiv1beta1.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapiv1beta1.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
},
|
},
|
||||||
ClusterConfiguration: kubeadmapiv1beta1.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapiv1beta1.ClusterConfiguration{
|
||||||
@ -95,7 +95,7 @@ func TestUploadConfiguration(t *testing.T) {
|
|||||||
|
|
||||||
status := &kubeadmapi.ClusterStatus{
|
status := &kubeadmapi.ClusterStatus{
|
||||||
APIEndpoints: map[string]kubeadmapi.APIEndpoint{
|
APIEndpoints: map[string]kubeadmapi.APIEndpoint{
|
||||||
"node-foo": cfg.APIEndpoint,
|
"node-foo": cfg.LocalAPIEndpoint,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -875,15 +875,15 @@ func RunInitMasterChecks(execer utilsexec.Interface, cfg *kubeadmapi.InitConfigu
|
|||||||
checks := []Checker{
|
checks := []Checker{
|
||||||
NumCPUCheck{NumCPU: kubeadmconstants.MasterNumCPU},
|
NumCPUCheck{NumCPU: kubeadmconstants.MasterNumCPU},
|
||||||
KubernetesVersionCheck{KubernetesVersion: cfg.KubernetesVersion, KubeadmVersion: kubeadmversion.Get().GitVersion},
|
KubernetesVersionCheck{KubernetesVersion: cfg.KubernetesVersion, KubeadmVersion: kubeadmversion.Get().GitVersion},
|
||||||
FirewalldCheck{ports: []int{int(cfg.APIEndpoint.BindPort), 10250}},
|
FirewalldCheck{ports: []int{int(cfg.LocalAPIEndpoint.BindPort), 10250}},
|
||||||
PortOpenCheck{port: int(cfg.APIEndpoint.BindPort)},
|
PortOpenCheck{port: int(cfg.LocalAPIEndpoint.BindPort)},
|
||||||
PortOpenCheck{port: 10251},
|
PortOpenCheck{port: 10251},
|
||||||
PortOpenCheck{port: 10252},
|
PortOpenCheck{port: 10252},
|
||||||
FileAvailableCheck{Path: kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.KubeAPIServer, manifestsDir)},
|
FileAvailableCheck{Path: kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.KubeAPIServer, manifestsDir)},
|
||||||
FileAvailableCheck{Path: kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.KubeControllerManager, manifestsDir)},
|
FileAvailableCheck{Path: kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.KubeControllerManager, manifestsDir)},
|
||||||
FileAvailableCheck{Path: kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.KubeScheduler, manifestsDir)},
|
FileAvailableCheck{Path: kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.KubeScheduler, manifestsDir)},
|
||||||
FileAvailableCheck{Path: kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.Etcd, manifestsDir)},
|
FileAvailableCheck{Path: kubeadmconstants.GetStaticPodFilepath(kubeadmconstants.Etcd, manifestsDir)},
|
||||||
HTTPProxyCheck{Proto: "https", Host: cfg.APIEndpoint.AdvertiseAddress},
|
HTTPProxyCheck{Proto: "https", Host: cfg.LocalAPIEndpoint.AdvertiseAddress},
|
||||||
HTTPProxyCIDRCheck{Proto: "https", CIDR: cfg.Networking.ServiceSubnet},
|
HTTPProxyCIDRCheck{Proto: "https", CIDR: cfg.Networking.ServiceSubnet},
|
||||||
HTTPProxyCIDRCheck{Proto: "https", CIDR: cfg.Networking.PodSubnet},
|
HTTPProxyCIDRCheck{Proto: "https", CIDR: cfg.Networking.PodSubnet},
|
||||||
}
|
}
|
||||||
@ -919,7 +919,7 @@ func RunInitMasterChecks(execer utilsexec.Interface, cfg *kubeadmapi.InitConfigu
|
|||||||
checks = append(checks, ExternalEtcdVersionCheck{Etcd: cfg.Etcd})
|
checks = append(checks, ExternalEtcdVersionCheck{Etcd: cfg.Etcd})
|
||||||
}
|
}
|
||||||
|
|
||||||
if ip := net.ParseIP(cfg.APIEndpoint.AdvertiseAddress); ip != nil {
|
if ip := net.ParseIP(cfg.LocalAPIEndpoint.AdvertiseAddress); ip != nil {
|
||||||
if ip.To4() == nil && ip.To16() != nil {
|
if ip.To4() == nil && ip.To16() != nil {
|
||||||
checks = append(checks,
|
checks = append(checks,
|
||||||
FileContentCheck{Path: bridgenf6, Content: []byte{'1'}},
|
FileContentCheck{Path: bridgenf6, Content: []byte{'1'}},
|
||||||
|
@ -191,7 +191,7 @@ func TestRunInitMasterChecks(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{name: "Test valid advertised address",
|
{name: "Test valid advertised address",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "foo"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "foo"},
|
||||||
},
|
},
|
||||||
expected: false,
|
expected: false,
|
||||||
},
|
},
|
||||||
@ -224,7 +224,7 @@ func TestRunInitMasterChecks(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "2001:1234::1:15"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "2001:1234::1:15"},
|
||||||
},
|
},
|
||||||
expected: false,
|
expected: false,
|
||||||
},
|
},
|
||||||
|
@ -121,7 +121,7 @@ func getInitConfigurationFromCluster(kubeconfigDir string, client clientset.Inte
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// gets the APIEndpoint for the current node from then ClusterStatus in the kubeadm-config ConfigMap
|
// gets the APIEndpoint for the current node from then ClusterStatus in the kubeadm-config ConfigMap
|
||||||
if err := getAPIEndpoint(configMap.Data, initcfg.NodeRegistration.Name, &initcfg.APIEndpoint); err != nil {
|
if err := getAPIEndpoint(configMap.Data, initcfg.NodeRegistration.Name, &initcfg.LocalAPIEndpoint); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,7 +459,7 @@ func TestGetAPIEndpoint(t *testing.T) {
|
|||||||
for _, rt := range tests {
|
for _, rt := range tests {
|
||||||
t.Run(rt.name, func(t *testing.T) {
|
t.Run(rt.name, func(t *testing.T) {
|
||||||
cfg := &kubeadmapi.InitConfiguration{}
|
cfg := &kubeadmapi.InitConfiguration{}
|
||||||
err := getAPIEndpoint(rt.configMap.data, nodeName, &cfg.APIEndpoint)
|
err := getAPIEndpoint(rt.configMap.data, nodeName, &cfg.LocalAPIEndpoint)
|
||||||
if rt.expectedError != (err != nil) {
|
if rt.expectedError != (err != nil) {
|
||||||
t.Errorf("unexpected return err from getInitConfigurationFromCluster: %v", err)
|
t.Errorf("unexpected return err from getInitConfigurationFromCluster: %v", err)
|
||||||
return
|
return
|
||||||
@ -468,7 +468,7 @@ func TestGetAPIEndpoint(t *testing.T) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.APIEndpoint.AdvertiseAddress != "1.2.3.4" || cfg.APIEndpoint.BindPort != 1234 {
|
if cfg.LocalAPIEndpoint.AdvertiseAddress != "1.2.3.4" || cfg.LocalAPIEndpoint.BindPort != 1234 {
|
||||||
t.Errorf("invalid cfg.APIEndpoint")
|
t.Errorf("invalid cfg.APIEndpoint")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -757,8 +757,8 @@ func TestGetInitConfigurationFromCluster(t *testing.T) {
|
|||||||
if cfg.ClusterConfiguration.KubernetesVersion != k8sVersionString {
|
if cfg.ClusterConfiguration.KubernetesVersion != k8sVersionString {
|
||||||
t.Errorf("invalid ClusterConfiguration.KubernetesVersion")
|
t.Errorf("invalid ClusterConfiguration.KubernetesVersion")
|
||||||
}
|
}
|
||||||
if !rt.newControlPlane && (cfg.APIEndpoint.AdvertiseAddress != "1.2.3.4" || cfg.APIEndpoint.BindPort != 1234) {
|
if !rt.newControlPlane && (cfg.LocalAPIEndpoint.AdvertiseAddress != "1.2.3.4" || cfg.LocalAPIEndpoint.BindPort != 1234) {
|
||||||
t.Errorf("invalid cfg.APIEndpoint")
|
t.Errorf("invalid cfg.LocalAPIEndpoint")
|
||||||
}
|
}
|
||||||
if cfg.ComponentConfigs.Kubelet == nil {
|
if cfg.ComponentConfigs.Kubelet == nil {
|
||||||
t.Errorf("invalid cfg.ComponentConfigs.Kubelet")
|
t.Errorf("invalid cfg.ComponentConfigs.Kubelet")
|
||||||
|
@ -50,10 +50,10 @@ func SetInitDynamicDefaults(cfg *kubeadmapi.InitConfiguration) error {
|
|||||||
if err := SetNodeRegistrationDynamicDefaults(&cfg.NodeRegistration, true); err != nil {
|
if err := SetNodeRegistrationDynamicDefaults(&cfg.NodeRegistration, true); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := SetAPIEndpointDynamicDefaults(&cfg.APIEndpoint); err != nil {
|
if err := SetAPIEndpointDynamicDefaults(&cfg.LocalAPIEndpoint); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := SetClusterDynamicDefaults(&cfg.ClusterConfiguration, cfg.APIEndpoint.AdvertiseAddress, cfg.APIEndpoint.BindPort); err != nil {
|
if err := SetClusterDynamicDefaults(&cfg.ClusterConfiguration, cfg.LocalAPIEndpoint.AdvertiseAddress, cfg.LocalAPIEndpoint.BindPort); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
APIEndpoint:
|
|
||||||
AdvertiseAddress: 192.168.2.2
|
|
||||||
BindPort: 6443
|
|
||||||
APIServer:
|
APIServer:
|
||||||
CertSANs: null
|
CertSANs: null
|
||||||
ExtraArgs:
|
ExtraArgs:
|
||||||
@ -186,6 +183,9 @@ Etcd:
|
|||||||
FeatureGates: null
|
FeatureGates: null
|
||||||
ImageRepository: k8s.gcr.io
|
ImageRepository: k8s.gcr.io
|
||||||
KubernetesVersion: v1.11.2
|
KubernetesVersion: v1.11.2
|
||||||
|
LocalAPIEndpoint:
|
||||||
|
AdvertiseAddress: 192.168.2.2
|
||||||
|
BindPort: 6443
|
||||||
Networking:
|
Networking:
|
||||||
DNSDomain: cluster.local
|
DNSDomain: cluster.local
|
||||||
PodSubnet: ""
|
PodSubnet: ""
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
apiEndpoint:
|
|
||||||
advertiseAddress: 192.168.2.2
|
|
||||||
bindPort: 6443
|
|
||||||
apiVersion: kubeadm.k8s.io/v1beta1
|
apiVersion: kubeadm.k8s.io/v1beta1
|
||||||
bootstrapTokens:
|
bootstrapTokens:
|
||||||
- groups:
|
- groups:
|
||||||
@ -11,6 +8,9 @@ bootstrapTokens:
|
|||||||
- signing
|
- signing
|
||||||
- authentication
|
- authentication
|
||||||
kind: InitConfiguration
|
kind: InitConfiguration
|
||||||
|
localAPIEndpoint:
|
||||||
|
advertiseAddress: 192.168.2.2
|
||||||
|
bindPort: 6443
|
||||||
nodeRegistration:
|
nodeRegistration:
|
||||||
criSocket: /var/run/dockershim.sock
|
criSocket: /var/run/dockershim.sock
|
||||||
name: master-1
|
name: master-1
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
apiEndpoint:
|
|
||||||
advertiseAddress: 192.168.2.2
|
|
||||||
bindPort: 6443
|
|
||||||
apiVersion: kubeadm.k8s.io/v1beta1
|
apiVersion: kubeadm.k8s.io/v1beta1
|
||||||
bootstrapTokens:
|
bootstrapTokens:
|
||||||
- groups:
|
- groups:
|
||||||
@ -11,6 +8,9 @@ bootstrapTokens:
|
|||||||
- signing
|
- signing
|
||||||
- authentication
|
- authentication
|
||||||
kind: InitConfiguration
|
kind: InitConfiguration
|
||||||
|
localAPIEndpoint:
|
||||||
|
advertiseAddress: 192.168.2.2
|
||||||
|
bindPort: 6443
|
||||||
nodeRegistration:
|
nodeRegistration:
|
||||||
criSocket: /var/run/criruntime.sock
|
criSocket: /var/run/criruntime.sock
|
||||||
name: master-1
|
name: master-1
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
apiVersion: kubeadm.k8s.io/v1beta1
|
apiVersion: kubeadm.k8s.io/v1beta1
|
||||||
kind: InitConfiguration
|
kind: InitConfiguration
|
||||||
apiEndpoint:
|
|
||||||
advertiseAddress: 192.168.2.2
|
|
||||||
bootstrapTokens:
|
bootstrapTokens:
|
||||||
- token: s73ybu.6tw6wnqgp5z0wb77
|
- token: s73ybu.6tw6wnqgp5z0wb77
|
||||||
|
localAPIEndpoint:
|
||||||
|
advertiseAddress: 192.168.2.2
|
||||||
nodeRegistration:
|
nodeRegistration:
|
||||||
criSocket: /var/run/criruntime.sock
|
criSocket: /var/run/criruntime.sock
|
||||||
name: master-1
|
name: master-1
|
||||||
|
@ -34,15 +34,15 @@ import (
|
|||||||
// - Otherwise, in case the ControlPlaneEndpoint is not defined, use the api.AdvertiseAddress + the api.BindPort.
|
// - Otherwise, in case the ControlPlaneEndpoint is not defined, use the api.AdvertiseAddress + the api.BindPort.
|
||||||
func GetMasterEndpoint(cfg *kubeadmapi.InitConfiguration) (string, error) {
|
func GetMasterEndpoint(cfg *kubeadmapi.InitConfiguration) (string, error) {
|
||||||
// parse the bind port
|
// parse the bind port
|
||||||
bindPortString := strconv.Itoa(int(cfg.APIEndpoint.BindPort))
|
bindPortString := strconv.Itoa(int(cfg.LocalAPIEndpoint.BindPort))
|
||||||
if _, err := ParsePort(bindPortString); err != nil {
|
if _, err := ParsePort(bindPortString); err != nil {
|
||||||
return "", errors.Wrapf(err, "invalid value %q given for api.bindPort", cfg.APIEndpoint.BindPort)
|
return "", errors.Wrapf(err, "invalid value %q given for api.bindPort", cfg.LocalAPIEndpoint.BindPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse the AdvertiseAddress
|
// parse the AdvertiseAddress
|
||||||
var ip = net.ParseIP(cfg.APIEndpoint.AdvertiseAddress)
|
var ip = net.ParseIP(cfg.LocalAPIEndpoint.AdvertiseAddress)
|
||||||
if ip == nil {
|
if ip == nil {
|
||||||
return "", errors.Errorf("invalid value `%s` given for api.advertiseAddress", cfg.APIEndpoint.AdvertiseAddress)
|
return "", errors.Errorf("invalid value `%s` given for api.advertiseAddress", cfg.LocalAPIEndpoint.AdvertiseAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the master url using cfg.API.AdvertiseAddress + the cfg.API.BindPort
|
// set the master url using cfg.API.AdvertiseAddress + the cfg.API.BindPort
|
||||||
|
@ -32,7 +32,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "use ControlPlaneEndpoint (dns) if fully defined",
|
name: "use ControlPlaneEndpoint (dns) if fully defined",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
BindPort: 4567,
|
BindPort: 4567,
|
||||||
AdvertiseAddress: "4.5.6.7",
|
AdvertiseAddress: "4.5.6.7",
|
||||||
},
|
},
|
||||||
@ -45,7 +45,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "use ControlPlaneEndpoint (ipv4) if fully defined",
|
name: "use ControlPlaneEndpoint (ipv4) if fully defined",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
BindPort: 4567,
|
BindPort: 4567,
|
||||||
AdvertiseAddress: "4.5.6.7",
|
AdvertiseAddress: "4.5.6.7",
|
||||||
},
|
},
|
||||||
@ -58,7 +58,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "use ControlPlaneEndpoint (ipv6) if fully defined",
|
name: "use ControlPlaneEndpoint (ipv6) if fully defined",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
BindPort: 4567,
|
BindPort: 4567,
|
||||||
AdvertiseAddress: "4.5.6.7",
|
AdvertiseAddress: "4.5.6.7",
|
||||||
},
|
},
|
||||||
@ -71,7 +71,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "use ControlPlaneEndpoint (dns) + BindPort if ControlPlaneEndpoint defined without port",
|
name: "use ControlPlaneEndpoint (dns) + BindPort if ControlPlaneEndpoint defined without port",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
BindPort: 4567,
|
BindPort: 4567,
|
||||||
AdvertiseAddress: "4.5.6.7",
|
AdvertiseAddress: "4.5.6.7",
|
||||||
},
|
},
|
||||||
@ -85,7 +85,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "use ControlPlaneEndpoint (ipv4) + BindPort if ControlPlaneEndpoint defined without port",
|
name: "use ControlPlaneEndpoint (ipv4) + BindPort if ControlPlaneEndpoint defined without port",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
BindPort: 4567,
|
BindPort: 4567,
|
||||||
AdvertiseAddress: "4.5.6.7",
|
AdvertiseAddress: "4.5.6.7",
|
||||||
},
|
},
|
||||||
@ -98,7 +98,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "use ControlPlaneEndpoint (ipv6) + BindPort if ControlPlaneEndpoint defined without port",
|
name: "use ControlPlaneEndpoint (ipv6) + BindPort if ControlPlaneEndpoint defined without port",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
BindPort: 4567,
|
BindPort: 4567,
|
||||||
AdvertiseAddress: "4.5.6.7",
|
AdvertiseAddress: "4.5.6.7",
|
||||||
},
|
},
|
||||||
@ -112,7 +112,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "use AdvertiseAddress (ipv4) + BindPort if ControlPlaneEndpoint is not defined",
|
name: "use AdvertiseAddress (ipv4) + BindPort if ControlPlaneEndpoint is not defined",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
BindPort: 4567,
|
BindPort: 4567,
|
||||||
AdvertiseAddress: "4.5.6.7",
|
AdvertiseAddress: "4.5.6.7",
|
||||||
},
|
},
|
||||||
@ -122,7 +122,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "use AdvertiseAddress (ipv6) + BindPort if ControlPlaneEndpoint is not defined",
|
name: "use AdvertiseAddress (ipv6) + BindPort if ControlPlaneEndpoint is not defined",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
BindPort: 4567,
|
BindPort: 4567,
|
||||||
AdvertiseAddress: "2001:db8::1",
|
AdvertiseAddress: "2001:db8::1",
|
||||||
},
|
},
|
||||||
@ -132,7 +132,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "fail if invalid BindPort",
|
name: "fail if invalid BindPort",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
BindPort: 0,
|
BindPort: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -177,7 +177,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "fail if invalid AdvertiseAddress (ip4)",
|
name: "fail if invalid AdvertiseAddress (ip4)",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
AdvertiseAddress: "1..0",
|
AdvertiseAddress: "1..0",
|
||||||
BindPort: 4567,
|
BindPort: 4567,
|
||||||
},
|
},
|
||||||
@ -187,7 +187,7 @@ func TestGetMasterEndpoint(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "fail if invalid AdvertiseAddress (ip6)",
|
name: "fail if invalid AdvertiseAddress (ip6)",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
AdvertiseAddress: "1200::AB00:1234::2552:7777:1313",
|
AdvertiseAddress: "1200::AB00:1234::2552:7777:1313",
|
||||||
BindPort: 4567,
|
BindPort: 4567,
|
||||||
},
|
},
|
||||||
|
@ -256,10 +256,10 @@ func pathForPublicKey(pkiPath, name string) string {
|
|||||||
// GetAPIServerAltNames builds an AltNames object for to be used when generating apiserver certificate
|
// GetAPIServerAltNames builds an AltNames object for to be used when generating apiserver certificate
|
||||||
func GetAPIServerAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames, error) {
|
func GetAPIServerAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames, error) {
|
||||||
// advertise address
|
// advertise address
|
||||||
advertiseAddress := net.ParseIP(cfg.APIEndpoint.AdvertiseAddress)
|
advertiseAddress := net.ParseIP(cfg.LocalAPIEndpoint.AdvertiseAddress)
|
||||||
if advertiseAddress == nil {
|
if advertiseAddress == nil {
|
||||||
return nil, errors.Errorf("error parsing APIEndpoint AdvertiseAddress %v: is not a valid textual representation of an IP address",
|
return nil, errors.Errorf("error parsing LocalAPIEndpoint AdvertiseAddress %v: is not a valid textual representation of an IP address",
|
||||||
cfg.APIEndpoint.AdvertiseAddress)
|
cfg.LocalAPIEndpoint.AdvertiseAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
// internal IP address for the API server
|
// internal IP address for the API server
|
||||||
@ -311,9 +311,9 @@ func GetAPIServerAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames
|
|||||||
// The user can override the listen address with `Etcd.ExtraArgs` and add SANs with `Etcd.ServerCertSANs`.
|
// The user can override the listen address with `Etcd.ExtraArgs` and add SANs with `Etcd.ServerCertSANs`.
|
||||||
func GetEtcdAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames, error) {
|
func GetEtcdAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames, error) {
|
||||||
// advertise address
|
// advertise address
|
||||||
advertiseAddress := net.ParseIP(cfg.APIEndpoint.AdvertiseAddress)
|
advertiseAddress := net.ParseIP(cfg.LocalAPIEndpoint.AdvertiseAddress)
|
||||||
if advertiseAddress == nil {
|
if advertiseAddress == nil {
|
||||||
return nil, errors.Errorf("error parsing APIEndpoint AdvertiseAddress %q: is not a valid textual representation of an IP address", cfg.APIEndpoint.AdvertiseAddress)
|
return nil, errors.Errorf("error parsing LocalAPIEndpoint AdvertiseAddress %q: is not a valid textual representation of an IP address", cfg.LocalAPIEndpoint.AdvertiseAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
// create AltNames with defaults DNSNames/IPs
|
// create AltNames with defaults DNSNames/IPs
|
||||||
@ -334,10 +334,10 @@ func GetEtcdAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames, err
|
|||||||
// The user can override the listen address with `Etcd.ExtraArgs` and add SANs with `Etcd.PeerCertSANs`.
|
// The user can override the listen address with `Etcd.ExtraArgs` and add SANs with `Etcd.PeerCertSANs`.
|
||||||
func GetEtcdPeerAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames, error) {
|
func GetEtcdPeerAltNames(cfg *kubeadmapi.InitConfiguration) (*certutil.AltNames, error) {
|
||||||
// advertise address
|
// advertise address
|
||||||
advertiseAddress := net.ParseIP(cfg.APIEndpoint.AdvertiseAddress)
|
advertiseAddress := net.ParseIP(cfg.LocalAPIEndpoint.AdvertiseAddress)
|
||||||
if advertiseAddress == nil {
|
if advertiseAddress == nil {
|
||||||
return nil, errors.Errorf("error parsing APIEndpoint AdvertiseAddress %v: is not a valid textual representation of an IP address",
|
return nil, errors.Errorf("error parsing LocalAPIEndpoint AdvertiseAddress %v: is not a valid textual representation of an IP address",
|
||||||
cfg.APIEndpoint.AdvertiseAddress)
|
cfg.LocalAPIEndpoint.AdvertiseAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
// create AltNames with defaults DNSNames/IPs
|
// create AltNames with defaults DNSNames/IPs
|
||||||
|
@ -446,7 +446,7 @@ func TestGetAPIServerAltNames(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "ControlPlaneEndpoint DNS",
|
name: "ControlPlaneEndpoint DNS",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
ControlPlaneEndpoint: "api.k8s.io:6443",
|
ControlPlaneEndpoint: "api.k8s.io:6443",
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
||||||
@ -462,7 +462,7 @@ func TestGetAPIServerAltNames(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "ControlPlaneEndpoint IP",
|
name: "ControlPlaneEndpoint IP",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
ControlPlaneEndpoint: "4.5.6.7:6443",
|
ControlPlaneEndpoint: "4.5.6.7:6443",
|
||||||
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"},
|
||||||
@ -517,7 +517,7 @@ func TestGetEtcdAltNames(t *testing.T) {
|
|||||||
proxy := "user-etcd-proxy"
|
proxy := "user-etcd-proxy"
|
||||||
proxyIP := "10.10.10.100"
|
proxyIP := "10.10.10.100"
|
||||||
cfg := &kubeadmapi.InitConfiguration{
|
cfg := &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
},
|
},
|
||||||
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
NodeRegistration: kubeadmapi.NodeRegistrationOptions{
|
||||||
@ -579,7 +579,7 @@ func TestGetEtcdPeerAltNames(t *testing.T) {
|
|||||||
proxyIP := "10.10.10.100"
|
proxyIP := "10.10.10.100"
|
||||||
advertiseIP := "1.2.3.4"
|
advertiseIP := "1.2.3.4"
|
||||||
cfg := &kubeadmapi.InitConfiguration{
|
cfg := &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: advertiseIP},
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: advertiseIP},
|
||||||
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
ClusterConfiguration: kubeadmapi.ClusterConfiguration{
|
||||||
Etcd: kubeadmapi.Etcd{
|
Etcd: kubeadmapi.Etcd{
|
||||||
Local: &kubeadmapi.LocalEtcd{
|
Local: &kubeadmapi.LocalEtcd{
|
||||||
|
@ -238,8 +238,8 @@ func GetProbeAddress(cfg *kubeadmapi.InitConfiguration, componentName string) st
|
|||||||
// future hosts that do not have the same address. Furthermore, since liveness and readiness
|
// future hosts that do not have the same address. Furthermore, since liveness and readiness
|
||||||
// probes do not support the Downward API we cannot dynamically set the advertise address to
|
// probes do not support the Downward API we cannot dynamically set the advertise address to
|
||||||
// the node's IP. The only option then is to use localhost.
|
// the node's IP. The only option then is to use localhost.
|
||||||
if cfg.APIEndpoint.AdvertiseAddress != "" {
|
if cfg.LocalAPIEndpoint.AdvertiseAddress != "" {
|
||||||
return cfg.APIEndpoint.AdvertiseAddress
|
return cfg.LocalAPIEndpoint.AdvertiseAddress
|
||||||
}
|
}
|
||||||
case componentName == kubeadmconstants.KubeControllerManager:
|
case componentName == kubeadmconstants.KubeControllerManager:
|
||||||
if addr, exists := cfg.ControllerManager.ExtraArgs[kubeControllerManagerAddressArg]; exists {
|
if addr, exists := cfg.ControllerManager.ExtraArgs[kubeControllerManagerAddressArg]; exists {
|
||||||
|
@ -55,7 +55,7 @@ func TestComponentProbe(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "default apiserver advertise address with http",
|
name: "default apiserver advertise address with http",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
AdvertiseAddress: "",
|
AdvertiseAddress: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -68,7 +68,7 @@ func TestComponentProbe(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "default apiserver advertise address with https",
|
name: "default apiserver advertise address with https",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
AdvertiseAddress: "",
|
AdvertiseAddress: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -81,7 +81,7 @@ func TestComponentProbe(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "valid ipv4 apiserver advertise address with http",
|
name: "valid ipv4 apiserver advertise address with http",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
AdvertiseAddress: "1.2.3.4",
|
AdvertiseAddress: "1.2.3.4",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -94,7 +94,7 @@ func TestComponentProbe(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "valid ipv6 apiserver advertise address with http",
|
name: "valid ipv6 apiserver advertise address with http",
|
||||||
cfg: &kubeadmapi.InitConfiguration{
|
cfg: &kubeadmapi.InitConfiguration{
|
||||||
APIEndpoint: kubeadmapi.APIEndpoint{
|
LocalAPIEndpoint: kubeadmapi.APIEndpoint{
|
||||||
AdvertiseAddress: "2001:db8::1",
|
AdvertiseAddress: "2001:db8::1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -58,8 +58,8 @@ func SetupInitConfigurationFile(t *testing.T, tmpdir string, cfg *kubeadmapi.Ini
|
|||||||
apiVersion: kubeadm.k8s.io/v1beta1
|
apiVersion: kubeadm.k8s.io/v1beta1
|
||||||
kind: InitConfiguration
|
kind: InitConfiguration
|
||||||
apiEndpoint:
|
apiEndpoint:
|
||||||
advertiseAddress: {{.APIEndpoint.AdvertiseAddress}}
|
advertiseAddress: {{.LocalAPIEndpoint.AdvertiseAddress}}
|
||||||
bindPort: {{.APIEndpoint.BindPort}}
|
bindPort: {{.LocalAPIEndpoint.BindPort}}
|
||||||
nodeRegistration:
|
nodeRegistration:
|
||||||
name: {{.NodeRegistration.Name}}
|
name: {{.NodeRegistration.Name}}
|
||||||
---
|
---
|
||||||
|
Loading…
Reference in New Issue
Block a user