GetInstanceRole tries to fetch the ClusterRoleLabelName andClusterInstanceRoleLabelName value from a given labels map
(labels map[string]string)
| 558 | |
| 559 | // GetInstanceRole tries to fetch the ClusterRoleLabelName andClusterInstanceRoleLabelName value from a given labels map |
| 560 | func GetInstanceRole(labels map[string]string) (string, bool) { |
| 561 | if value := labels[ClusterRoleLabelName]; value != "" { |
| 562 | return value, true |
| 563 | } |
| 564 | if value := labels[ClusterInstanceRoleLabelName]; value != "" { |
| 565 | return value, true |
| 566 | } |
| 567 | |
| 568 | return "", false |
| 569 | } |
| 570 | |
| 571 | // SetInstanceRole sets both ClusterRoleLabelName and ClusterInstanceRoleLabelName on the given ObjectMeta |
| 572 | func SetInstanceRole(meta *metav1.ObjectMeta, role string) { |
no outgoing calls
no test coverage detected