Skip to content

k8gb incorrectly updates Nameserver A record TTL when multiple GSLB objects exist with different TTLs #1837

Open
@steemax

Description

@steemax

Description

When multiple GSLB objects exist in the cluster with different dnsTtlSeconds values, the k8gb controller incorrectly applies these TTL values to the Nameserver A record in the DNSEndpoint resource. This results in an infinite loop where the controller continuously changes the Nameserver A record TTL, alternating between values from different GSLB objects.

Steps to Reproduce

  1. Create two or more GSLB objects with different dnsTtlSeconds values:
apiVersion: k8gb.absa.oss/v1beta1
kind: Gslb
metadata:
  name: gslb1
  namespace: namespace1
spec:
  ingress:
    ingressClassName: traefik
  resourceRef:
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    matchLabels:
      app: gateway1
  strategy:
    dnsTtlSeconds: 20
    primaryGeoTag: apa
    splitBrainThresholdSeconds: 120
    type: roundRobin

and

apiVersion: k8gb.absa.oss/v1beta1
kind: Gslb
metadata:
  name: gslb2
  namespace: namespace2
spec:
  ingress:
    ingressClassName: traefik
  resourceRef:
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    matchLabels:
      app: gateway2
  strategy:
    dnsTtlSeconds: 10
    primaryGeoTag: apa
    splitBrainThresholdSeconds: 120
    type: roundRobin
  1. Observe the DNSEndpoint resource in the k8gb namespace:
apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
  annotations:
    k8gb.absa.oss/dnstype: extdns
  name: k8gb-ns-extdns
  namespace: k8gb
spec:
  endpoints:
    - dnsName: common.geo.paywb.com
      recordTTL: 20  # Incorrectly applied TTL
      recordType: NS
      targets:
        - gslb-ns-apa-common.geo.example.com
        - gslb-ns-ipa-common.geo.example.com
    - dnsName: gslb-ns-ipa-common.geo.example.com
      recordTTL: 20  # Incorrectly applied TTL
      recordType: A
      targets:
        - 10.230.107.10
  1. Notice that the TTL for the Nameserver A record is constantly changing as the controller alternates between different TTL values from GSLB objects.

Expected Behavior

Changing dnsTtlSeconds in a GSLB object should only affect the DNS records for that specific service.
The Nameserver A record TTL should not be altered based on different GSLB objects’ TTL values.

Actual Behavior

The k8gb controller updates the Nameserver A record TTL based on dnsTtlSeconds from any GSLB object in the cluster, causing continuous updates.

Versions

k8gb: v0.14.0
external-dns: v0.13.4-azure-ns-multiarch
Kubernetes: v1.27

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