Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HostnameGenerator is flaky when there are collisions #10989

Closed
lobkovilya opened this issue Jul 26, 2024 · 0 comments · Fixed by #11010
Closed

HostnameGenerator is flaky when there are collisions #10989

lobkovilya opened this issue Jul 26, 2024 · 0 comments · Fixed by #11010
Assignees
Labels
kind/bug A bug triage/accepted The issue was reviewed and is complete enough to start working on it
Milestone

Comments

@lobkovilya
Copy link
Contributor

What happened?

  1. Force HostnameGenerator to have collisions
  2. Observe the hostname in meshservice.status is constantly changing from the real hostname to the error message

We noticed this in the multizone scenario with statefulsets, but the repro could be way simpler:

  1. Apply statefulset in 2 zones:
    apiVersion: apps/v1
    kind: StatefulSet
    metadata:
      name: redis
      namespace: kuma-demo
    spec:
      selector:
        matchLabels:
          app: redis
      serviceName: redis
      replicas: 0
      template:
        metadata:
          labels:
            app: redis
        spec:
          containers:
            - name: redis
              image: "redis"
              ports:
                - name: tcp
                  containerPort: 6379
              env:
                - name: POD_NAME
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.name
              lifecycle:
                preStop: # delay shutdown to support graceful mesh leave
                  exec:
                    command: ["/bin/sleep", "30"]
                postStart:
                  exec:
                    command: ["sh", "-c", "/usr/local/bin/redis-cli set zone ${POD_NAME}"]
  2. In one zone apply the hostname generator (without kuma.io/origin label):
    kind: HostnameGenerator
    apiVersion: kuma.io/v1alpha1
    metadata:
      name: local-headless-kube-mesh-service
      namespace: kuma-system
      labels:
        kuma.io/origin: zone
    spec:
      template: '{{ label "statefulset.kubernetes.io/pod-name" }}.{{ label "k8s.kuma.io/service-name" }}.{{ .Namespace }}.svc.mesh.local'
      selector:
        meshService:
          matchLabels:
            kuma.io/managed-by: k8s-controller
            k8s.kuma.io/is-headless-service: "true"
  3. Observe hostnames appearing and disappearing
    image
  4. Zone CP is constantly reconciling resources zone-cp.log
@lobkovilya lobkovilya added triage/pending This issue will be looked at on the next triage meeting kind/bug A bug labels Jul 26, 2024
@michaelbeaumont michaelbeaumont self-assigned this Jul 29, 2024
@bartsmykla bartsmykla added this to the 2.9.x milestone Jul 29, 2024
@bartsmykla bartsmykla added triage/accepted The issue was reviewed and is complete enough to start working on it and removed triage/pending This issue will be looked at on the next triage meeting labels Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug triage/accepted The issue was reviewed and is complete enough to start working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants