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

Function GetPodName

tests/utils/operator/operator.go:280–290  ·  view source on GitHub ↗

GetPodName returns the name of the current operator pod NOTE: will return an error if the pod is being deleted

(ctx context.Context, crudClient client.Client)

Source from the content-addressed store, hash-verified

278// GetPodName returns the name of the current operator pod
279// NOTE: will return an error if the pod is being deleted
280func GetPodName(ctx context.Context, crudClient client.Client) (string, error) {
281 pod, err := GetPod(ctx, crudClient)
282 if err != nil {
283 return "", err
284 }
285
286 if pod.GetDeletionTimestamp() != nil {
287 return "", fmt.Errorf("pod is being deleted")
288 }
289 return pod.GetName(), nil
290}
291
292// HasBeenUpgraded determines if the operator has been upgraded by checking
293// if there is a deletion timestamp. If there isn't, it returns true

Callers 2

HasBeenUpgradedFunction · 0.85

Calls 2

GetPodFunction · 0.85
GetNameMethod · 0.65

Tested by

no test coverage detected