Skip to content

Commit 8dfbb31

Browse files
committed
Create Cloud Map documentation
This adds guides about Cloud Map and updates some existing ones by including Cloud Map settings/data. Signed-off-by: Elis Lulja <[email protected]>
1 parent 0a00fc9 commit 8dfbb31

7 files changed

+285
-13
lines changed

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,15 @@ If you want to quickly see how CN-WAN Operator works, you can follow this simple
4949

5050
### Google Service Directory
5151

52-
* [Quickstart with service directory](./docs/gcp_service_directory/quickstart.md)
52+
* [Quickstart with Service Directory](./docs/gcp_service_directory/quickstart.md)
5353
* [Concepts](./docs/gcp_service_directory/concepts.md)
54-
* [Configure CN-Operator with service directory](./docs/gcp_service_directory/configure_with_operator.md)
54+
* [Configure CN-Operator with Service Directory](./docs/gcp_service_directory/configure_with_operator.md)
55+
56+
### AWS Cloud Map
57+
58+
* [Quickstart with Cloud Map](./docs/aws_cloud_map/quickstart.md)
59+
* [Concepts](./docs/aws_cloud_map/concepts.md)
60+
* [Configure CN-Operator with Cloud Map](./docs/aws_cloud_map/operator_configuration.md)
5561

5662
## Contributing
5763

docs/aws_cloud_map/concepts.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Concepts
2+
3+
## AWS Cloud Map
4+
5+
AWS Cloud Map is an example of a service registry and it groups resources as *Namespace*, *Service* and *Instance*.
6+
7+
For more information about Cloud Map, you can refer to its [official website](https://aws.amazon.com/cloud-map/).
8+
9+
Useful links:
10+
11+
* A [quickstart](./quickstart.md) for Cloud Map and CN-WAN Operator
12+
* A [guide](./operator_configuration.md) to correctly configure CN-WAN Operator with Cloud Map
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Configure CN-WAN Operator with AWS Cloud Map
2+
3+
## Settings format
4+
5+
The included directory `artifacts/settings` contains a `settings.yaml` for you to modify with the appropriate values.
6+
7+
For your convenience, here is how the settings for the CN-WAN Operator looks like:
8+
9+
```yaml
10+
watchNamespacesByDefault: false
11+
serviceAnnotations: []
12+
serviceRegistry:
13+
etcd:
14+
prefix: <prefix>
15+
authentication: <your-authentication-type>
16+
endpoints:
17+
- host: <host-1>
18+
port: <port-1>
19+
- host: <host-2>
20+
port: <port-2>
21+
gcpServiceDirectory:
22+
defaultRegion: <region>
23+
projectID: <project>
24+
awsCloudMap:
25+
defaultRegion: <region>
26+
cloudMetadata:
27+
network: auto
28+
subNetwork: auto
29+
```
30+
31+
We will only cover Cloud Map settings here, so you can go ahead and remove some settings:
32+
33+
```yaml
34+
watchNamespacesByDefault: false
35+
serviceAnnotations: []
36+
serviceRegistry:
37+
awsCloudMap:
38+
defaultRegion: <region>
39+
```
40+
41+
`namespace` and `service` settings are covered in the [main documentation](../configuration.md). Let's now only focus on `serviceRegistry` options.
42+
43+
## Cloud Map settings
44+
45+
### Default region
46+
47+
This is the [region](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/) where you want the CN-WAN Operator to put objects into. You should choose a region as close as possible to your cluster or the end user of Cloud Map.
48+
49+
## Full example
50+
51+
### Example 1
52+
53+
In this example, you are telling the CN-WAN Operator:
54+
55+
* to use `us-west-2` as default region
56+
57+
Here is the settings example - we omit `namespace` and `service` settings for brevity:
58+
59+
```yaml
60+
namespace: ...
61+
service: ...
62+
awsCloudMap:
63+
defaultRegion: us-west-2
64+
```

docs/aws_cloud_map/quickstart.md

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# Quickstart
2+
3+
To run this, make sure you have:
4+
5+
* Access to a Kubernetes cluster running at least version `1.11.3` with support for [LoadBalancer](./concepts.md#supported-service-types) type of services and that can perform outbound HTTP/S requests successfully.
6+
* You can even try with [KinD](https://kind.sigs.k8s.io/) or [Minikube](https://kubernetes.io/docs/setup/learning-environment/minikube/), but make sure *Load Balancer*s work.
7+
* [Kubectl 1.11.3+](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
8+
* An AWS account
9+
* AWS Credentials file
10+
11+
Finally, [kubeconfig](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/) needs to be properly set up.
12+
13+
## Let's go
14+
15+
### 1 - Clone the project
16+
17+
```bash
18+
git clone https://github.com/CloudNativeSDWAN/cnwan-operator.git
19+
cd ./cnwan-operator
20+
```
21+
22+
### 2 - Deploy a test service
23+
24+
We will suppose you are deploying an application on your cluster where your employees can log in and watch training videos.
25+
26+
Run this to deploy a new namespace and a service in that namespace:
27+
28+
```bash
29+
cat <<EOF | kubectl create -f -
30+
kind: Namespace
31+
apiVersion: v1
32+
metadata:
33+
name: training-app-namespace
34+
labels:
35+
purpose: "test"
36+
operator.cnwan.io/watch: "enabled"
37+
---
38+
kind: Service
39+
apiVersion: v1
40+
metadata:
41+
name: web-training
42+
namespace: training-app-namespace
43+
labels:
44+
app: "training"
45+
annotations:
46+
version: "2.1"
47+
traffic-profile: "standard"
48+
spec:
49+
ports:
50+
- name: port80
51+
protocol: TCP
52+
port: 80
53+
targetPort: 8080
54+
selector:
55+
app: "training"
56+
type: LoadBalancer
57+
EOF
58+
```
59+
60+
Please notice that the namespace has this label: `operator.cnwan.io/watch: enabled` which instructs the operator to watch events occurring in this namespace. Also notice that the service has annotations that will be registered as [metadata](./concepts.md#metadata):
61+
62+
```yaml
63+
annotations:
64+
traffic-profile: standard
65+
```
66+
67+
Now verify that the namespace is there:
68+
69+
```bash
70+
kubectl get ns
71+
72+
NAME STATUS AGE
73+
training-app-namespace Active 1h
74+
```
75+
76+
Verify that the service is there and has an IP:
77+
78+
```bash
79+
kubectl get service -n training-app-namespace
80+
81+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
82+
web-training LoadBalancer 10.11.12.13 20.21.22.23 80:32058/TCP 1h
83+
```
84+
85+
If you see `<none>` or `<pending>` under `EXTERNAL-IP` you either have to wait to see an IP there or your cluster doesn't support [LoadBalancer](./concepts.md#supported-service-types).
86+
87+
It doesn't really matter that there is no pod backing this service for now, as this is just a test. Of course, in a real world scenario you should make sure a pod is there.
88+
89+
### 3 - Provide the credentials file
90+
91+
Navigate to the root directory and place your credentials file to `artifacts/secrets`, with name `credentials`.
92+
93+
### 4 - Provide settings
94+
95+
From the root directory navigate to `artifacts/settings` and modify the file `settings.yaml` to look like this - please provide appropriate values in place of `<gcloud-project>` and `<gcloud-region>`:
96+
97+
```yaml
98+
watchNamespacesByDefault: false
99+
serviceAnnotations:
100+
- traffic-profile
101+
- version
102+
serviceRegistry:
103+
awsCloudMap:
104+
defaultRegion: <region>
105+
```
106+
107+
Please notice the values inside `annotations`:
108+
109+
```yaml
110+
annotations:
111+
- traffic-profile
112+
- version
113+
```
114+
115+
This means that the operator will register `traffic-profile` as tags if it finds it among a [service's annotations list](./concepts.md#allowed-annotations).
116+
117+
### 5 - Deploy the operator
118+
119+
From the root directory of the project, execute
120+
121+
```bash
122+
./scripts/deploy.sh cloudmap
123+
```
124+
125+
### 6 - See it on Cloud Map
126+
127+
Now, log in to Cloud Map from the AWS console and after some time you will see a namespace that has the same name as the Kubernetes namespace where that service was found in.
128+
129+
If you click on it, you will see a service: its tags contain `traffic-profile: standard`. It will also contain an instance with data about the port and the address.
130+
131+
### 7 - Update metadata
132+
133+
Now you're basically done, but you can follow these additional steps to see more of the operator in action.
134+
135+
Suppose you made a mistake: this is a training application where your employees will follow video tutorials and therefore, its kind of traffic - or, *profile*, must be `video`.
136+
137+
Execute:
138+
139+
```bash
140+
kubectl annotate service web-training traffic-profile=video --overwrite -n training-app-namespace
141+
```
142+
143+
The operator has updated the tags in Cloud Map accordingly.
144+
145+
### 8 - Add new metadata
146+
147+
Suppose you have a CI/CD pipeline that for each PR builds a container with a new tag. Also, it updates the service that serves the pods running that container by specifying the new version. Today, you will be that pipeline:
148+
149+
```bash
150+
kubectl annotate service web-training version=2.2 -n training-app-namespace --overwrite
151+
```
152+
153+
Once again, log in to Cloud Map and see how the tags for that service have changed accordingly.
154+
155+
## Where to go from here
156+
157+
Well, that's it for a quickstart. Now we encourage you to learn more about CN-WAN Operator by taking a look at the [docs](./).
158+
159+
Also, make sure you read the [official documentation of CN-WAN](https://github.com/CloudNativeSDWAN/cnwan-docs) to learn how you can apply this simple quickstart to a real world scenario.
160+
161+
## Clean up
162+
163+
From the root directory of the project, run
164+
165+
```bash
166+
./scripts/remove.sh
167+
kubectl delete ns training-app-namespace
168+
```

docs/configuration.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ serviceRegistry:
3131
gcpServiceDirectory:
3232
defaultRegion: <region>
3333
projectID: <project>
34+
awsCloudMap:
35+
defaultRegion: <region>
3436
cloudMetadata:
3537
network: auto
3638
subNetwork: auto
@@ -120,11 +122,13 @@ cloudMetadata:
120122
subNetwork: auto
121123
```
122124

123-
and the Operator will try to detect such information on its own. You can remove a field, e.g. `subNetwork`, from the settings if you don't want that to be registered.
125+
and the Operator will try to detect such information on its own. Note that automatic feature is only supported for *GKE* and for the other platforms you will have to write that information manually until they will be supported as well.
126+
127+
You can remove a field, e.g. `subNetwork`, from the settings if you don't want that to be registered.
124128

125129
These values will be registered on a service metadata as:
126130

127-
```text
131+
```yaml
128132
cnwan.io/network: <name-or-id>
129133
cnwan.io/sub-network: <name-or-id>
130134
```
@@ -135,10 +139,11 @@ Additionally, `cnwan.io/platform: <name>` will also be included if the operator
135139

136140
Under `serviceRegistry` you define which service registry to use and how the operator should connect to it or manage its objects.
137141

138-
As of now, only one of `etcd` or `gcpServiceDirectory` is allowed, and therefore you should remove the one that you don't use. Please follow one of the following guides to learn how to configure the Operator with the chosen service registry:
142+
As of now, only one of `etcd`, `gcpServiceDirectory` or `awsCloudMap` is allowed, and therefore you should remove the one that you don't use. Please follow one of the following guides to learn how to configure the Operator with the chosen service registry:
139143

140144
* [etcd](./etcd/operator_configuration.md)
141-
* [service directory](./gcp_service_directory/configure_with_operator.md)
145+
* [Service Directory](./gcp_service_directory/configure_with_operator.md)
146+
* [Cloud Map](./aws_cloud_map/operator_configuration.md)
142147

143148
## Deploy settings
144149

docs/install.md

+23-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ You need to have the following:
1515

1616
Depending on the service registry you chose:
1717

18-
* For Google Service Directory:
19-
* a Project in [Google Cloud](https://console.cloud.google.com/) with [Service Directory](https://cloud.google.com/service-directory) enabled
20-
* a [Google Cloud Service Account](https://cloud.google.com/iam/docs/service-accounts) with at least role `roles/servicedirectory.editor`.
2118
* For etcd:
2219
* a working and reachable etcd cluster
2320
* optional: user credentials for etcd
21+
* For Google Service Directory:
22+
* a Project in [Google Cloud](https://console.cloud.google.com/) with [Service Directory](https://cloud.google.com/service-directory) enabled
23+
* a [Google Cloud Service Account](https://cloud.google.com/iam/docs/service-accounts) with at least role `roles/servicedirectory.editor`.
24+
* For AWS Cloud Map:
25+
* a AWS Account
26+
* AWS credentials. Make sure you read AWS documentation to know how to get credentials, for example [here](https://docs.aws.amazon.com/singlesignon/latest/userguide/howtogetcredentials.html), but we encourage you to do some research the documentation on your own, as there are many ways to get them.
2427

2528
### Software
2629

@@ -47,7 +50,7 @@ Before deploying the operator you will need to configure it.
4750

4851
### Settings
4952

50-
Modify the file `artifacts/deploy/settings/settings.yaml` with the appropriate values. If you haven't already, please read [Configuration](./configuration.md) to learn how to do this.
53+
Modify the file `artifacts/settings/settings.yaml` with the appropriate values. If you haven't already, please read [Configuration](./configuration.md) to learn how to do this.
5154
5255
## Deploy
5356
@@ -58,7 +61,7 @@ Before continuing, if you also have other files that you want to be deployed, yo
5861
To deploy the operator with the provided script, you will have to execute `deploy.sh` as such:
5962
6063
```bash
61-
./scripts/deploy.sh etcd|servicedirectory
64+
./scripts/deploy.sh etcd|servicedirectory|cloudmap
6265
```
6366
6467
If you want to use your own image, you'll need to provide `--image` flag, for example:
@@ -84,14 +87,28 @@ From the root directory of the project, execute
8487
8588
### With Google Service Directory
8689
87-
Place your Google account in `deploy/settings` and rename it as `gcloud-credentials.json`. Therefore, your `deploy/settings` will contain `settings.yaml` and `gcloud-credentials.json`.
90+
Place your Google service account in `artifacts/secrets` and rename it as `gcloud-credentials.json`.
8891
8992
Now run
9093
9194
```bash
9295
./scripts/deploy.sh servicedirectory
9396
```
9497
98+
or you can provide the file via `--service-account`.
99+
100+
### With AWS Cloud Map
101+
102+
Place your AWS credentials file `artifacts/secrets` and rename it as `credentials`.
103+
104+
Now run
105+
106+
```bash
107+
./scripts/deploy.sh cloudmap
108+
```
109+
110+
or you can provide the file via `--credentials`
111+
95112
## Remove
96113
97114
To remove the operator, execute:

docs/service_registry.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Which one you choose depends on different factors, including:
3030

3131
and so on.
3232

33-
As we said on the main documentation, the CN-WAN Operator currently supports *Google Service Directory* and *etcd*.
33+
As we said on the main documentation, the CN-WAN Operator currently supports *Google Service Directory*, *etcd* and *AWS Cloud Map*.
3434

3535
## Objects
3636

0 commit comments

Comments
 (0)