mirror of https://github.com/kubernetes/kops.git
Use correct tag when creating node labels from azure cloud tags
This commit is contained in:
parent
309dc9fc26
commit
617869e823
|
@ -11,6 +11,7 @@ go_library(
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/nodeidentity:go_default_library",
|
"//pkg/nodeidentity:go_default_library",
|
||||||
|
"//upup/pkg/fi:go_default_library",
|
||||||
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute:go_default_library",
|
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute:go_default_library",
|
||||||
"//vendor/github.com/Azure/go-autorest/autorest/azure/auth:go_default_library",
|
"//vendor/github.com/Azure/go-autorest/autorest/azure/auth:go_default_library",
|
||||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||||
|
|
|
@ -27,13 +27,15 @@ import (
|
||||||
expirationcache "k8s.io/client-go/tools/cache"
|
expirationcache "k8s.io/client-go/tools/cache"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
"k8s.io/kops/pkg/nodeidentity"
|
"k8s.io/kops/pkg/nodeidentity"
|
||||||
|
"k8s.io/kops/upup/pkg/fi"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// InstanceGroupNameTag is the key of the tag used to identify an
|
// InstanceGroupNameTag is the key of the tag used to identify an
|
||||||
// instance group that VM ScaleSet belongs.
|
// instance group that VM ScaleSet belongs.
|
||||||
InstanceGroupNameTag = "kops.k8s.io_instancegroup"
|
InstanceGroupNameTag = "kops.k8s.io_instancegroup"
|
||||||
|
// ClusterNodeTemplateLabel is the prefix used on node labels when copying to cloud tags.
|
||||||
|
ClusterNodeTemplateLabel = "k8s.io_cluster_node-template_label_"
|
||||||
// cacheTTL is the expiration time of nodeidentity.Info cache.
|
// cacheTTL is the expiration time of nodeidentity.Info cache.
|
||||||
cacheTTL = 60 * time.Minute
|
cacheTTL = 60 * time.Minute
|
||||||
)
|
)
|
||||||
|
@ -107,8 +109,8 @@ func (i *nodeIdentifier) IdentifyNode(ctx context.Context, node *corev1.Node) (*
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range vmss.Tags {
|
for k, v := range vmss.Tags {
|
||||||
if strings.HasPrefix(k, InstanceGroupNameTag) {
|
if strings.HasPrefix(k, ClusterNodeTemplateLabel) {
|
||||||
info.Labels[strings.TrimPrefix(k, InstanceGroupNameTag)] = *v
|
info.Labels[strings.TrimPrefix(k, ClusterNodeTemplateLabel)] = fi.StringValue(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue