MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / GetInstanceRole

Function GetInstanceRole

pkg/utils/labels_annotations.go:560–569  ·  view source on GitHub ↗

GetInstanceRole tries to fetch the ClusterRoleLabelName andClusterInstanceRoleLabelName value from a given labels map

(labels map[string]string)

Source from the content-addressed store, hash-verified

558
559// GetInstanceRole tries to fetch the ClusterRoleLabelName andClusterInstanceRoleLabelName value from a given labels map
560func 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
572func SetInstanceRole(meta *metav1.ObjectMeta, role string) {

Callers 5

getPrimarySerialFunction · 0.92
IsPrimaryFunction · 0.92
getNodeSerialsFromPVCsFunction · 0.92
getPodNameMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected