mirror of https://github.com/kubernetes/kops.git
Move default machine type to NodeupConfig
This commit is contained in:
parent
5f45389124
commit
75ca231693
|
|
@ -20,7 +20,6 @@ import (
|
|||
"fmt"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"k8s.io/kops/pkg/model/components"
|
||||
|
||||
|
|
@ -440,7 +439,7 @@ func (b *KubeletBuilder) buildKubeletConfigSpec() (*kops.KubeletConfigSpec, erro
|
|||
instanceTypeName, err := metadata.GetMetadata("instance-type")
|
||||
if err != nil {
|
||||
// Otherwise, fall back to the Instance Group spec.
|
||||
instanceTypeName = strings.Split(b.InstanceGroup.Spec.MachineType, ",")[0]
|
||||
instanceTypeName = *b.NodeupConfig.DefaultMachineType
|
||||
}
|
||||
|
||||
region, err := awsup.FindRegion(b.Cluster)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ limitations under the License.
|
|||
package nodeup
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"k8s.io/kops/pkg/apis/kops"
|
||||
"k8s.io/kops/pkg/nodelabels"
|
||||
"k8s.io/kops/upup/pkg/fi"
|
||||
|
|
@ -51,6 +53,8 @@ type Config struct {
|
|||
// Manifests for running etcd
|
||||
EtcdManifests []string `json:"etcdManifests,omitempty"`
|
||||
|
||||
// DefaultMachineType is the first-listed instance machine type, used if querying instance metadata fails.
|
||||
DefaultMachineType *string `json:",omitempty"`
|
||||
// StaticManifests describes generic static manifests
|
||||
// Using this allows us to keep complex logic out of nodeup
|
||||
StaticManifests []*StaticManifest `json:"staticManifests,omitempty"`
|
||||
|
|
@ -119,5 +123,9 @@ func NewConfig(cluster *kops.Cluster, instanceGroup *kops.InstanceGroup) *Config
|
|||
|
||||
config.KubeletConfig.Taints = append(config.KubeletConfig.Taints, instanceGroup.Spec.Taints...)
|
||||
|
||||
if cluster.Spec.Networking != nil && cluster.Spec.Networking.AmazonVPC != nil {
|
||||
config.DefaultMachineType = fi.String(strings.Split(instanceGroup.Spec.MachineType, ",")[0])
|
||||
}
|
||||
|
||||
return &config
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue