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
* modified docs to adhere to schema
more content changes to align with schema
more source.yaml changes to align with schema
more changes to yamls
tweaks to yamls. more changes to come
major change to adding kubernetes doc. changed yaml for event bindings doc
more content and yaml changes
minor tweaks and adjusted tab spacing in yaml
addressed doc review comments
more language review
fixed capitalization error
* Update docs/modules/user-guide/partials/proc_defining-endpoints.adoc
Co-authored-by: Robert Krátký <[email protected]>
* Update docs/modules/user-guide/partials/proc_adding-plugin-component-to-a-devfile.adoc
Co-authored-by: Robert Krátký <[email protected]>
Co-authored-by: Robert Krátký <[email protected]>
* Any component on which commands are executed must define a `name` attribute. This name is used to reference the component in the command definition. Example: `name: go-cli` in the component definition and `component: go-cli` in the command definition.
73
-
74
71
* A command can have only one action, though you can use `composite` commands to execute several commands either sequentially or in parallel.
75
72
76
-
. Define attributes for the `vscode-task` or `vscode-launch` command to run using the Editor.
77
-
+
78
-
If the editor in the workspace supports it, the devfile can specify additional configuration in the editor-specific format. This is dependent on the integration code present in the workspace editor itself and so is not a generic mechanism.
This example shows association of a `tasks.json` file with a devfile. Notice the `vscode-task` type that instructs the editor to interpret this command as a tasks definition and `referenceContent` attribute that contains the contents of the file itself. You can also save this file separately from the devfile and use `reference` attribute to specify a relative or absolute URL to it.
109
-
110
73
. Command group
111
74
+
112
75
A given command can be assigned to one or more groups that represents the nature of the command. The support groups are: `build`, `run`, `test` and `debug`. For each of the groups, one default command can be defined in each group by specifying the `isDefault` value.
@@ -115,7 +78,7 @@ A given command can be assigned to one or more groups that represents the nature
It is possible to specify a preview URL for commands that expose web UI. This URL is offered for opening when the command is executed.
193
-
+
194
-
[source,yaml]
195
-
----
196
-
commands:
197
-
- id: tasks
198
-
exec:
199
-
previewUrl:
200
-
port: 8080 <1>
201
-
path: /myweb <2>
202
-
component: go-cli
203
-
commandLine: "go run webserver.go"
204
-
workingDir: ${PROJECTS_ROOT}/webserver
205
-
----
206
-
<1> TCP port where the application listens. Mandatory parameter.
207
-
<2> The path part of the URL to the UI. Optional parameter. The default is root (`/`).
208
-
209
-
The example above opens `++http://__<server-domain>__/myweb++`, where `_<server-domain>_` is the URL to the dynamically created Kubernetes Ingress or OpenShift Route.
= Adding a `kubernetes` or `openshift` component to a devfile
3
3
4
4
[role="_abstract"]
5
-
This section describes how to add a `kubernetes` component to a devfile. A complex component type that allows to apply configuration from a list of Kubernetes or OpenShift components.
5
+
This section describes how to add either a `kubernetes` or `openshfit` component to a devfile. You can apply configurations to your devfile with `kubernetes` or `openshift` components.
6
6
7
7
.Prerequisites
8
8
@@ -12,116 +12,45 @@ This section describes how to add a `kubernetes` component to a devfile. A compl
12
12
13
13
.Procedure
14
14
15
-
. Define a component using the type `kubernetes`.
15
+
. Define a component using the type `kubernetes` or `openshift`.
16
16
17
-
. The content can be provided through the `reference` attribute, which points to the file with the component content.
17
+
. Provide the content through the `uri` or `inlined` property.
18
18
+
19
-
.Adding `kubernetes` component using the `reference` attribute
19
+
.Adding `openshift` component using the `uri` property
20
20
====
21
21
[source,yaml]
22
22
----
23
23
components:
24
24
- name: mysql
25
-
kubernetes:
26
-
reference: petclinic.yaml
27
-
selector:
28
-
app.kubernetes.io/name: mysql
29
-
app.kubernetes.io/component: database
30
-
app.kubernetes.io/part-of: petclinic
25
+
openshift:
26
+
uri: petclinic.yaml
31
27
----
32
28
====
33
-
34
-
. Alternatively, to post a devfile with such components to REST API, the contents of the Kubernetes or OpenShift list can be embedded into the devfile using the `referenceContent` field:
35
-
+
36
-
.Adding `kubernetes` component using the `referenceContent` attribute
37
-
====
38
-
[source,yaml]
39
-
----
40
-
components:
41
-
- name: mysql
42
-
kubernetes:
43
-
reference: petclinic.yaml
44
-
referenceContent: |
45
-
kind: List
46
-
items:
47
-
-
48
-
apiVersion: v1
49
-
kind: Pod
50
-
metadata:
51
-
name: ws
52
-
spec:
53
-
containers:
54
-
... etc
55
-
----
56
-
====
57
-
58
-
. Overriding container entrypoints. As with the xref:component-type-container{context}[`container` component], it is possible to override the entrypoint of the containers contained in the Kubernetes or OpenShift list using the `command` and `args` properties (as link:https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#notes[understood] by Kubernetes).
59
29
+
60
-
There can be more containers in the list (contained in Pods or Pod templates of deployments). It is therefore necessary to select which containers to apply the entrypoint changes to as follows:
61
-
+
62
-
.Overriding container entrypoints
30
+
.Adding a `kubernetes` component using the `inlined` property
63
31
====
64
32
[source,yaml]
65
33
----
66
34
components:
67
-
- name: appDeployment
68
-
kubernetes:
69
-
reference: app-deployment.yaml
70
-
entrypoints:
71
-
- parentName: mysqlServer
72
-
command: ['sleep']
73
-
args: ['infinity']
74
-
- parentSelector:
75
-
app: prometheus
76
-
args: ['-f', '/opt/app/prometheus-config.yaml']
35
+
- name: myk8deploy
36
+
kubernetes:
37
+
inlined: |
38
+
apiVersion: batch/v1
39
+
kind: Job
40
+
metadata:
41
+
name: pi
42
+
spec:
43
+
template:
44
+
spec:
45
+
containers:
46
+
- name: job
47
+
image: myimage
48
+
command: ["some", "command"]
49
+
restartPolicy: Never
77
50
----
78
51
====
79
52
+
80
-
The `entrypoints` list contains constraints for picking the containers along with the `command` and `args` parameters to apply to them. In the example above, the constraint is `parentName: mysqlServer`, which will cause the command to be applied to all containers defined in any parent object called `mysqlServer`. The parent object is assumed to be a top level object in the list defined in the referenced file, which is `app-deployment.yaml` in the example above.
81
-
+
82
-
Other types of constraints (and their combinations) are possible:
83
-
+
84
-
`containerName`:: the name of the container
85
-
`parentName`:: the name of the parent object that (indirectly) contains the containers to override
86
-
`parentSelector`:: the set of labels the parent object needs to have
87
-
+
88
-
A combination of these constraints can be used to precisely locate the containers inside the referenced Kubernetes list.
53
+
. Specify the endpoint through the endpoint property with `kubernetes` or `openshift` components.
89
54
90
-
. Overriding container environment variables
91
-
+
92
-
To provision or override entrypoints in a Kubernetes or OpensShift component, configure it in the following way:
93
-
+
94
-
.Overriding container environment variables
95
-
====
96
-
[source,yaml]
97
-
----
98
-
components:
99
-
- name: appDeployment
100
-
kubernetes:
101
-
reference: app-deployment.yaml
102
-
env:
103
-
- name: ENV_VAR
104
-
value: value
105
-
----
106
-
====
107
-
+
108
-
This is useful for temporary content or without access to editing the referenced content. The specified environment variables are provisioned into each init container and containers inside all Pods and Deployments.
109
-
110
-
. Specifying mount-source option
111
-
+
112
-
To specify a project sources directory mount into container(s), use the `mountSources` parameter:
113
-
+
114
-
.Specifying mount-source option
115
-
====
116
-
[source,yaml]
117
-
----
118
-
components:
119
-
- name: appDeployment
120
-
kubernetes:
121
-
reference: app-deployment.yaml
122
-
mountSources: true
123
-
----
124
-
====
55
+
. Associate `kubernetes` or `openshift` components with `Apply` commands. If you do not associate `Apply` commands, they are assumed to be applied at start up.
125
56
+
126
-
If enabled, project sources mounts will be applied to every container of the given component.
127
-
This parameter is also applicable for `plugin` type components.
0 commit comments