MCPcopy Index your code
hub / github.com/cloudnative-pg/cloudnative-pg / GetPGControlData

Function GetPGControlData

internal/cmd/plugin/plugin.go:153–172  ·  view source on GitHub ↗

GetPGControlData obtains the PgControldata from the passed pod by doing an exec. This approach should be used only in the plugin commands.

(
	ctx context.Context,
	pod corev1.Pod,
)

Source from the content-addressed store, hash-verified

151// GetPGControlData obtains the PgControldata from the passed pod by doing an exec.
152// This approach should be used only in the plugin commands.
153func GetPGControlData(
154 ctx context.Context,
155 pod corev1.Pod,
156) (string, error) {
157 timeout := time.Second * 10
158 clientInterface := kubernetes.NewForConfigOrDie(Config)
159 stdout, _, err := utils.ExecCommand(
160 ctx,
161 clientInterface,
162 Config,
163 pod,
164 specs.PostgresContainerName,
165 &timeout,
166 "pg_controldata")
167 if err != nil {
168 return "", err
169 }
170
171 return stdout, nil
172}
173
174// completeClusters is mainly used inside the unit tests
175func completeClusters(

Callers

nothing calls this directly

Calls 1

ExecCommandFunction · 0.92

Tested by

no test coverage detected