-
Notifications
You must be signed in to change notification settings - Fork 109
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
Proposal: Add support for AWS Cloud Map as service-discovery #52
Comments
Also noticed that weaveworks/flagger vends CRD types https://github.com/weaveworks/flagger/blob/master/pkg/apis/appmesh/v1beta1/types.go. That need to be updated before we signoff on this @stefanprodan . |
@kiranmeduri Flagger uses Kubernetes DNS when creating the virtual nodes see https://github.com/weaveworks/flagger/blob/master/pkg/router/appmesh.go#L82. Flagger can't know what Cloud Map service and namespace to use, unless the name and namespace match Kubernetes? I think exposing this in the Canary CRD would allow uses to opt-in for Cloud Map and set those values: apiVersion: flagger.app/v1alpha3
kind: Canary
metadata:
name: frontend
namespace: test
spec:
service:
# App Mesh reference
meshName: global
# App Mesh egress (optional)
backends:
- backend.test
# App Mesh Cloud Map discovery (optional)
cloudMap:
serviceName: frontend
serviceNamespace: prod.svc.aws.local When using Cloud Map how would Kubernetes DNS know about it? Is there a CloudMap CoreDNS plugin? |
Flagger can continue to use native K8s DNS, however I am worried that the CRD definitions will slowly diverge from reality. Flagger should probably depend on aws-app-mesh-controller-for-k8s to get the CRD. Beyond that, current types in Flagger are not compatible with App Mesh GA APIs and AWS SDK. For e.g. VirtualRouter now requires a listener to be defined and aws-sdk checks for it. So my concern around Flagger is more around conformance with App Mesh rather than picking Cloud Map as a solution. Though that will be a bonus and requires further design on how to use it. CoreDNS automatically delegates the resolution to VPC resolver in AWS. In my testing it works fine. However, if users are sure that they only want CloudMap based service-discovery they can do so by adding dnsPolicy, e.g.
|
@kiranmeduri can you point me to the controller change log please? I can't find anywhere in this repo the listener reference as a breaking change. |
@kiranmeduri I like the flow for your design. I prefer this to, say, creating a new CRD per AWS resource we are creating. My reading of the proposal is that the controller will create the CloudMap service for the virtual node, but expects the namespace to exist (or perhaps there is a CRD for namespace). I do like this approach, and its similar to what we do for virtual routers, but I think now is the time for us to think through deletion and sharing behavior for those resources. Currently, routers can be shared between virtual services, and an attempt to delete them is made when a virtual service custom resource is deleted. In this proposal, can virtual nodes share CloudMap services? It seems that it should be possible, as instance ID (IP) within a cluster should be unique. I'm not sure if there are benefits to allowing them to be shared, or if there are any downsides or obstacles with CloudMap service deletion workflow, like can we rely on a deletion to fail if another virtual node has registered instances in the service? (I think so) |
|
Yes virtual-nodes can and will share cloudmap services, for e.g. in the color-app, blue and green tellers will share same service say colorteller.svc.aws.local. DeleteService in CloudMap will fail if there are any registered instances, so that should be safe. However, after a successful delete a create will revive the service with same ID and this may be undesirable. The reason is that the previous delete may not have been observed and a subsequent delete will clobber the create that interleaved. So in theory a reconcile loop will eventually take care of fixing the services, but have to dive into some edge cases before we enable delete. |
Initial Cloud Map support has been merged. |
Summary
Add support for AWS Cloud Map service-discovery with App Mesh virtual-nodes when using aws-app-mesh-controller-for-k8s.
Motivation
AWS Cloud Map is a cloud resource discovery service. With Cloud Map, you can define custom names for your application resources, and it maintains the updated location of these dynamically changing resources. This increases your application availability because your web service always discovers the most up-to-date locations of its resources. AWS App Mesh is a service mesh that provides application-level networking to make it easy for your services to communicate with each other across multiple types of compute infrastructure.
AWS App Mesh recently announced the support for AWS Cloud Map as a service-discovery option for virtual-nodes. In App Mesh *client *virtual-nodes add backends to define their service dependencies. These backends point to virtual-service that is backed by virtual-router with routes to each of the corresponding service virtual-nodes. Now for client to communicate with service, it will use the DNS specified on virtual-nodes. So prior to Cloud Map users need to add DNS records for each of the virtual-nodes. With Cloud Map users can create one DNS service for virtual-service and use attributes to subset the endpoints behind that DNS to target specific virtual-nodes. Additionally, App Mesh provides Envoy EDS that can be used by Envoy to discover endpoints for upstream cluster with minimal propagation latencies.
Currently the way to integrate Kubernetes cluster with Cloud Map is to use external-dns. However, external-dns lacks functionality to propagate attributes for endpoints (i.e. pod labels) to Cloud Map. To support App Mesh with Cloud Map aws-app-mesh-controller need to provide native support for Cloud Map.
User Stories
Design
UX
Below we will discuss on how customers will use AWS Cloud Map in the context of aws-app-mesh-controller-for-k8s.
Controller
Behind the scenes aws-app-mesh-controller will perform the following actions
Following App Mesh resources are created for above flow
Following Cloud Map resources will be created by controller
CRD Changes
Future Work
The text was updated successfully, but these errors were encountered: