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

Function GetMutatingWebhookByName

tests/utils/operator/webhooks.go:43–64  ·  view source on GitHub ↗

GetMutatingWebhookByName get the MutatingWebhook filtered by the name of one of the webhooks

(
	ctx context.Context,
	crudClient client.Client,
	name string,
)

Source from the content-addressed store, hash-verified

41// GetMutatingWebhookByName get the MutatingWebhook filtered by the name of one
42// of the webhooks
43func GetMutatingWebhookByName(
44 ctx context.Context,
45 crudClient client.Client,
46 name string,
47) (
48 *admissionregistrationv1.MutatingWebhookConfiguration, int, error,
49) {
50 var mWebhooks admissionregistrationv1.MutatingWebhookConfigurationList
51 err := objects.List(ctx, crudClient, &mWebhooks)
52 if err != nil {
53 return nil, 0, err
54 }
55
56 for i, item := range mWebhooks.Items {
57 for i2, webhook := range item.Webhooks {
58 if webhook.Name == name {
59 return &mWebhooks.Items[i], i2, nil
60 }
61 }
62 }
63 return nil, 0, fmt.Errorf("mutating webhook not found")
64}
65
66// UpdateMutatingWebhookConf update MutatingWebhookConfiguration object
67func UpdateMutatingWebhookConf(

Callers 2

webhook_test.goFile · 0.92
AssertWebhookEnabledFunction · 0.92

Calls 1

ListFunction · 0.92

Tested by 1

AssertWebhookEnabledFunction · 0.74