Skip to content

Commit eb2947e

Browse files
committed
Improved doc formating
Signed-off-by: eyuen <[email protected]>
1 parent 879090a commit eb2947e

File tree

2 files changed

+47
-23
lines changed

2 files changed

+47
-23
lines changed

docs/proposals/devfile/outer-loop-build-and-deploy.md

+39-18
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Existing devfile 2.0 mainly focuses on providing inner-loop support. This propos
77
As an application developer, I would like to build a microservice and deploy it to Kubernetes to do a build that is typically done as part of a pipeline
88

99
- Do a full build to build the container image
10-
- Input\
10+
- Input:\
1111
The build may use different technologies for building, e.g. dockerfile, buildpacks
1212
- Output:\
1313
A container image that contains the microservice and ready to be deployed to Kubernetes
@@ -19,7 +19,7 @@ The focus of this proposal is to provide the ability to build and deploy applica
1919

2020
We will cover two main stages:
2121
1. Build the image
22-
2. Deployment of the image. Deploy the image to a cluster
22+
2. Deploy the image to a cluster
2323

2424
## Build the image
2525

@@ -37,6 +37,7 @@ The definition of the image build introduces a new component type `image` for th
3737
__Alternative approach:__ we can consider reusing the `exec` type except that these build types are special and we may not want to incorporate the full image build command into an `exec` command. Therefore, I chose to use a different type of command here.
3838

3939
### Example using a file Dockerfile as part of the app:
40+
```yaml
4041
variables:
4142
myimage: myimagename
4243
components:
@@ -48,6 +49,7 @@ __Alternative approach:__ we can consider reusing the `exec` type except that th
4849
location: Dockerfile
4950
args: [ "arg1", "arg2", "arg3" ]
5051
rootRequired: false
52+
```
5153
5254
`imageName`: name of the generated image (or we may use an id for referencing the image). This imageName can also be fully qualified to allow pushing of the image to a specific image registry.
5355

@@ -63,6 +65,7 @@ __Note:__
6365
1. A common pattern will be using a global variable to define the image name (`myimage` in the example above) so that it can be easily referred to in the deploy step later.
6466

6567
### Example using a Dockerfile with registry and secret for the image push:
68+
```yaml
6669
variables:
6770
myimage: myimagename
6871
components:
@@ -77,18 +80,22 @@ __Note:__
7780
envFrom:
7881
- secretRef:
7982
name: my-secret
83+
```
8084

8185
`secretRef`: The reference to the secret for pushing the image to the registry
8286

8387
For the secrets, it should support the same mechanisms as specified in https://github.com/devfile/api/issues/299.
8488

8589
### Example using `apply` command on an image component:
90+
```yaml
8691
commands:
8792
- id: deploybuild
8893
apply:
8994
component: mydockerfileimage
95+
```
9096

9197
### Example using a Dockerfile stored within the devfile registry as a resource with `apply` command:
98+
```yaml
9299
variables:
93100
myimage: myimagename
94101
components:
@@ -102,11 +109,13 @@ For the secrets, it should support the same mechanisms as specified in https://g
102109
- id: deploybuild
103110
apply:
104111
component: mydockerfileimage
112+
```
105113

106114
__Note:__
107115
1. The `apply` command with the `image` component is optional. If the `apply` command that references an image component does not exist, then the image build will be done at the startup automatically (similar to the behaviour of the existing `kubernetes` components). If there is an `apply` command that references the `image` component, then the user will need to create a composite command to chain the image build apply command with the deploy command (see the deployment command section) to complete the build and deploy.
108116

109117
### Example using a Dockerfile stored in a git repo with push registry without apply command:
118+
```yaml
110119
variables:
111120
myimage: myimagename
112121
components:
@@ -119,6 +128,7 @@ __Note:__
119128
origin: "https://github.com/odo-devfiles/nodejs-ex.git"
120129
location: Dockerfile
121130
args: [ ]
131+
```
122132

123133
The git definition will be the same as the one in `starterProjects` definition that supports `checkoutFrom`
124134

@@ -130,6 +140,7 @@ Notes:
130140
1. Do we need image push registry info to specify where to push the image to? If needed, then the secret for the push can be specified as `secretKeyRef` in https://github.com/devfile/api/issues/299
131141

132142
### Example using SourceToImage (S2I):
143+
```yaml
133144
variables:
134145
myimage: myimagename
135146
components:
@@ -146,6 +157,7 @@ Notes:
146157
- id: deploybuild
147158
apply:
148159
component: mys2iimage
160+
```
149161

150162
`builderImageNamespace`: Namespace where builder image is present
151163

@@ -170,6 +182,7 @@ The current design is to try to reuse the existing `kubernetes` component as muc
170182

171183
#### Examples of using `deploy` group command:
172184
##### Kubernetes deployment manifest:
185+
```yaml
173186
components:
174187
- name: myk8sdeploy
175188
kubernetes:
@@ -185,12 +198,14 @@ The current design is to try to reuse the existing `kubernetes` component as muc
185198
attributes:
186199
- name: CONTAINER_IMAGE
187200
value: {{myimage}}
201+
```
188202

189203
`uri`: Kubernetes manifest location (can use `kubectl` to deploy) which can be an URL or a path relative to the devfile. [Example of Kubernetes deployment](#markdown-header-example-of-kubernetes-deployment-manifest) manifest and [example of Operator deployment manifest](#markdown-header-example-of-operator-deployment-manifest).
190204

191205
Variables that need to be replaced during the deployment can be specified using a new `attributes` definition under the `apply` command. One usage example is to pass the image name along to the deployment manifest. A common practice is to use a global variable, e.g. `myimage` in the example above, to refer to the image built in the image built stage.
192206

193207
##### Kubernetes deployment manifest (inlined):
208+
```yaml
194209
components:
195210
- name: myk8deploy
196211
kubernetes:
@@ -215,8 +230,27 @@ Variables that need to be replaced during the deployment can be specified using
215230
group:
216231
kind: deploy
217232
isDefault: true
233+
```
234+
235+
#### Example of Operator deployment manifest:
236+
```yaml
237+
apiVersion: app.stacks/v1beta1
238+
kind: RuntimeComponent
239+
metadata:
240+
name: {{.COMPONENT_NAME}}
241+
spec:
242+
applicationImage: {{.CONTAINER_IMAGE}}
243+
service:
244+
type: ClusterIP
245+
port: {{.PORT}}
246+
expose: true
247+
storage:
248+
size: 2Gi
249+
mountPath: "/logs"
250+
```
218251

219252
##### Helm:
253+
```yaml
220254
components:
221255
- name: myhelmdeploy
222256
helm:
@@ -234,10 +268,11 @@ Variables that need to be replaced during the deployment can be specified using
234268
variables:
235269
- name: CONTAINER_IMAGE
236270
value: {{myimage}}
237-
271+
```
238272

239273
### Deployment manifest examples
240274
#### Example of Kubernetes deployment manifest:
275+
```yaml
241276
---
242277
kind: Deployment
243278
apiVersion: apps/v1
@@ -290,21 +325,7 @@ Variables that need to be replaced during the deployment can be specified using
290325
port:
291326
targetPort: {{.PORT}}
292327
wildcardPolicy: None
328+
```
293329

294330
This example is using variables for tools to replace some of the info during deployment.
295331

296-
#### Example of Operator deployment manifest:
297-
298-
apiVersion: app.stacks/v1beta1
299-
kind: RuntimeComponent
300-
metadata:
301-
name: {{.COMPONENT_NAME}}
302-
spec:
303-
applicationImage: {{.CONTAINER_IMAGE}}
304-
service:
305-
type: ClusterIP
306-
port: {{.PORT}}
307-
expose: true
308-
storage:
309-
size: 2Gi
310-
mountPath: "/logs"

docs/proposals/registry/sample-vs-stack.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
## Overview
44

5-
The existing devfile registry focuses on the stack support to provide generic language/framework/runtime, e.g. Node, Java maven, Quarkus, etc., support to build and run user applications. These devfiles are called ***stack devfiles***. There is another kind of devfile in a devfile registry that is tailored for a building and running a specific application. These devfiles are referred to as ___*sample devfiles*___ (example: https://github.com/redhat-developer/devfile-sample).
5+
The existing devfile registry focuses on the stack support to provide generic language/framework/runtime, e.g. Node, Java maven, Quarkus, etc., support to build and run user applications. These devfiles are called ***stack devfiles***. There is another kind of devfile in a devfile registry that is tailored for a building and running a specific application. These devfiles are referred to as ***sample devfiles*** (example: https://github.com/redhat-developer/devfile-sample).
66

77
This proposal covers the design to support sample devfiles as a first-class citizen and differentiates between stack vs samples so that the tools can consume them properly. Also, it allows the source of a given stack and samples to be stored under a different repository other than the main source registry repo.
88

99
## Adding samples or stacks to the devfile registry
1010

11-
A file called ___*extraDevfileEntries.yaml*___ is added under the root of the devfile registry source repository to add samples and stacks from other repositories to the registry. This file contains the location information on where the extra samples and stacks can be found during a registry build.
11+
A file called ***extraDevfileEntries.yaml*** is added under the root of the devfile registry source repository to add samples and stacks from other repositories to the registry. This file contains the location information on where the extra samples and stacks can be found during a registry build.
1212

1313
### Sample extraDevfileEntires.yaml:
1414

1515
__Note:___ Proposal #2 will be used
1616

1717
#### Proposal 1 (deferred: will only implement later when needed):
1818
If we assume the devfile in a given sample contains the information on the sample, we can future simplify it by just referring the sample to the location. All the metadata information is extracted directly from the devfile contained in the sample/stack repository.
19-
19+
```yaml
2020
schemaVersion: 1.0.0
2121
samples:
2222
- name: nodejs-basic
@@ -35,13 +35,14 @@ If we assume the devfile in a given sample contains the information on the sampl
3535
git:
3636
remotes:
3737
origin: https://github.com/eystacks/my-maven
38+
```
3839
3940
__Note:__ the location of the sample supports the same configuration as the `starterProjects` definition, i.e. `git` and `zip`. Refer to the definitions of the existing `git` and `zip` elements for supported settings.
4041

4142
#### Proposal 2:
4243

4344
Alternatively, if we assume the devfile contained in the sample folder may refer to the original stack instead of the specific example, we may need to include a way for the user to specify the metadata associated with the sample as part of the sample definition.
44-
45+
```yaml
4546
schemaVersion: 1.0.0
4647
samples:
4748
- name: nodejs-basic
@@ -84,6 +85,7 @@ Alternatively, if we assume the devfile contained in the sample folder may refer
8485
git:
8586
remotes:
8687
origin: https://github.com/elsony/devfile-sample-python-basic.git
88+
```
8789

8890
#### Proposal 3: Include the source of the samples as part of the registry source repository (deferred: will only implement later when needed)
8991
The existing devfile registry source for the stacks have the following structure:
@@ -156,7 +158,7 @@ With the introduction of the samples in the registry, the samples will be stored
156158

157159
## Registry query results
158160
The information on the registry index (index.json) is different between a stack and a sample. The differences are based on how the two will be used.
159-
161+
```json
160162
[
161163
{
162164
"name": "java-maven",
@@ -199,6 +201,7 @@ The information on the registry index (index.json) is different between a stack
199201
}
200202
}
201203
]
204+
```
202205

203206
The differences between a stack entry vs a sample entry in the devfile index registry are:
204207
1. The `type` field

0 commit comments

Comments
 (0)