You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/proposals/devfile/outer-loop-build-and-deploy.md
+39-18
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Existing devfile 2.0 mainly focuses on providing inner-loop support. This propos
7
7
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
8
8
9
9
- Do a full build to build the container image
10
-
- Input\
10
+
- Input:\
11
11
The build may use different technologies for building, e.g. dockerfile, buildpacks
12
12
- Output:\
13
13
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
19
19
20
20
We will cover two main stages:
21
21
1. Build the image
22
-
2.Deployment of the image. Deploy the image to a cluster
22
+
2. Deploy the image to a cluster
23
23
24
24
## Build the image
25
25
@@ -37,6 +37,7 @@ The definition of the image build introduces a new component type `image` for th
37
37
__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.
38
38
39
39
### Example using a file Dockerfile as part of the app:
40
+
```yaml
40
41
variables:
41
42
myimage: myimagename
42
43
components:
@@ -48,6 +49,7 @@ __Alternative approach:__ we can consider reusing the `exec` type except that th
48
49
location: Dockerfile
49
50
args: [ "arg1", "arg2", "arg3" ]
50
51
rootRequired: false
52
+
```
51
53
52
54
`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.
53
55
@@ -63,6 +65,7 @@ __Note:__
63
65
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.
64
66
65
67
### Example using a Dockerfile with registry and secret for the image push:
68
+
```yaml
66
69
variables:
67
70
myimage: myimagename
68
71
components:
@@ -77,18 +80,22 @@ __Note:__
77
80
envFrom:
78
81
- secretRef:
79
82
name: my-secret
83
+
```
80
84
81
85
`secretRef`: The reference to the secret for pushing the image to the registry
82
86
83
87
For the secrets, it should support the same mechanisms as specified in https://github.com/devfile/api/issues/299.
84
88
85
89
### Example using `apply` command on an image component:
90
+
```yaml
86
91
commands:
87
92
- id: deploybuild
88
93
apply:
89
94
component: mydockerfileimage
95
+
```
90
96
91
97
### Example using a Dockerfile stored within the devfile registry as a resource with `apply` command:
98
+
```yaml
92
99
variables:
93
100
myimage: myimagename
94
101
components:
@@ -102,11 +109,13 @@ For the secrets, it should support the same mechanisms as specified in https://g
102
109
- id: deploybuild
103
110
apply:
104
111
component: mydockerfileimage
112
+
```
105
113
106
114
__Note:__
107
115
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.
108
116
109
117
### Example using a Dockerfile stored in a git repo with push registry without apply command:
The git definition will be the same as the one in `starterProjects` definition that supports `checkoutFrom`
124
134
@@ -130,6 +140,7 @@ Notes:
130
140
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
131
141
132
142
### Example using SourceToImage (S2I):
143
+
```yaml
133
144
variables:
134
145
myimage: myimagename
135
146
components:
@@ -146,6 +157,7 @@ Notes:
146
157
- id: deploybuild
147
158
apply:
148
159
component: mys2iimage
160
+
```
149
161
150
162
`builderImageNamespace`: Namespace where builder image is present
151
163
@@ -170,6 +182,7 @@ The current design is to try to reuse the existing `kubernetes` component as muc
170
182
171
183
#### Examples of using `deploy` group command:
172
184
##### Kubernetes deployment manifest:
185
+
```yaml
173
186
components:
174
187
- name: myk8sdeploy
175
188
kubernetes:
@@ -185,12 +198,14 @@ The current design is to try to reuse the existing `kubernetes` component as muc
185
198
attributes:
186
199
- name: CONTAINER_IMAGE
187
200
value: {{myimage}}
201
+
```
188
202
189
203
`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).
190
204
191
205
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.
192
206
193
207
##### Kubernetes deployment manifest (inlined):
208
+
```yaml
194
209
components:
195
210
- name: myk8deploy
196
211
kubernetes:
@@ -215,8 +230,27 @@ Variables that need to be replaced during the deployment can be specified using
215
230
group:
216
231
kind: deploy
217
232
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
+
```
218
251
219
252
##### Helm:
253
+
```yaml
220
254
components:
221
255
- name: myhelmdeploy
222
256
helm:
@@ -234,10 +268,11 @@ Variables that need to be replaced during the deployment can be specified using
234
268
variables:
235
269
- name: CONTAINER_IMAGE
236
270
value: {{myimage}}
237
-
271
+
```
238
272
239
273
### Deployment manifest examples
240
274
#### Example of Kubernetes deployment manifest:
275
+
```yaml
241
276
---
242
277
kind: Deployment
243
278
apiVersion: apps/v1
@@ -290,21 +325,7 @@ Variables that need to be replaced during the deployment can be specified using
290
325
port:
291
326
targetPort: {{.PORT}}
292
327
wildcardPolicy: None
328
+
```
293
329
294
330
This example is using variables for tools to replace some of the info during deployment.
Copy file name to clipboardexpand all lines: docs/proposals/registry/sample-vs-stack.md
+8-5
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,21 @@
2
2
3
3
## Overview
4
4
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).
6
6
7
7
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.
8
8
9
9
## Adding samples or stacks to the devfile registry
10
10
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.
12
12
13
13
### Sample extraDevfileEntires.yaml:
14
14
15
15
__Note:___ Proposal #2 will be used
16
16
17
17
#### Proposal 1 (deferred: will only implement later when needed):
18
18
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
20
20
schemaVersion: 1.0.0
21
21
samples:
22
22
- name: nodejs-basic
@@ -35,13 +35,14 @@ If we assume the devfile in a given sample contains the information on the sampl
__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.
40
41
41
42
#### Proposal 2:
42
43
43
44
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
45
46
schemaVersion: 1.0.0
46
47
samples:
47
48
- name: nodejs-basic
@@ -84,6 +85,7 @@ Alternatively, if we assume the devfile contained in the sample folder may refer
0 commit comments