Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit 8724e40

Browse files
committed
Added missing docs for the isDefault Ring
- Added updated documentation for the the default routing functionality of rings marked as `isDefault: true`
1 parent 44ccb10 commit 8724e40

File tree

1 file changed

+66
-6
lines changed

1 file changed

+66
-6
lines changed

guides/rings-101.md

+66-6
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ remove the `ring` from the HLD repository and subsequently, the cluster, follow
121121
the manual steps outlined
122122
[here.](manual-guide-to-rings.md#removing-the-ring-from-the-cluster)
123123

124-
### Setting the Default Ring
124+
### Setting the Default Ring / Routing
125125

126-
For every bedrock project, there will be a default ring. By default, this is the
127-
`master` ring, which corresponds to the master branch of the repository.
126+
For every bedrock project, there may be a single default ring. By default, this
127+
is the `master` ring, which corresponds to the master branch of the repository.
128128

129129
For a `bedrock.yaml`:
130130

@@ -134,15 +134,69 @@ rings:
134134
isDefault: true
135135
develop:
136136
isDefault: false
137-
services: ...
137+
qa: {} # isDefault not present is same as isDefault: false
138+
services:
139+
./my-service-foo:
140+
displayName: fancy-service
141+
helm:
142+
chart:
143+
accessTokenVariable: MY_ENV_VAR
144+
branch: master
145+
git: "https://dev.azure.com/my-org/my-project/_git/my-repo"
146+
path: my-service-helm-chart
147+
k8sBackend: backend-service
148+
k8sBackendPort: 80
149+
middlewares: []
150+
pathPrefix: ""
151+
pathPrefixMajorVersion: ""
138152
```
139153
140154
the property `isDefault` denotes which `ring` is the default ring.
141155

142-
Currently this property is only being used by the `spk service create-revision`
143-
command. Details can be found
156+
Being a _default_ ring means an additional set of Traefik2 IngressRoute and
157+
Middleware will be created for its services in the Manifest-Generation pipeline.
158+
These IngressRoute and Middleware will not be _ringed_ (i.e. not require a
159+
header to ping it) but point to the same underlying Kubernetes service as its
160+
ringed counterpart. In the example of above, the Manifest-Generation pipeline
161+
will generate the following ingress routes:
162+
163+
```yaml
164+
apiVersion: traefik.containo.us/v1alpha1
165+
kind: IngressRoute
166+
metadata:
167+
name: fancy-service-master
168+
spec:
169+
routes:
170+
- kind: Rule
171+
match: "PathPrefix(`/fancy-service`) && Headers(`Ring`, `master`)" # a route still requiring a the Ring header
172+
middlewares:
173+
- name: fancy-service-master
174+
services:
175+
- name: backend-service-master # the ringed version of the k8s backend service
176+
port: 80
177+
178+
---
179+
apiVersion: traefik.containo.us/v1alpha1
180+
kind: IngressRoute
181+
metadata:
182+
name: fancy-service
183+
spec:
184+
routes:
185+
- kind: Rule
186+
match: PathPrefix(`/fancy-service`) # a route freely exposed without a Ring header
187+
middlewares:
188+
- name: fancy-service
189+
services:
190+
- name: backend-service-master # points to the same backend service as its ringed counterpart
191+
port: 80
192+
```
193+
194+
In addition this property is used by the `spk service create-revision` command.
195+
Details can be found
144196
[here.](https://catalystcode.github.io/spk/commands/index.html#service_create-revision)
145197

198+
Note: there can only be 1 (one) ringed marked as `isDefault`.
199+
146200
### What Services Have What Rings?
147201

148202
For each ring defined in your `bedrock.yaml` file, every services
@@ -216,8 +270,14 @@ ping our services now via a curl command containing the header
216270
ping:
217271

218272
```sh
273+
curl -H 88.88.88.88/foo/
274+
curl -H 88.88.88.88/bar/
219275
curl -H "Ring: master" 88.88.88.88/foo/
220276
curl -H "Ring: master" 88.88.88.88/bar/
221277
curl -H "Ring: develop" 88.88.88.88/foo/
222278
curl -H "Ring: develop" 88.88.88.88/bar/
223279
```
280+
281+
Note: the curl requests with and without the header `Ring: master` will be point
282+
to the same underlying service Kubernetes service (refer to:
283+
[Setting A Default Ring](#setting-the-default-ring--routing))

0 commit comments

Comments
 (0)