mirror of https://github.com/kubernetes/kops.git
Merge pull request #15091 from zetaab/fixlabels
OpenStack: add k8s node labels
This commit is contained in:
commit
14f771812a
|
@ -36,7 +36,8 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
cacheTTL = 60 * time.Minute
|
||||
cacheTTL = 60 * time.Minute
|
||||
ClusterAutoscalerNodeTemplateLabel = "k8s.io_cluster-autoscaler_node-template_label_"
|
||||
)
|
||||
|
||||
// nodeIdentifier identifies a node
|
||||
|
@ -137,6 +138,13 @@ func (i *nodeIdentifier) IdentifyNode(ctx context.Context, node *corev1.Node) (*
|
|||
}
|
||||
}
|
||||
|
||||
for key, value := range server.Metadata {
|
||||
if strings.HasPrefix(key, ClusterAutoscalerNodeTemplateLabel) {
|
||||
trimKey := strings.ReplaceAll(strings.TrimPrefix(key, ClusterAutoscalerNodeTemplateLabel), "_", "/")
|
||||
labels[trimKey] = value
|
||||
}
|
||||
}
|
||||
|
||||
info := &nodeidentity.Info{
|
||||
InstanceID: instanceID,
|
||||
Labels: labels,
|
||||
|
|
Loading…
Reference in New Issue