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

Commit 66c8460

Browse files
authored
creating md files for hld commands (#332)
1 parent 88bdec5 commit 66c8460

File tree

6 files changed

+170
-216
lines changed

6 files changed

+170
-216
lines changed

guides/hld-management.md

Lines changed: 10 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,6 @@
33
Initialize a Bedrock HLD (High Level Definition) repository and deploy pipelines
44
to materalize manifests.
55

6-
Usage:
7-
8-
```
9-
spk hld [command] [options]
10-
```
11-
12-
Commands:
13-
14-
- [HLD - High Level Definition](#hld---high-level-definition)
15-
- [Requirements](#requirements)
16-
- [Commands](#commands)
17-
- [init](#init)
18-
- [install-manifest-pipeline](#install-manifest-pipeline)
19-
- [reconcile](#reconcile)
20-
21-
Global options:
22-
23-
```
24-
-v, --verbose Enable verbose logging
25-
-h, --help Usage information
26-
```
27-
286
## Requirements
297

308
There are a few base assumptions that `spk` makes, as this will affect the set
@@ -49,190 +27,22 @@ azure_devops:
4927
project: "fabrikam" # Your AzDo project
5028
```
5129

52-
## Commands
53-
54-
### init
55-
56-
Initialize the HLD repository by creating the pipeline
57-
`manifest-generation.yaml` file, and the default `component.yaml` for
58-
[fabrikate](https://github.com/microsoft/fabrikate) to consume, if each does not
59-
already exist.
30+
## Usage
6031

6132
```
62-
Usage: hld init|i [options]
63-
64-
Initialize High Level Definition repository. Add manifest-generation.yaml file to working directory/repository if it does not already exist.
65-
66-
Options:
67-
--git-push SPK CLI will try to commit and push these changes to a new origin/branch. (default: false)
68-
--default-component-git <component-repository-url> The default hld repository's component's git repository url. (default: "https://github.com/microsoft/fabrikate-definitions.git")
69-
--default-component-name <component-name> The default hld repository's component's name. (default: "traefik2")
70-
--default-component-path <component-path> The default hld repository's component's path. (default: "definitions/traefik2")
71-
-h, --help output usage information
72-
73-
```
74-
75-
The created `component.yaml` will be populated with a traefik2 definition by
76-
default:
77-
78-
```
79-
name: default-component
80-
subcomponents:
81-
- name: traefik2
82-
method: git
83-
source: 'https://github.com/microsoft/fabrikate-definitions.git'
84-
path: definitions/traefik2
85-
```
86-
87-
However, you can set a another fabrikate definition to be added instead via the
88-
`--default-component-*` flags.
89-
90-
### install-manifest-pipeline
91-
92-
After merging the azure-pipelines yaml file generated by the init step above
93-
into the `master` branch, run the following command to install the HLD to
94-
Manifest pipeline. This pipeline will be triggered on commits to master and
95-
invoke "manifest generation"
96-
[(via fabrikate)](https://github.com/microsoft/fabrikate), rendering helm charts
97-
and configuration into Kubernetes yaml.
98-
99-
```
100-
Usage: hld install-manifest-pipeline|p [options]
101-
102-
Install the manifest generation pipeline to your Azure DevOps instance. Default values are set in spk-config.yaml and can be loaded via spk init or overriden via option flags.
103-
104-
Options:
105-
-n, --pipeline-name <pipeline-name> Name of the pipeline to be created (default: "")
106-
-p, --personal-access-token <personal-access-token> Personal Access Token (default: "")
107-
-o, --org-name <org-name> Organization Name for Azure DevOps (default: "")
108-
-u, --hld-url <hld-url> HLD Repository URL (default: "")
109-
-m, --manifest-url <manifest-url> Manifest Repository URL (default: "")
110-
-d, --devops-project <devops-project> Azure DevOps Project (default: "")
111-
-b, --build-script-url <build-script-url> Build Script URL. By default it is 'https://raw.githubusercontent.com/Microsoft/bedrock/master/gitops/azure-devops/build.sh'. (default: "https://raw.githubusercontent.com/Microsoft/bedrock/master/gitops/azure-devops/build.sh")
112-
--yaml-file-branch <yaml-file-branch> The git branch where the pipeline definition yaml file is located. (default: "master")
113-
-h, --help output usage information
114-
```
115-
116-
### reconcile
117-
118-
The reconcile feature scaffolds a HLD with the services in the `bedrock.yaml`
119-
file at the root level of the application repository. Recall that in a
120-
mono-repo, `spk service create` will add an entry into the `bedrock.yaml`
121-
corresponding to all tracked services. When the service has been merged into
122-
`master` of the application repository, a pipeline (see `hld-lifecycle.yaml`,
123-
created by `spk project init`) runs `spk hld reconcile` to add any _new_
124-
services tracked in `bedrock.yaml` to the HLD.
125-
126-
This command is _intended_ to be run in a pipeline (see the generated
127-
`hld-lifecycle.yaml` created from `spk project init`), but can be run by the
128-
user in a CLI for verification.
129-
130-
```
131-
Usage: hld reconcile|r [options] <repository-name> <hld-path> <bedrock-application-repo-path>
132-
133-
Reconcile a HLD with the services tracked in bedrock.yaml.
134-
135-
Options:
136-
-h, --help output usage information
137-
```
138-
139-
For a `bedrock.yaml` file that contained within the
140-
`https://dev.azure.com/foo/bar/_git` repository, that has the following
141-
structure:
142-
143-
```
144-
rings:
145-
master:
146-
isDefault: true
147-
services:
148-
./services/fabrikam:
149-
displayName: 'fabrikam'
150-
k8sBackendPort: 8001
151-
k8sBackend: 'fabrikam-k8s-svc'
152-
pathPrefix: 'fabrikam-service'
153-
pathPrefixMajorVersion: 'v1'
154-
helm:
155-
chart:
156-
branch: master
157-
git: 'https://dev.azure.com/foo/bar/_git'
158-
path: stable/fabrikam-application
159-
middlewares:
160-
- ''
161-
variableGroups:
162-
- fabrikam-vg
163-
```
164-
165-
A HLD is produced that resembles the following:
166-
167-
```
168-
├── component.yaml
169-
└── fabrikam
170-
├── access.yaml
171-
├── component.yaml
172-
├── config
173-
│   └── common.yaml
174-
└── fabrikam
175-
├── component.yaml
176-
├── config
177-
│   └── common.yaml
178-
└── master
179-
├── component.yaml
180-
├── config
181-
│   └── common.yaml
182-
└── static
183-
├── ingress-route.yaml
184-
└── middlewares.yaml
185-
```
186-
187-
With the `ingress-route.yaml` representing a
188-
[Traefik2 Ingress Route](https://docs.traefik.io/routing/providers/kubernetes-crd/#kind-ingressroute)
189-
backed by a Kubernetes Service, and the `middlewares.yaml` representing a
190-
[Traefik2 Middleware](https://docs.traefik.io/routing/providers/kubernetes-crd/#kind-middleware)
191-
that strips path prefixes.
192-
193-
For the `bedrock.yaml` shown above, the `ingress-route.yaml` produced is:
194-
195-
```
196-
apiVersion: traefik.containo.us/v1alpha1
197-
kind: IngressRoute
198-
metadata:
199-
name: fabrikam-master
200-
spec:
201-
routes:
202-
- kind: Rule
203-
match: 'PathPrefix(`/v1/fabrikam-service`) && Headers(`Ring`, `master`)'
204-
middlewares:
205-
- name: fabrikam-master
206-
services:
207-
- name: fabrikam-k8s-svc-master
208-
port: 8001
33+
spk hld [command] [options]
20934
```
21035

211-
And the `middlewares.yaml` produced is:
36+
## Commands:
21237

213-
```
214-
apiVersion: traefik.containo.us/v1alpha1
215-
kind: Middleware
216-
metadata:
217-
name: fabrikam-master
218-
spec:
219-
stripPrefix:
220-
forceSlash: false
221-
prefixes:
222-
- /v1/fabrikam-service
223-
```
38+
- [init](https://catalystcode.github.io/spk/commands/index.html#hld_init)
39+
- [install-manifest-pipeline](https://catalystcode.github.io/spk/commands/index.html#hld_install-manifest-pipeline)
40+
- [reconcile](https://catalystcode.github.io/spk/commands/index.html#hld_reconcile)
22441

225-
Note that there exists a third generated file, `access.yaml`. For the above
226-
`bedrock.yaml`, `access.yaml` contains a single line, which represents a
227-
[Fabrikate access.yaml definition](https://github.com/microsoft/fabrikate/blob/master/docs/auth.md#accessyaml),
228-
allowing Fabrikate to pull Helm Charts that are contained within the same
229-
application repository:
42+
## Global options:
23043

23144
```
232-
'https://dev.azure.com/foo/bar/_git': ACCESS_TOKEN_SECRET
45+
-V, --version output the version number
46+
-v, --verbose Enable verbose logging
47+
-h, --help Usage information
23348
```
234-
235-
When `fabrikate` is invoked in the HLD to Manifest pipeline, it will utilize the
236-
`ACCESS_TOKEN_SECRET` environment variable injected at pipeline run-time as a
237-
Personal Access Token to pull any referenced helm charts from the application
238-
repository.

guides/project-management.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,18 @@
33
Create and manage components for a Bedrock project. All project management
44
commands will need to run in the order as listed below due to dependencies.
55

6-
Usage:
6+
## Prerequisites
7+
8+
An Azure DevOps git repository.
9+
10+
## Usage
711

812
```
913
Usage: project [options] [command]
1014
1115
Initialize and manage your Bedrock project.
12-
13-
Options:
14-
-v, --verbose Enable verbose logging
15-
-h, --help output usage information
16-
17-
Commands:
18-
create-variable-group|cvg [options] <variable-group-name> Create a new variable group in Azure DevOps project with specific variables (ACR name, HLD Repo name, Personal Access Token, Service Principal id, Service Principal password, and Azure AD tenant id)
19-
init|i [options] Initialize your spk repository. Add starter bedrock.yaml, maintainers.yaml, hld-lifecycle.yaml, and .gitignore files to your project.
20-
install-lifecycle-pipeline|p [options] Install the hld lifecycle pipeline to your Azure DevOps instance
2116
```
2217

23-
## Prerequisites
24-
25-
An Azure DevOps git repository.
26-
2718
## Commands
2819

2920
- [init](https://catalystcode.github.io/spk/commands/index.html#project_init)
@@ -32,3 +23,12 @@ An Azure DevOps git repository.
3223

3324
**Please note all project management commands must run in the order as listed
3425
above.**
26+
27+
## Global Options
28+
29+
```
30+
-V, --version output the version number
31+
-v, --verbose Enable verbose logging
32+
-h, --help output usage information
33+
34+
```

guides/service-management.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ Usage:
1111
spk service [command] [options]
1212
```
1313

14-
Commands:
14+
## Commands
1515

1616
- [create](https://catalystcode.github.io/spk/commands/index.html#service_create)
1717
- [install-build-pipeline](https://catalystcode.github.io/spk/commands/index.html#service_install-build-pipeline)
1818
- [create-revision](https://catalystcode.github.io/spk/commands/index.html#service_create-revision)
1919

20-
Global options:
20+
## Global options
2121

2222
```
23+
-V, --version output the version number
2324
-v, --verbose Enable verbose logging
2425
-h, --help Usage information
2526
```

src/commands/hld/init.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Description
2+
3+
Initializes the HLD repository by creating the pipeline
4+
`manifest-generation.yaml` file, and the default `component.yaml` for
5+
[fabrikate](https://github.com/microsoft/fabrikate) to consume, if each does not
6+
already exist.
7+
8+
The created `component.yaml` will be populated with a traefik2 definition by
9+
default:
10+
11+
```
12+
name: default-component
13+
subcomponents:
14+
- name: traefik2
15+
method: git
16+
source: 'https://github.com/microsoft/fabrikate-definitions.git'
17+
path: definitions/traefik2
18+
```
19+
20+
However, you can set a another fabrikate definition to be added instead via the
21+
`--default-component-*` flags.

src/commands/hld/pipeline.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## Description
2+
3+
After merging the azure-pipelines yaml file generated by the init step above
4+
into the `master` branch, run the following command to install the HLD to
5+
Manifest pipeline. This pipeline will be triggered on commits to master and
6+
invoke "manifest generation"
7+
[(via fabrikate)](https://github.com/microsoft/fabrikate), rendering helm charts
8+
and configuration into Kubernetes yaml.

0 commit comments

Comments
 (0)