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

Commit b855515

Browse files
mtarngandrebriggs
andauthored
Expanding rings guides on automation through spk and adding clarifica… (#388)
* Expanding rings guides on automation through spk and adding clarification on pipelines * Update rings-101.md Typo * feedback Co-authored-by: Andre Briggs <[email protected]>
1 parent 4eb7370 commit b855515

File tree

2 files changed

+77
-12
lines changed

2 files changed

+77
-12
lines changed

guides/manual-guide-to-rings.md

+19-8
Original file line numberDiff line numberDiff line change
@@ -276,20 +276,25 @@ variables:
276276
4. Observe that committing to the `test-new-feature` should no longer trigger
277277
builds.
278278

279-
_Do note that deleting a `ring` presently does not remove the service and `ring`
280-
from a cluster. This work is being
281-
[tracked here](https://github.com/microsoft/bedrock/issues/858) but the
282-
following instructions will detail how this can be done manually_
279+
**Note:** Deleting a `ring` presently does not remove the service and `ring`
280+
from a cluster as the project lifecycle pipeline does not yet remove rings or
281+
services from the HLD repository. The work to support the automated removal of
282+
rings and services is being
283+
[tracked here.](https://github.com/microsoft/bedrock/issues/858) The following
284+
instructions will detail how to remove a ring from a cluster by removing all
285+
references to the ring in the HLD repository.
283286

284-
5. To remove a `ring` from a cluster, you must remove the `ring` component from
287+
#### Removing the Ring from the cluster
288+
289+
1. To remove a `ring` from a cluster, you must remove the `ring` component from
285290
the HLD. Recall the Pull Request generated by the `hld-lifecycle` pipeline
286291
when adding a `ring` to the `bedrock.yaml` file. The `ring` component is
287292
identified in the below diagram as `[Ring Component]`. In a clone of the HLD
288293
repository, one can delete the directory identified by `[Ring Component]`:
289294

290295
![Sample HLD](./images/spk-hld-generated.png)
291296

292-
6. Finally, a user must modify the `component.yaml` within the directory
297+
2. Finally, a user must modify the `component.yaml` within the directory
293298
identified by `[Service Component]` in the above diagram to no longer point
294299
to the directory that was deleted. For our sample service, `fabrikam`, with a
295300
ring to be removed, `test-new-feature`, the Service Component
@@ -317,7 +322,13 @@ subcomponents:
317322
path: ./test-new-feature <-- DELETE -->
318323
```
319324

320-
7. Finally, after ensuring the `component.yaml` has been updated, and the `ring`
325+
3. Make sure the above steps are followed for each service associated with the
326+
`bedrock.yaml` that the `ring` was removed from.
327+
328+
4. Finally, after ensuring the `component.yaml` has been updated, and the `ring`
321329
component directory in the HLD has been removed for the service, a user can
322330
commit and push the changes to a branch, merging it into the master branch of
323-
their HLD, and triggering a rebuild of manifests deployed to the cluster.
331+
their HLD. The subsequent triggered HLD to manifest pipeline will regenerate
332+
the manifests, which will now exclude the removed ring, and the next flux
333+
deployment will remove any associated k8s deployments and services from the
334+
cluster.

guides/rings-101.md

+58-4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Traefik2 to the correct _Ringed Service_ based on the service requested and the
6161

6262
## Rings & SPK
6363

64-
### Perquisites
64+
### Prerequisites
6565

6666
[SPK](https://github.com/CatalystCode/spk) is command line tool meant to ease
6767
the adoption of [Bedrock](https://github.com/microsoft/bedrock/) methodologies
@@ -76,9 +76,28 @@ Creating/adding a Ring is based around a single command:
7676

7777
This command adds a new ring to your spk project and tracks it in projects
7878
`bedrock.yaml` file. Subsequently, the command walks through every service in
79-
your project and updates their pipeline YAML to monitor the git branch the ring
80-
corresponds to. Making every merge into the ring branch trigger a new
81-
build/deployment of your ring.
79+
your project and updates their build pipeline YAML to monitor the git branch the
80+
ring corresponds to, so that every merge into the ring branch will trigger a new
81+
build/deployment of your ring for the associated service.
82+
83+
Commiting these changes to the `master` branch, or the branch where the
84+
`hld-lifecycle.yaml` pipeline triggers off of, will trigger the project
85+
lifecycle pipeline to add the ring to each service defined in the project
86+
`bedrock.yaml` in the HLD repository.
87+
88+
A sample HLD repository tree for a sample application repository
89+
(`fabrikam-project`) with a service (`fabrikam`) and a newly added ring (`dev`):
90+
91+
![Sample HLD](./images/spk-hld-generated.png)
92+
93+
**Note:** There should only ever be a single lifecycle pipeline associated with
94+
a project. The single branch on which it triggers, points to the "source of
95+
truth" `bedrock.yaml`. This is the branch on which ring creation and deletion
96+
needs to be commited to.
97+
98+
**Note:** Because `spk` will add the branch triggers for each ring added to all
99+
associated service build pipelines within a project, no additional pipelines
100+
should be created when adding a ring.
82101

83102
### Deleting/Removing a Ring
84103

@@ -89,6 +108,41 @@ This command removes the ring from your `bedrock.yaml` file and walks through
89108
all the services in your project and removing the ring branch from the service
90109
pipeline YAML.
91110

111+
**Note:** The "default" ring cannot be deleted. If you wish to remove the ring
112+
defined under `bedrock.yaml` with `isDefault: true`, you must first set another
113+
ring to be the default ring via `spk ring set-default <new-default-ring-name>`.
114+
115+
**Note:** Deleting a `ring` presently does not remove the service and `ring`
116+
from a cluster as the project lifecycle pipeline does not yet remove rings or
117+
services from the HLD repository. The work to support the automated removal of
118+
rings and services is being
119+
[tracked here.](https://github.com/microsoft/bedrock/issues/858) To manually
120+
remove the `ring` from the HLD repository and subsequently, the cluster, follow
121+
the manual steps outlined
122+
[here.](manual-guide-to-rings.md#removing-the-ring-from-the-cluster)
123+
124+
### Setting the Default Ring
125+
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.
128+
129+
For a `bedrock.yaml`:
130+
131+
```yaml
132+
rings:
133+
master:
134+
isDefault: true
135+
develop:
136+
isDefault: false
137+
services: ...
138+
```
139+
140+
the property `isDefault` denotes which `ring` is the default ring.
141+
142+
Currently this property is only being used by the `spk service create-revision`
143+
command. Details can be found
144+
[here.](https://catalystcode.github.io/spk/commands/index.html#service_create-revision)
145+
92146
### What Services Have What Rings?
93147

94148
For each ring defined in your `bedrock.yaml` file, every services

0 commit comments

Comments
 (0)