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

Function IsPrimary

pkg/specs/pg_pods.go:54–61  ·  view source on GitHub ↗

IsPrimary check if a certain resource belongs to a primary

(meta metav1.ObjectMeta)

Source from the content-addressed store, hash-verified

52
53// IsPrimary check if a certain resource belongs to a primary
54func IsPrimary(meta metav1.ObjectMeta) bool {
55 role, hasRole := utils.GetInstanceRole(meta.Labels)
56 if !hasRole {
57 return false
58 }
59
60 return role == ClusterRoleLabelPrimary
61}
62
63// IsPodStandby check if a certain pod belongs to a standby
64func IsPodStandby(pod corev1.Pod) bool {

Callers 5

reconciler_test.goFile · 0.92
findInstancePodToCreateFunction · 0.92
IsPodPrimaryFunction · 0.85

Calls 1

GetInstanceRoleFunction · 0.92

Tested by

no test coverage detected