populate cloud labels with cluster autoscaler tags

This commit is contained in:
Seth Pollack 2017-07-21 10:47:25 -04:00
parent b4eaf6b7d3
commit 888702b1a9
No known key found for this signature in database
GPG Key ID: 0BD21A8B536BBEBC
1 changed files with 18 additions and 0 deletions

View File

@ -33,6 +33,11 @@ import (
"k8s.io/kops/upup/pkg/fi/cloudup/awsup"
)
const (
clusterAutoscalerNodeTemplateLabel = "k8s.io/cluster-autoscaler/node-template/label/"
clusterAutoscalerNodeTemplateTaint = "k8s.io/cluster-autoscaler/node-template/taint/"
)
var UseLegacyELBName = featureflag.New("UseLegacyELBName", featureflag.Bool(false))
type KopsModelContext struct {
@ -173,6 +178,19 @@ func (m *KopsModelContext) CloudTagsForInstanceGroup(ig *kops.InstanceGroup) (ma
labels[k] = v
}
// Apply labels for cluster autoscaler node labels
for k, v := range ig.Spec.NodeLabels {
labels[clusterAutoscalerNodeTemplateLabel+k] = v
}
// Apply labels for cluster autoscaler node taints
for _, v := range ig.Spec.Taints {
splits := strings.SplitN(v, "=", 2)
if len(splits) > 1 {
labels[clusterAutoscalerNodeTemplateTaint+splits[0]] = splits[1]
}
}
// The system tags take priority because the cluster likely breaks without them...
if ig.Spec.Role == kops.InstanceGroupRoleMaster {