mirror of https://github.com/kubernetes/kops.git
Fix based on Justins suggestion
This commit is contained in:
parent
218d90632c
commit
74e8973c6c
|
@ -278,6 +278,15 @@ func (c *NodeupModelContext) UseNodeAuthorizer() bool {
|
||||||
return c.Cluster.Spec.NodeAuthorization.NodeAuthorizer != nil
|
return c.Cluster.Spec.NodeAuthorization.NodeAuthorizer != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UsesSecondaryIP checks if the CNI in use attaches secondary interfaces to the host.
|
||||||
|
func (c *NodeupModelContext) UsesSecondaryIP() bool {
|
||||||
|
if c.Cluster.Spec.Networking.CNI.UsesSecondaryIP || c.Cluster.Spec.Networking.AmazonVPC != nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// UseBootstrapTokens checks if we are using bootstrap tokens
|
// UseBootstrapTokens checks if we are using bootstrap tokens
|
||||||
func (c *NodeupModelContext) UseBootstrapTokens() bool {
|
func (c *NodeupModelContext) UseBootstrapTokens() bool {
|
||||||
if c.IsMaster {
|
if c.IsMaster {
|
||||||
|
|
|
@ -174,7 +174,7 @@ func (b *KubeletBuilder) buildSystemdEnvironmentFile(kubeletConfig *kops.Kubelet
|
||||||
flags += " --cni-conf-dir=" + b.CNIConfDir()
|
flags += " --cni-conf-dir=" + b.CNIConfDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
if kubeletConfig.BindPrimaryIP {
|
if b.UsesSecondaryIP() {
|
||||||
sess := session.Must(session.NewSession())
|
sess := session.Must(session.NewSession())
|
||||||
metadata := ec2metadata.New(sess)
|
metadata := ec2metadata.New(sess)
|
||||||
localIpv4, err := metadata.GetMetadata("local-ipv4")
|
localIpv4, err := metadata.GetMetadata("local-ipv4")
|
||||||
|
|
|
@ -507,9 +507,7 @@ func (c *Cluster) FillDefaults() error {
|
||||||
} else if c.Spec.Networking.Romana != nil {
|
} else if c.Spec.Networking.Romana != nil {
|
||||||
// OK
|
// OK
|
||||||
} else if c.Spec.Networking.AmazonVPC != nil {
|
} else if c.Spec.Networking.AmazonVPC != nil {
|
||||||
// If we are using the AmazonVPC plugin we need to bind the kubelet to the local ipv4 address
|
// OK
|
||||||
c.Spec.Kubelet.BindPrimaryIP = true
|
|
||||||
c.Spec.MasterKubelet.BindPrimaryIP = true
|
|
||||||
} else if c.Spec.Networking.Cilium != nil {
|
} else if c.Spec.Networking.Cilium != nil {
|
||||||
if c.Spec.Networking.Cilium.Version == "" {
|
if c.Spec.Networking.Cilium.Version == "" {
|
||||||
c.Spec.Networking.Cilium.Version = CiliumDefaultVersion
|
c.Spec.Networking.Cilium.Version = CiliumDefaultVersion
|
||||||
|
|
|
@ -50,6 +50,7 @@ type ExternalNetworkingSpec struct {
|
||||||
// Networking is not managed by kops - we can create options here that directly configure e.g. weave
|
// Networking is not managed by kops - we can create options here that directly configure e.g. weave
|
||||||
// but this is useful for arbitrary network modes or for modes that don't need additional configuration.
|
// but this is useful for arbitrary network modes or for modes that don't need additional configuration.
|
||||||
type CNINetworkingSpec struct {
|
type CNINetworkingSpec struct {
|
||||||
|
UsesSecondaryIP bool `json:"usesSecondaryIP,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// KopeioNetworkingSpec declares that we want Kopeio networking
|
// KopeioNetworkingSpec declares that we want Kopeio networking
|
||||||
|
|
|
@ -50,6 +50,7 @@ type ExternalNetworkingSpec struct {
|
||||||
// Networking is not managed by kops - we can create options here that directly configure e.g. weave
|
// Networking is not managed by kops - we can create options here that directly configure e.g. weave
|
||||||
// but this is useful for arbitrary network modes or for modes that don't need additional configuration.
|
// but this is useful for arbitrary network modes or for modes that don't need additional configuration.
|
||||||
type CNINetworkingSpec struct {
|
type CNINetworkingSpec struct {
|
||||||
|
UsesSecondaryIP bool `json:"usesSecondaryIP,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// KopeioNetworkingSpec declares that we want Kopeio networking
|
// KopeioNetworkingSpec declares that we want Kopeio networking
|
||||||
|
|
|
@ -426,6 +426,7 @@ func Convert_kops_AwsAuthenticationSpec_To_v1alpha1_AwsAuthenticationSpec(in *ko
|
||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_v1alpha1_CNINetworkingSpec_To_kops_CNINetworkingSpec(in *CNINetworkingSpec, out *kops.CNINetworkingSpec, s conversion.Scope) error {
|
func autoConvert_v1alpha1_CNINetworkingSpec_To_kops_CNINetworkingSpec(in *CNINetworkingSpec, out *kops.CNINetworkingSpec, s conversion.Scope) error {
|
||||||
|
out.UsesSecondaryIP = in.UsesSecondaryIP
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,6 +436,7 @@ func Convert_v1alpha1_CNINetworkingSpec_To_kops_CNINetworkingSpec(in *CNINetwork
|
||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_kops_CNINetworkingSpec_To_v1alpha1_CNINetworkingSpec(in *kops.CNINetworkingSpec, out *CNINetworkingSpec, s conversion.Scope) error {
|
func autoConvert_kops_CNINetworkingSpec_To_v1alpha1_CNINetworkingSpec(in *kops.CNINetworkingSpec, out *CNINetworkingSpec, s conversion.Scope) error {
|
||||||
|
out.UsesSecondaryIP = in.UsesSecondaryIP
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2642,11 +2644,7 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha1_KubeletConfigSpec(in *kops.K
|
||||||
out.ExperimentalAllowedUnsafeSysctls = in.ExperimentalAllowedUnsafeSysctls
|
out.ExperimentalAllowedUnsafeSysctls = in.ExperimentalAllowedUnsafeSysctls
|
||||||
out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout
|
out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout
|
||||||
out.DockerDisableSharedPID = in.DockerDisableSharedPID
|
out.DockerDisableSharedPID = in.DockerDisableSharedPID
|
||||||
<<<<<<< HEAD
|
|
||||||
out.RootDir = in.RootDir
|
out.RootDir = in.RootDir
|
||||||
=======
|
|
||||||
out.BindPrimaryIP = in.BindPrimaryIP
|
|
||||||
>>>>>>> api machinery
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ type ExternalNetworkingSpec struct {
|
||||||
// Networking is not managed by kops - we can create options here that directly configure e.g. weave
|
// Networking is not managed by kops - we can create options here that directly configure e.g. weave
|
||||||
// but this is useful for arbitrary network modes or for modes that don't need additional configuration.
|
// but this is useful for arbitrary network modes or for modes that don't need additional configuration.
|
||||||
type CNINetworkingSpec struct {
|
type CNINetworkingSpec struct {
|
||||||
|
UsesSecondaryIP bool `json:"usesSecondaryIP,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// KopeioNetworkingSpec declares that we want Kopeio networking
|
// KopeioNetworkingSpec declares that we want Kopeio networking
|
||||||
|
|
|
@ -462,6 +462,7 @@ func Convert_kops_BastionSpec_To_v1alpha2_BastionSpec(in *kops.BastionSpec, out
|
||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_v1alpha2_CNINetworkingSpec_To_kops_CNINetworkingSpec(in *CNINetworkingSpec, out *kops.CNINetworkingSpec, s conversion.Scope) error {
|
func autoConvert_v1alpha2_CNINetworkingSpec_To_kops_CNINetworkingSpec(in *CNINetworkingSpec, out *kops.CNINetworkingSpec, s conversion.Scope) error {
|
||||||
|
out.UsesSecondaryIP = in.UsesSecondaryIP
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,6 +472,7 @@ func Convert_v1alpha2_CNINetworkingSpec_To_kops_CNINetworkingSpec(in *CNINetwork
|
||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_kops_CNINetworkingSpec_To_v1alpha2_CNINetworkingSpec(in *kops.CNINetworkingSpec, out *CNINetworkingSpec, s conversion.Scope) error {
|
func autoConvert_kops_CNINetworkingSpec_To_v1alpha2_CNINetworkingSpec(in *kops.CNINetworkingSpec, out *CNINetworkingSpec, s conversion.Scope) error {
|
||||||
|
out.UsesSecondaryIP = in.UsesSecondaryIP
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2906,11 +2908,7 @@ func autoConvert_kops_KubeletConfigSpec_To_v1alpha2_KubeletConfigSpec(in *kops.K
|
||||||
out.ExperimentalAllowedUnsafeSysctls = in.ExperimentalAllowedUnsafeSysctls
|
out.ExperimentalAllowedUnsafeSysctls = in.ExperimentalAllowedUnsafeSysctls
|
||||||
out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout
|
out.StreamingConnectionIdleTimeout = in.StreamingConnectionIdleTimeout
|
||||||
out.DockerDisableSharedPID = in.DockerDisableSharedPID
|
out.DockerDisableSharedPID = in.DockerDisableSharedPID
|
||||||
<<<<<<< HEAD
|
|
||||||
out.RootDir = in.RootDir
|
out.RootDir = in.RootDir
|
||||||
=======
|
|
||||||
out.BindPrimaryIP = in.BindPrimaryIP
|
|
||||||
>>>>>>> api machinery
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue