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

Function Off

tests/utils/fencing/fencing.go:76–103  ·  view source on GitHub ↗

Off marks an instance in a cluster as not fenced

(
	ctx context.Context,
	crudClient client.Client,
	serverName,
	namespace,
	clusterName string,
	fencingMethod Method,
)

Source from the content-addressed store, hash-verified

74
75// Off marks an instance in a cluster as not fenced
76func Off(
77 ctx context.Context,
78 crudClient client.Client,
79 serverName,
80 namespace,
81 clusterName string,
82 fencingMethod Method,
83) error {
84 switch fencingMethod {
85 case UsingPlugin:
86 _, _, err := run.Run(fmt.Sprintf("kubectl cnpg fencing off %v %v -n %v",
87 clusterName, serverName, namespace))
88 if err != nil {
89 return err
90 }
91 case UsingAnnotation:
92 err := utils.NewFencingMetadataExecutor(crudClient).
93 RemoveFencing().
94 ForInstance(serverName).
95 Execute(ctx, types.NamespacedName{Name: clusterName, Namespace: namespace}, &apiv1.Cluster{})
96 if err != nil {
97 return err
98 }
99 default:
100 return fmt.Errorf("unrecognized fencing Method: %s", fencingMethod)
101 }
102 return nil
103}

Callers 3

fencing_test.goFile · 0.92

Calls 5

RunFunction · 0.92
ExecuteMethod · 0.80
ForInstanceMethod · 0.80
RemoveFencingMethod · 0.80

Tested by

no test coverage detected