Skip to content

Commit 74e8973

Browse files
committed
Fix based on Justins suggestion
1 parent 218d906 commit 74e8973

File tree

8 files changed

+18
-12
lines changed

8 files changed

+18
-12
lines changed

nodeup/pkg/model/context.go

+9
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,15 @@ func (c *NodeupModelContext) UseNodeAuthorizer() bool {
278278
return c.Cluster.Spec.NodeAuthorization.NodeAuthorizer != nil
279279
}
280280

281+
// UsesSecondaryIP checks if the CNI in use attaches secondary interfaces to the host.
282+
func (c *NodeupModelContext) UsesSecondaryIP() bool {
283+
if c.Cluster.Spec.Networking.CNI.UsesSecondaryIP || c.Cluster.Spec.Networking.AmazonVPC != nil {
284+
return true
285+
}
286+
287+
return false
288+
}
289+
281290
// UseBootstrapTokens checks if we are using bootstrap tokens
282291
func (c *NodeupModelContext) UseBootstrapTokens() bool {
283292
if c.IsMaster {

nodeup/pkg/model/kubelet.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func (b *KubeletBuilder) buildSystemdEnvironmentFile(kubeletConfig *kops.Kubelet
174174
flags += " --cni-conf-dir=" + b.CNIConfDir()
175175
}
176176

177-
if kubeletConfig.BindPrimaryIP {
177+
if b.UsesSecondaryIP() {
178178
sess := session.Must(session.NewSession())
179179
metadata := ec2metadata.New(sess)
180180
localIpv4, err := metadata.GetMetadata("local-ipv4")

pkg/apis/kops/cluster.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,7 @@ func (c *Cluster) FillDefaults() error {
507507
} else if c.Spec.Networking.Romana != nil {
508508
// OK
509509
} else if c.Spec.Networking.AmazonVPC != nil {
510-
// If we are using the AmazonVPC plugin we need to bind the kubelet to the local ipv4 address
511-
c.Spec.Kubelet.BindPrimaryIP = true
512-
c.Spec.MasterKubelet.BindPrimaryIP = true
510+
// OK
513511
} else if c.Spec.Networking.Cilium != nil {
514512
if c.Spec.Networking.Cilium.Version == "" {
515513
c.Spec.Networking.Cilium.Version = CiliumDefaultVersion

pkg/apis/kops/networking.go

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ type ExternalNetworkingSpec struct {
5050
// Networking is not managed by kops - we can create options here that directly configure e.g. weave
5151
// but this is useful for arbitrary network modes or for modes that don't need additional configuration.
5252
type CNINetworkingSpec struct {
53+
UsesSecondaryIP bool `json:"usesSecondaryIP,omitempty"`
5354
}
5455

5556
// KopeioNetworkingSpec declares that we want Kopeio networking

pkg/apis/kops/v1alpha1/networking.go

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ type ExternalNetworkingSpec struct {
5050
// Networking is not managed by kops - we can create options here that directly configure e.g. weave
5151
// but this is useful for arbitrary network modes or for modes that don't need additional configuration.
5252
type CNINetworkingSpec struct {
53+
UsesSecondaryIP bool `json:"usesSecondaryIP,omitempty"`
5354
}
5455

5556
// KopeioNetworkingSpec declares that we want Kopeio networking

pkg/apis/kops/v1alpha1/zz_generated.conversion.go

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/kops/v1alpha2/networking.go

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ type ExternalNetworkingSpec struct {
5050
// Networking is not managed by kops - we can create options here that directly configure e.g. weave
5151
// but this is useful for arbitrary network modes or for modes that don't need additional configuration.
5252
type CNINetworkingSpec struct {
53+
UsesSecondaryIP bool `json:"usesSecondaryIP,omitempty"`
5354
}
5455

5556
// KopeioNetworkingSpec declares that we want Kopeio networking

pkg/apis/kops/v1alpha2/zz_generated.conversion.go

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)