Skip to content

Commit 053a34a

Browse files
dkwon17deerskindollrohanKanojia
authored
feat: add DWO documentation (#2930) (#2951)
* fixed typo * fixed missing letter * feat: add DWO documentation * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Address PR feedback * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Update modules/administration-guide/pages/devworkspace-operator.adoc * Fix typo and add clarification * Make header larger, move link to snippet file --------- Signed-off-by: dkwon17-test <dakwon@redhat.com> Co-authored-by: deerskindoll <jvrbkova@redhat.com> Co-authored-by: Rohan Kumar <rohan.kumar.kanojia@gmail.com>
1 parent 60b6bc1 commit 053a34a

File tree

4 files changed

+156
-9
lines changed

4 files changed

+156
-9
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
:_content-type: SNIPPET
22

3+
* link:https://github.com/devfile/api[Devfile API repository]
34
* link:https://quay.io/repository/devfile/devworkspace-controller?tab=history[`quay.io/devfile/devworkspace-controller` container image]
45
* link:https://github.com/devfile/devworkspace-operator[{devworkspace} Operator repository]
351 KB
Loading
202 KB
Loading

modules/administration-guide/pages/devworkspace-operator.adoc

Lines changed: 155 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,170 @@
55
:page-aliases: .:devworkspace-operator.adoc
66

77
[id="devworkspace-operator"]
8-
= {devworkspace} operator
8+
= {devworkspace} Operator overview
99

10-
The {devworkspace} operator extends {orch-name} to provide {devworkspace} support. It introduces:
1110

12-
{devworkspace} custom resource definition::
11+
The {devworkspace} Operator (DWO) is a dependency of {prod-short}, and is an integral part of how {prod-short} functions. One of DWO's main responsibilities is to reconcile {devworkspace} custom resources (CR).
1312

14-
Defines the {devworkspace} {orch-name} object from the Devfile v2 specification.
13+
The {devworkspace} CR is a {orch-name} resource representation of a {prod-short} workspace. Whenever a user creates a workspace using {prod-short} in the background, Dashboard {prod-short} creates a {devworkspace} CR in the cluster. For every {prod-short} workspace, there is an underlying {devworkspace} CR on the cluster.
1514

16-
{devworkspace} controller::
15+
Figure 1 shows an example of a {devworkspace} CR in a cluster:
1716

18-
Creates and controls the necessary {orch-name} objects to run a {devworkspace}, such as pods, services, and persistent volumes.
17+
.Example of a {devworkspace} CR in a cluster
18+
image::devworkspace-operator/devworkspace-cr-example.png[DevWorkspace CR example,width=624,height=465]
1919

20-
{devworkspace} custom resource::
20+
When creating a workspace with {prod-short} with a devfile, the {devworkspace} CR contains the devfile details. Additionally, {prod-short} adds the editor definition into the {devworkspace} CR depending on which editor was chosen for the workspace. {prod-short} will also add attributes to the {devworkspace} which further configures the workspace depending on how you configured the `CheCluster` CR.
2121

22-
On a cluster with the {devworkspace} operator, it is possible to create {devworkspace} custom resources (CR). A {devworkspace} CR is a {orch-name} representation of a Devfile. It defines a User workspaces in a {orch-name} cluster.
22+
A `DevWorkspaceTemplate` is a custom resource that defines a reusable `spec.template` for {devworkspace}s.
2323

24+
When a workspace is started, DWO reads the corresponding {devworkspace} CR and creates the necessary resources such as deployments, secrets, configmaps, routes such that at the end a workspace pod representing the development environment defined in the devfile is created.
25+
26+
.Custom Resources overview
27+
28+
The following Custom Resource Definitions are provided by the {devworkspace} Operator:
29+
30+
* `{devworkspace}`
31+
* `DevWorkspaceTemplate`
32+
* `DevWorkspaceOperatorConfig`
33+
* `DevWorkspaceRouting`
34+
35+
36+
.{devworkspace}
37+
38+
The {devworkspace} custom resource contains details about an {prod-short} workspace. Notably, it contains devfile details and a reference to the editor definition.
39+
40+
.DevWorkspaceTemplate
41+
42+
In {prod-short} the `DevWorkspaceTemplate` custom resource is typically used to define an editor (such as Visual Studio Code - Open Source) for {prod-short} workspaces. You can use this custom resource to define reusable `spec.template` content that is reused by multiple {devworkspace}s.
43+
44+
.DevWorkspaceOperatorConfig
45+
46+
The `DevWorkspaceOperatorConfig` (DWOC) custom resource defines configuration options for the DWO. There are two different types of DWOC:
47+
48+
* global configuration
49+
* non-global configuration
50+
51+
The global configuration is a DWOC custom resource named `devworkspace-operator-config` and is usually located in the DWO installation namespace. By default, the global configuration is not created upon installation. Configuration fields set in the global configuration will apply to the DWO and all {devworkspace}s. However, the DWOC configuration can be overridden by a non-global configuration.
52+
53+
Any other DWOC custom resource than `devworkspace-operator-config` is considered to be non-global configuration. A non-global configuration does not apply to any {devworkspace}s unless the {devworkspace} contains a reference to the DWOC. If the global configuration and non-global configuration have the same fields, the non-global configuration field takes precedence.
54+
55+
.Global DWOC and {prod-short}-owned DWOC comparison
56+
[cols="1,1,1",options="header"]
57+
|===
58+
| |Global DWOC |{prod-short}-owned DWOC
59+
|Resource name |`devworkspace-operator-config` |`devworkspace-config`
60+
|Namespace |DWO installation namespace |{prod-short} installation namespace
61+
|Default creation |Not created by default upon DWO installation |Created by default on {prod-short} installation
62+
|Scope |Applies to the DWO itself and all {devworkspace}s managed by DWO |Applies to {devworkspace}s created by {prod-short}
63+
|Precedence |Overridden by fields set in {prod-short}-owned config |Takes precedence over global config if both define the same field
64+
|Primary use case |Used to define default, broad settings that apply to DWO in general. |Used to define specific configuration for {devworkspace}s created by {prod-short}
65+
|===
66+
67+
For example, by default {prod-short} creates and manages a non-global DWOC in the {prod-short} namespace named `devworkspace-config`. This DWOC contains configuration specific to {prod-short} workspaces, and is maintained by {prod-short} depending on how you configure the CheCluster CR. When {prod-short} creates a workspace, {prod-short} adds a reference to the {prod-short}-owned DWOC with the `controller.devfile.io/devworkspace-config` attribute.
68+
69+
.Example of {devworkspace} configuration attribute
70+
image::devworkspace-operator/devworkspace-config-attribute.png[DevWorkspace config attribute example,width=624,height=280]
71+
72+
.DevWorkspaceRouting
73+
74+
The `DevWorkspaceRouting` custom resource defines details about the endpoints of a {devworkspace}. Every {devworkspace} has its corresponding `DevWorkspaceRouting` object that specifies the workspace's container endpoints. Endpoints defined from the devfile, as well as endpoints defined by the editor definition will appear in the `DevWorkspaceRouting` custom resource.
75+
76+
[source,yaml]
77+
----
78+
apiVersion: controller.devfile.io/v1alpha1
79+
kind: DevWorkspaceRouting
80+
metadata:
81+
annotations:
82+
controller.devfile.io/devworkspace-started: 'false'
83+
name: routing-workspaceb14aa33254674065
84+
labels:
85+
controller.devfile.io/devworkspace_id: workspaceb14aa33254674065
86+
spec:
87+
devworkspaceId: workspaceb14aa33254674065
88+
endpoints:
89+
universal-developer-image:
90+
- attributes:
91+
cookiesAuthEnabled: true
92+
discoverable: false
93+
type: main
94+
urlRewriteSupported: true
95+
exposure: public
96+
name: che-code
97+
protocol: https
98+
secure: true
99+
targetPort: 3100
100+
podSelector:
101+
controller.devfile.io/devworkspace_id: workspaceb14aa33254674065
102+
routingClass: che
103+
status:
104+
exposedEndpoints:
105+
...
106+
----
107+
108+
== {devworkspace} Operator's operands
109+
110+
The {devworkspace} Operator has two operands:
111+
112+
* controller deployment
113+
* webhook deployment.
114+
115+
[source,terminal]
116+
----
117+
$ oc get pods -l 'app.kubernetes.io/part-of=devworkspace-operator' -o custom-columns=NAME:.metadata.name -n openshift-operators
118+
NAME
119+
devworkspace-controller-manager-66c6f674f5-l7rhj <1>
120+
devworkspace-webhook-server-d4958d9cd-gh7vr <2>
121+
devworkspace-webhook-server-d4958d9cd-rfvj6 <2>
122+
----
123+
124+
<1> The {devworkspace} controller pod, which is responsible for reconciling custom resources
125+
<2> The {devworkspace} operator webhook server pods
126+
127+
.Configuring the {devworkspace}-controller-manager deployment
128+
129+
You can configure the `devworkspace-controller-manager` pod in the {devworkspace} Operator Subscription object:
130+
131+
[source,yaml]
132+
----
133+
apiVersion: operators.coreos.com/v1alpha1
134+
kind: Subscription
135+
metadata:
136+
name: devworkspace-operator
137+
namespace: openshift-operators
138+
spec:
139+
config:
140+
affinity:
141+
nodeAffinity: ...
142+
podAffinity: ...
143+
resources:
144+
limits:
145+
memory: ...
146+
cpu: ...
147+
requests:
148+
memory: ...
149+
cpu: ...
150+
----
151+
152+
Learn more about configuration in this link:https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/design/subscription-config.md[documentation].
153+
154+
.Configuring the {devworkspace}-webhook-server deployment
155+
156+
You can configure the `devworkspace-webhook-server` deployment in the global DWOC:
157+
158+
[source,yaml]
159+
----
160+
apiVersion: controller.devfile.io/v1alpha1
161+
kind: DevWorkspaceOperatorConfig
162+
metadata:
163+
name: devworkspace-operator-config
164+
namespace: <DWO install namespace>
165+
config:
166+
webhooks:
167+
nodeSelector: <map[string]string>
168+
replicas: <int>
169+
tolerations: <[]corev1.Toleration>
170+
----
24171

25172
.Additional resources
26173

27-
* link:https://github.com/devfile/api[Devfile API repository]
28174
include::example$snip_{project-context}-devworkspace-additional-resources.adoc[]

0 commit comments

Comments
 (0)