mirror of https://github.com/kubernetes/kops.git
Reuse logic for checking if CNI network plugins need to be installed
This commit is contained in:
parent
284e0f7451
commit
216af9a199
|
@ -30,9 +30,7 @@ var _ fi.NodeupModelBuilder = &CommonBuilder{}
|
|||
|
||||
// Build is responsible for copying the common CNI binaries
|
||||
func (b *CommonBuilder) Build(c *fi.NodeupModelBuilderContext) error {
|
||||
if b.NodeupConfig.Networking.AmazonVPC == nil &&
|
||||
b.NodeupConfig.Networking.Calico == nil &&
|
||||
b.NodeupConfig.Networking.Cilium == nil {
|
||||
if b.NodeupConfig.InstallCNIAssets {
|
||||
if err := b.AddCNIBinAssets(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -938,6 +938,12 @@ func (c *Cluster) UsesNoneDNS() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (c *Cluster) InstallCNIAssets() bool {
|
||||
return c.Spec.Networking.AmazonVPC == nil &&
|
||||
c.Spec.Networking.Calico == nil &&
|
||||
c.Spec.Networking.Cilium == nil
|
||||
}
|
||||
|
||||
func (c *Cluster) APIInternalName() string {
|
||||
return "api.internal." + c.ObjectMeta.Name
|
||||
}
|
||||
|
|
|
@ -71,9 +71,7 @@ func (m *instanceGroupModel) GetCloudProvider() kops.CloudProviderID {
|
|||
}
|
||||
|
||||
func (m *instanceGroupModel) InstallCNIAssets() bool {
|
||||
return m.cluster.Spec.Networking.AmazonVPC == nil &&
|
||||
m.cluster.Spec.Networking.Calico == nil &&
|
||||
m.cluster.Spec.Networking.Cilium == nil
|
||||
return m.cluster.InstallCNIAssets()
|
||||
}
|
||||
|
||||
func (m *instanceGroupModel) RawClusterSpec() *kops.ClusterSpec {
|
||||
|
|
|
@ -69,6 +69,8 @@ type Config struct {
|
|||
KubeProxy *kops.KubeProxyConfig
|
||||
// Networking configures networking.
|
||||
Networking kops.NetworkingSpec
|
||||
// InstallCNIAssets specifies that the CNI network plugins need to be installed.
|
||||
InstallCNIAssets bool `json:",omitempty"`
|
||||
// UseCiliumEtcd is true when a Cilium etcd cluster is present.
|
||||
UseCiliumEtcd bool `json:",omitempty"`
|
||||
// UsesKubenet specifies that the CNI is derived from Kubenet.
|
||||
|
@ -297,6 +299,10 @@ func NewConfig(cluster *kops.Cluster, instanceGroup *kops.InstanceGroup) (*Confi
|
|||
config.UpdatePolicy = kops.UpdatePolicyAutomatic
|
||||
}
|
||||
|
||||
if cluster.InstallCNIAssets() {
|
||||
config.InstallCNIAssets = true
|
||||
}
|
||||
|
||||
if cluster.Spec.Networking.AmazonVPC != nil {
|
||||
config.Networking.AmazonVPC = &kops.AmazonVPCNetworkingSpec{}
|
||||
config.DefaultMachineType = aws.String(strings.Split(instanceGroup.Spec.MachineType, ",")[0])
|
||||
|
|
Loading…
Reference in New Issue