Skip to content

KongUpstreamPolicy healthchecks.threshold is not respected and defaults to 0. #7755

@elbrogan-vizio

Description

@elbrogan-vizio

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When adding a KongUpstreamPolicy to a Service that is the target of an HTTPRoute, the generate Upstream does not respect the KUP's .spec.healthchecks.threshold value and defaults to the value 0.

Expected Behavior

When adding a KUP to a Service, the value of .spec.healthchecks.threshold should be synced to the Upstream's healthchecks.threshold if it's provided.

Steps To Reproduce

1. Create a KIC managed Gateway named `public` in `gateway` Namespace.
2. Apply the following YAML:


apiVersion: v1
kind: Namespace
metadata:
  name: test
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: httpbin
  namespace: test
spec:
  selector:
    matchLabels:
      app: httpbin
  template:
    metadata:
      labels:
        app: httpbin
    spec:
      containers:
      - args:
        - pipenv
        - run
        - gunicorn
        - -b
        - '[::]:80'
        - httpbin:app
        - -k
        - gevent
        image: kong/httpbin:0.1.0
        imagePullPolicy: IfNotPresent
        name: httpbin
        ports:
        - containerPort: 80
          protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    konghq.com/upstream-policy: test
  labels:
    app: httpbin
  name: httpbin
  namespace: test
spec:
  ports:
  - name: http
    port: 80
  selector:
    app: httpbin
  type: ClusterIP
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  annotations:
    konghq.com/strip-path: "true"
  name: httpbin
  namespace: test
spec:
  parentRefs:
  - group: gateway.networking.k8s.io
    kind: Gateway
    name: public
    namespace: gateway
  rules:
  - backendRefs:
    - group: ""
      kind: Service
      name: httpbin
      port: 80
    matches:
    - path:
        type: PathPrefix
        value: /httpbin
---
apiVersion: configuration.konghq.com/v1beta1
kind: KongUpstreamPolicy
metadata:
  name: test
  namespace: test
spec:
  healthchecks:
    active:
      healthy:
        interval: 10
        successes: 3
      httpPath: /status/200
      timeout: 1
      type: http
    passive:
      healthy:
        successes: 3
      unhealthy:
        httpFailures: 1
    threshold: 80


3. Examine the `healthchecks.threshold` field of the `/upstreams/httproute.test.httpbin.0/` endpoint of the Kong API. Note how it does not match the value specified in the KUP.

Kong Ingress Controller version

Helm Chart: `kong/ingress` - `v0.21.0`
Kong Image: v3.9

Kubernetes version

Client Version: v1.34.1
Kustomize Version: v5.7.1
Server Version: v1.33.5-eks-113cf36

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions