Skip to content

Helm: The insecure webhook (if running on 8080) is exposed through hard coded ports #5071

Open
@NickLarsenNZ

Description

@NickLarsenNZ

What happened:

As far as I understand, there is no authentication mechanism when using webhooks.
If that is true, then I believe the webhook port should not be exposed in the cluster (and the webhook can then listen on 127.0.0.1 or ::1).

While the helm-chart allows for adding additional containers (through extraContainers), ports are not configurable through provider.webhook

What you expected to happen:

  1. I expect to be able to restrict webhook access containers in the pod (namely external-dns).
  2. I expect to be able to run healthchecks (livenessProbe/readinessProbe) on the webhook sidecar, which means exposing its endpoint without exposing the webhook endpoint.

How to reproduce it (as minimally and precisely as possible):

values.yaml

extraArgs:
  ## must override the default value with port 8888 with port 8080 because this is hard-coded in the helm chart
  - --webhook-provider-url=http://localhost:8080

provider:
  name: webhook
  webhook:
    image:
      repository: ghcr.io/ionos-cloud/external-dns-ionos-webhook
      tag: v0.6.3
    env:
    - name: IONOS_API_KEY
      valueFrom:
        secretKeyRef:
          name: ionos-credentials
          key: api-key
    - name: DRY_RUN
      value: "true"
    # NOTE: this is exposed due to the hard-coded http-webhook port
    - name: SERVER_PORT
      value: "8080"
    # NOTE: This feature is not yet available. 
    # It arrives in https://github.com/ionos-cloud/external-dns-ionos-webhook/pull/77 which depends on this issue being resolved.
    #
    # Try to expose /health endpoint to kubelet. But it is not exposed due to hard-coded ports
    - name: HEALTH_PORT
      value: "8081"
    livenessProbe:
      httpGet:
        path: /health
        port: http-health
    readinessProbe:
      httpGet:
        path: /health
        port: http-health
    # Ideally, I could expose the health endpoint like so:
    # ports:
    # - name: http-health
    #   protocol: TCP
    #   containerPort: 8081

Anything else we need to know?:

I believe the solution to this to be:

  1. Remove the hard-coded webhook port from the helm-chart.
  2. Allow the webhook sidecar ports to be customised through helm values, so that healthchecks can still be exposed.
    • Ideally they should run on a separate port so the webhook endpoint can remain locked down.

Environment:

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions