GetMutatingWebhookByName get the MutatingWebhook filtered by the name of one of the webhooks
( ctx context.Context, crudClient client.Client, name string, )
| 41 | // GetMutatingWebhookByName get the MutatingWebhook filtered by the name of one |
| 42 | // of the webhooks |
| 43 | func 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 |
| 67 | func UpdateMutatingWebhookConf( |