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

No endpoints for Consul service registered in datacenter not named 'dc1' #1533

Closed
ewbankkit opened this issue May 13, 2019 · 0 comments · Fixed by #1536
Closed

No endpoints for Consul service registered in datacenter not named 'dc1' #1533

ewbankkit opened this issue May 13, 2019 · 0 comments · Fixed by #1536
Assignees

Comments

@ewbankkit
Copy link
Contributor

Describe the bug

We have Consul services registered in a Consul datacenter NOT named dc1 but Ambassador is not resolving endpoints for this service to pass on to Envoy and so the service is not routable.

On the Ambassador Kubernetes service:

  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v1
      kind: Module
      name: ambassador
      config:
        service_port: 8080
      ---
      apiVersion: ambassador/v1
      kind: ConsulResolver
      name: consul-not-dc1
      address: "${HOST_IP}:8500"
      datacenter: not-dc1

On a Kubernetes service:

apiVersion: v1
kind: Service
metadata:
  name: consul-demoapp
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v1
      kind:  Mapping
      name:  consul_demoapp_mapping
      prefix: /demoapp
      resolver: consul-not-dc1
      service: demoapp
      load_balancer:
        policy: round_robin
spec:
  clusterIP: None

In snapshot.yaml I see

{
    "Consul": {
            "demoapp": {
                "Id": "not-dc1",
                "Service": "demoapp",
                "Endpoints": [
                    {
                        "SystemID": "consul::00000000-0000-0000-0000-000000000000",
                        "ID": "_nomad-task-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                        "Service": "demoapp",
                        "Address": "x.x.x.x",
                        "Port": 26457,
                        "Tags": [
                            "urlprefix-/demoapp strip=/demoapp",
                            "demoapp",
                            "blue"
                        ]
                    },
                    {
                        "SystemID": "consul::00000000-0000-0000-0000-000000000000",
                        "ID": "_nomad-task-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                        "Service": "demoapp",
                        "Address": "x.x.x.x",
                        "Port": 30147,
                        "Tags": [
                            "urlprefix-/demoapp strip=/demoapp",
                            "demoapp",
                            "blue"
                        ]
                    },
                    {
                        "SystemID": "consul::00000000-0000-0000-0000-000000000000",
                        "ID": "_nomad-task-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                        "Service": "demoapp",
                        "Address": "x.x.x.x",
                        "Port": 24860,
                        "Tags": [
                            "urlprefix-/demoapp strip=/demoapp",
                            "demoapp",
                            "blue"
                        ]
                    }
                ]
            }
        }
    },
    "Kubernetes": {
        ...
    }
}

but in aconf.json I see:

        "consul-demoapp-dc1": {
            "_referenced_by": {},
            "ambassador_id": "default",
            "apiVersion": "ambassador/v1",
            "datacenter": "dc1",
            "endpoints": {
                "*": [
                    {
                        "ip": "x.x.x.x",
                        "port": 26457,
                        "target_kind": "Consul"
                    },
                    {
                        "ip": "x.x.x.x",
                        "port": 30147,
                        "target_kind": "Consul"
                    },
                    {
                        "ip": "x.x.x.x",
                        "port": 24860,
                        "target_kind": "Consul"
                    }
                ]
            },
            "kind": "Service",
            "location": "consul-demoapp-dc1",
            "name": "demoapp",
            "rkey": "consul-demoapp-dc1",
            "serialization": "ambassador_id: default\napiVersion: ambassador/v1\ndatacenter: dc1\nendpoints:\n  '*':\n  - ip: x.x.x.x\n    port: 26457\n    target_kind: Consul\n  - ip: x.x.x.x\n    port: 30147\n    target_kind: Consul\n  - ip: x.x.x.x\n    port: 24860\n    target_kind: Consul\nkind: Service\nname: demoapp\n"
        },

the datacenter value has reverted to dc1 and I think this is causing the failure to find endpoints.

It looks like this code

https://github.com/datawire/ambassador/blob/0e1e8ffbc83f7a96b815ff68ed786b59be09cce3/ambassador/ambassador/config/resourcefetcher.py#L536

is incorrect and 'id' should be 'Id' as that is the name of the datacenter value in snapshot.yaml.

Versions (please complete the following information):

  • Ambassador: 0.61.0
  • Kubernetes environment BYO Kubernetes on AWS
  • Version 1.14

Additional context
Related:

@kflynn kflynn added this to the parc-güell milestone May 13, 2019
@kflynn kflynn self-assigned this May 13, 2019
kflynn pushed a commit that referenced this issue May 13, 2019
@kflynn kflynn reopened this May 13, 2019
@kflynn kflynn mentioned this issue May 15, 2019
@kflynn kflynn closed this as completed in 2e95ece May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants