MCPcopy Create free account
hub / github.com/devfile/devworkspace-operator / checkExistingConfigForConflict

Function checkExistingConfigForConflict

pkg/webhook/init_cfg.go:47–59  ·  view source on GitHub ↗
(client crclient.Client, ctx context.Context, serviceNamespace string)

Source from the content-addressed store, hash-verified

45}
46
47func checkExistingConfigForConflict(client crclient.Client, ctx context.Context, serviceNamespace string) error {
48 existingCfg := &admv1.MutatingWebhookConfiguration{}
49 err := client.Get(ctx, types.NamespacedName{Name: workspace.MutateWebhookCfgName}, existingCfg)
50 if err != nil {
51 return err
52 }
53 for _, webhook := range existingCfg.Webhooks {
54 if webhook.ClientConfig.Service.Namespace != serviceNamespace {
55 return fmt.Errorf("conflicting webhook definition found on cluster, webhook %s clientConfig points at namespace %s", webhook.Name, webhook.ClientConfig.Service.Namespace)
56 }
57 }
58 return nil
59}

Callers 1

WebhookCfgsInitFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected