Skip to content

Commit efab2bb

Browse files
committed
Clean up and update README.md
Update README.md to have consistent headings, and remove outdated information from sections. Add a section referencing the DevWorkspaceOperatorConfig object. Signed-off-by: Angel Misevski <[email protected]>
1 parent b262f28 commit efab2bb

File tree

2 files changed

+76
-27
lines changed

2 files changed

+76
-27
lines changed

README.md

Lines changed: 75 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,43 @@
44

55
Dev Workspace operator repository that contains the controller for the DevWorkspace Custom Resource. The Kubernetes API of the DevWorkspace is defined in the https://github.com/devfile/api repository.
66

7-
## DevWorkspace CR
7+
## Configuration
8+
9+
### Global configuration for the DevWorkspace Operator
10+
11+
The DevWorkspace Operator installs the DevWorkspaceOperatorConfig custom resource (short name: `dwoc`). To configure global behavior of the DevWorkspace Operator, create a DevWorkspaceOperatorConfig named `devworkspace-operator-config` in the same namespace where the operator is deployed:
12+
```yaml
13+
apiVersion: controller.devfile.io/v1alpha1
14+
kind: DevWorkspaceOperatorConfig
15+
metadata:
16+
name: devworkspace-operator-config
17+
namespace: $OPERATOR_INSTALL_NAMESPACE
18+
config:
19+
# Configuration fields
20+
```
21+
22+
To apply a configuration to specific workspaces instead of globally, an existing DevWorkspaceOperatorConfig can be referenced in a DevWorkspace's attributes:
23+
```yaml
24+
apiVersion: workspace.devfile.io/v1alpha2
25+
kind: DevWorkspace
26+
metadata:
27+
name: my-devworkspace
28+
spec:
29+
template:
30+
attributes:
31+
controller.devfile.io/devworkspace-config:
32+
name: <name of DevWorkspaceOperatorConfig CR>
33+
namespace: <namespace of DevWorkspaceOperatorConfig CR>
34+
```
35+
Configuration specified as above will be merged into the default global configuration, overriding any values present.
36+
37+
To see all all configuration options, see `kubectl explain dwoc.config`, `kubectl explain dwoc.config.workspace`, etc.
838

939
### Additional configuration
1040

11-
DevWorkspaces can be configured through DevWorkspace attributes and Kubernetes labels/annotations. For a list of all options available, see [additional documentation](docs/additional-configuration.adoc).
41+
DevWorkspaces can be further configured through DevWorkspace attributes and Kubernetes labels/annotations. For a list of all options available, see [additional documentation](docs/additional-configuration.adoc).
1242

13-
#### Restricted Access
43+
### Restricted Access
1444

1545
The `controller.devfile.io/restricted-access` annotation specifies that a DevWorkspace needs additional access control (in addition to RBAC). When a DevWorkspace is created with the `controller.devfile.io/restricted-access` annotation set to `true`, the webhook server will guarantee
1646
- Only the DevWorkspace Operator ServiceAccount or DevWorkspace creator can modify important fields in the DevWorkspace
@@ -24,24 +54,25 @@ metadata:
2454
annotations:
2555
controller.devfile.io/restricted-access: true
2656
```
27-
## Prerequisites
57+
58+
## Deploying DevWorkspace Operator
59+
60+
### Prerequisites
2861
- go 1.16 or later
2962
- git
3063
- sed
3164
- jq
3265
- yq (python-yq from https://github.com/kislyuk/yq#installation, other distributions may not work)
3366
- skopeo (if building the OLM catalogsource)
34-
- docker
67+
- podman or docker
3568

3669
Note: kustomize `v4.0.5` is required for most tasks. It is downloaded automatically to the `.kustomize` folder in this repo when required. This downloaded version is used regardless of whether or not kustomize is already installed on the system.
3770

38-
## Running the controller in a cluster
71+
### Running the controller in a cluster
3972

40-
### With yaml resources
73+
#### With yaml resources
4174

42-
When deployed to Kubernetes, the controller requires [cert-manager](https://cert-manager.io) running in the cluster.
43-
You can install it using `make install_cert_manager` if you don't run it already.
44-
The minimum version of cert-manager is `v1.0.4`.
75+
When installing on Kubernetes clusters, the DevWorkspace Operator requires the [cert-manager](https://cert-manager.io) operator in order to properly serve webhooks. To install the latest version of cert-manager in a cluster, the Makefile rule `install_cert_manager` can be used. The minimum version of cert-manager is `v1.0.4`.
4576

4677
The controller can be deployed to a cluster provided you are logged in with cluster-admin credentials:
4778

@@ -62,17 +93,34 @@ See below for all environment variables used in the makefile.
6293
> }
6394
> ```
6495

65-
### With OLM
96+
#### With Operator Lifecycle Manager (OLM)
6697

67-
DevWorkspace Operator has bundle and index images which allow to install it with OLM.
68-
You need to register custom catalog source to make it available on your cluster with help:
69-
```
70-
DWO_INDEX_IMG=quay.io/devfile/devworkspace-operator-index:next
71-
make register_catalogsource
98+
DevWorkspace Operator has bundle and index images which enable installation via OLM. To enable installing the DevWorkspace Operator through OLM, it may be necessary to create a CatalogSource in the cluster for this index:
99+
```yaml
100+
apiVersion: operators.coreos.com/v1alpha1
101+
kind: CatalogSource
102+
metadata:
103+
name: devworkspace-operator-catalog
104+
namespace: openshift-marketplace # Namespace for catalogsource, not operator itself
105+
spec:
106+
sourceType: grpc
107+
image: quay.io/devfile/devworkspace-operator-index:next
108+
publisher: Red Hat
109+
displayName: DevWorkspace Operator Catalog
110+
updateStrategy:
111+
registryPoll:
112+
interval: 5m
72113
```
73-
After OLM finishes processing the created catalog source, DWO should appear on Operators page of OpenShift Console.
74114

75-
In order to build a custom bundle, the following env vars should be set:
115+
Two index images are available for installing the DevWorkspace Operator:
116+
* `quay.io/devfile/devworkspace-operator-index:release` - multi-version catalog with all DevWorkspace Operator releases
117+
* `quay.io/devfile/devworkspace-operator-index:next` - single-version catalog that will deploy the latest commit in the `main` branch
118+
119+
Both index images allow automatic updates (to either the latest release or latest commit in main).
120+
121+
After OLM finishes processing the created CatalogSource, DWO should appear on the Operators page in the OpenShift Console.
122+
123+
In order to build a custom bundle, the following environment variables should be set:
76124
| variable | purpose | default value |
77125
|---|---|---|
78126
| `DWO_BUNDLE_IMG` | Image used for Operator bundle image | `quay.io/devfile/devworkspace-operator-bundle:next` |
@@ -121,18 +169,24 @@ To see all rules supported by the makefile, run `make help`
121169
```bash
122170
export NAMESPACE="devworkspace-controller"
123171
make install
172+
# Wait for webhook server to start
173+
kubectl rollout status deployment devworkspace-controller-manager -n $NAMESPACE --timeout 90s
174+
kubectl rollout status deployment devworkspace-webhook-server -n $NAMESPACE --timeout 90s
175+
# Scale on-cluster deployment to zero to avoid conflict with locally-running instance
124176
oc patch deployment/devworkspace-controller-manager --patch "{\"spec\":{\"replicas\":0}}" -n $NAMESPACE
125177
make run
126178
```
127179

128-
When running locally, only a single namespace is watched; as a result, all devworkspaces have to be deployed to `${NAMESPACE}`
129-
130180
### Run controller locally and debug
131181
Debugging the controller depends on [delve](https://github.com/go-delve/delve) being installed (`go install github.com/go-delve/delve/cmd/dlv@latest`). Note that `$GOPATH/bin` or `$GOBIN` must be added to `$PATH` in order for `make debug` to run correctly.
132182

133183
```bash
134184
make install
185+
# Wait for webhook server to start
186+
kubectl rollout status deployment devworkspace-controller-manager -n $NAMESPACE --timeout 90s
187+
kubectl rollout status deployment devworkspace-webhook-server -n $NAMESPACE --timeout 90s
135188
oc patch deployment/devworkspace-controller-manager --patch "{\"spec\":{\"replicas\":0}}"
189+
# Scale on-cluster deployment to zero to avoid conflict with locally-running instance
136190
make debug
137191
```
138192

@@ -177,7 +231,7 @@ make uninstall
177231
```
178232
This will delete all custom resource definitions created for the controller, as well as the `devworkspace-controller` namespace.
179233

180-
### CI
234+
## CI
181235

182236
#### GitHub actions
183237

build/make/olm.mk

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ build_bundle_and_index: _print_vars _check_skopeo_installed _check_opm_version
5050

5151
### register_catalogsource: create the catalogsource to make the operator be available on the marketplace
5252
register_catalogsource: _check_skopeo_installed
53-
INDEX_DIGEST=$$(skopeo inspect docker://$(DWO_INDEX_IMG) | jq -r '.Digest')
54-
INDEX_IMG=$(DWO_INDEX_IMG)
55-
INDEX_IMG_DIGEST="$${INDEX_IMG%:*}@$${INDEX_DIGEST}"
56-
57-
# replace references of catalogsource img with your image
58-
sed -e "s|quay.io/devfile/devworkspace-operator-index:next|$${INDEX_IMG_DIGEST}|g" ./catalog-source.yaml \
53+
sed -e "s|quay.io/devfile/devworkspace-operator-index:next|$(DWO_INDEX_IMG)|g" ./catalog-source.yaml \
5954
| oc apply -f -
6055

6156
### unregister_catalogsource: unregister the catalogsource and delete the imageContentSourcePolicy

0 commit comments

Comments
 (0)