opendatahub-io / manifests

A repository for Kustomize manifests
Apache License 2.0
8 stars 21 forks source link

Issue with cert-manager-webhook service selectors #106

Closed strangiato closed 1 year ago

strangiato commented 1 year ago

Creation of cert objects such as a certificate or issue are intermittently failing with error messages such as:

Internal error occurred: failed calling webhook "webhook.cert-manager.io": failed to call webhook: Post "https://cert-manager-webhook.cert-manager.svc:443/validate?timeout=10s": dial tcp 10.129.2.30:10250: connect: connection refused

When viewing the cert-manager-webhook service, it appears that the cert-manager-webhook is selecting all three cert-manger pods and not just the cert-manager-webhook pod. This is causing any object creation requests to be round robined to all three pods and only one out of every three object creations succeed.

The original selectors on the service object are as follows:

spec:
  selector:
    app.kubernetes.io/name: webhook
    app.kubernetes.io/instance: cert-manager
    app.kubernetes.io/component: "webhook"

The original deployment/pod labels are as follows:

spec:
  template:
    metadata:
      labels:
        app: webhook
        app.kubernetes.io/name: webhook
        app.kubernetes.io/instance: cert-manager
        app.kubernetes.io/component: "webhook"
        app.kubernetes.io/version: "v1.5.0"

The kustomization.yaml file located here includes the following:

commonLabels:
  app.kubernetes.io/component: cert-manager
  app.kubernetes.io/name: cert-manager
  kustomize.component: cert-manager

The service after being rendered through kustomize appears as follows:

spec:
  selector:
    app.kubernetes.io/component: cert-manager
    app.kubernetes.io/instance: cert-manager
    app.kubernetes.io/name: cert-manager
    kustomize.component: cert-manager

The deployment after being redned through kustomize appears as follows:

spec:
  template:
    metadata:
      labels:
        app: webhook
        app.kubernetes.io/component: cert-manager
        app.kubernetes.io/instance: cert-manager
        app.kubernetes.io/name: cert-manager
        app.kubernetes.io/version: v1.5.0
        kustomize.component: cert-manager

The inclusion of the common labels causes the original name and component to be overwritten for all pods in this kustomization file making it unable to correctly select the right pod.