Skip to content

Commit e6462d0

Browse files
committed
chore : add a devfile for using project from Cloud Develpment Environments
Signed-off-by: Rohan Kumar <rohaan@redhat.com>
1 parent 2022108 commit e6462d0

6 files changed

Lines changed: 147 additions & 9 deletions

File tree

.devfile.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
schemaVersion: 2.2.0
2+
metadata:
3+
name: web-terminal-operator
4+
components:
5+
- name: tools
6+
container:
7+
image: quay.io/wto/web-terminal-operator-devtools:latest
8+
memoryRequest: 1Gi
9+
memoryLimit: 16Gi
10+
cpuLimit: '4'
11+
cpuRequest: '0.5'
12+
env:
13+
- name: DOCKER
14+
value: podman
15+
commands:
16+
- id: build-and-push-controller
17+
exec:
18+
label: "1. Build and push WTO controller image"
19+
component: tools
20+
commandLine: |
21+
read -p "ENTER a container registry org to push the web-terminal-operator images (e.g. quay.io/janedoe): " WTO_IMG_REPO &&
22+
read -p "ENTER the tag for the image (e.g. dev): " WTO_IMG_TAG &&
23+
export WTO_IMG=${WTO_IMG_REPO}/web-terminal-operator:${WTO_IMG_TAG} &&
24+
export BUNDLE_IMG=${WTO_IMG_REPO}/web-terminal-operator-metadata:${WTO_IMG_TAG} &&
25+
export INDEX_IMG=${WTO_IMG_REPO}/web-terminal-operator-index:${WTO_IMG_TAG} &&
26+
make build
27+
group:
28+
kind: build
29+
- id: install-operator
30+
exec:
31+
label: "2. Register CatalogSource and install the operator"
32+
component: tools
33+
commandLine: |
34+
read -p "ENTER a container registry org to use the web-terminal-operator images (e.g. quay.io/janedoe): " WTO_IMG_REPO &&
35+
read -p "ENTER the tag for the image (e.g. dev): " WTO_IMG_TAG &&
36+
export WTO_IMG=${WTO_IMG_REPO}/web-terminal-operator:${WTO_IMG_TAG} &&
37+
export BUNDLE_IMG=${WTO_IMG_REPO}/web-terminal-operator-metadata:${WTO_IMG_TAG} &&
38+
export INDEX_IMG=${WTO_IMG_REPO}/web-terminal-operator-index:${WTO_IMG_TAG} &&
39+
make install
40+
group:
41+
kind: run
42+
43+
- id: register-catalogsource
44+
exec:
45+
label: "3. Register CatalogSource only"
46+
component: tools
47+
commandLine: |
48+
read -p "ENTER a container registry org to push the web-terminal-operator images (e.g. quay.io/janedoe): " WTO_IMG_REPO &&
49+
read -p "ENTER the tag for the image (e.g. dev): " WTO_IMG_TAG &&
50+
export WTO_IMG=${WTO_IMG_REPO}/web-terminal-operator:${WTO_IMG_TAG} &&
51+
export BUNDLE_IMG=${WTO_IMG_REPO}/web-terminal-operator-metadata:${WTO_IMG_TAG} &&
52+
export INDEX_IMG=${WTO_IMG_REPO}/web-terminal-operator-index:${WTO_IMG_TAG} &&
53+
make register_catalogsource
54+
group:
55+
kind: run
56+
57+
- id: unregister-catalogsource
58+
exec:
59+
label: "4. Unregister CatalogSource"
60+
component: tools
61+
commandLine: make unregister_catalogsource
62+
group:
63+
kind: run
64+
65+
- id: uninstall-operator
66+
exec:
67+
label: "5. Uninstall the Web Terminal Operator"
68+
component: tools
69+
commandLine: make uninstall
70+
group:
71+
kind: run
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Devtools container build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
env:
8+
PUSH_REGISTRY: quay.io
9+
PUSH_USERNAME: wto
10+
11+
12+
jobs:
13+
14+
build-devtools-img:
15+
16+
runs-on: ubuntu-24.04
17+
18+
outputs:
19+
git-sha: ${{ steps.git-sha.outputs.sha }}
20+
21+
steps:
22+
- name: Checkout devworkspace-operator source code
23+
uses: actions/checkout@v4
24+
25+
- name: Set output for Git short SHA
26+
id: git-sha
27+
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
28+
29+
- name: Login to quay.io
30+
uses: docker/login-action@v3
31+
with:
32+
username: ${{ env.PUSH_USERNAME }}
33+
password: ${{ secrets.PUSH_PASSWORD }}
34+
registry: ${{ env.PUSH_REGISTRY }}
35+
36+
- name: Set up QEMU
37+
uses: docker/setup-qemu-action@v3
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v3
41+
42+
- name: Build and push devworkspace-devtools image
43+
uses: docker/build-push-action@v6
44+
with:
45+
context: .
46+
push: true
47+
tags: |
48+
${{ env.PUSH_REGISTRY }}/${{ env.PUSH_USERNAME }}/web-terminal-operator-devtools:latest
49+
${{ env.PUSH_REGISTRY }}/${{ env.PUSH_USERNAME }}/web-terminal-operator-devtools:sha-${{ steps.git-sha.outputs.sha }}
50+
file: ./build/dockerfiles/devtools.Dockerfile

Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,19 @@ uninstall:
100100
# 1. Ensure that all DevWorkspace Custom Resources are removed to avoid issues with finalizers
101101
# make sure depending objects are clean up as well
102102
kubectl delete devworkspaces.workspace.devfile.io --all-namespaces --all --wait
103-
kubectl delete workspaceroutings.controller.devfile.io --all-namespaces --all --wait
104-
kubectl delete components.controller.devfile.io --all-namespaces --all --wait
103+
kubectl delete devworkspaceroutings.controller.devfile.io --all-namespaces --all --wait
105104
# 2. Uninstall the Operator
106105
kubectl delete subscriptions.operators.coreos.com web-terminal -n openshift-operators --ignore-not-found
107106
$(eval WTO_CSV := $(shell kubectl get csv -o=json | jq -r '[.items[] | select (.metadata.name | contains("web-terminal.v1"))][0].metadata.name'))
108107
kubectl delete csv ${WTO_CSV} -n openshift-operators
109108
# 3. Remove CRDs
110-
kubectl delete customresourcedefinitions.apiextensions.k8s.io workspaceroutings.controller.devfile.io
111-
kubectl delete customresourcedefinitions.apiextensions.k8s.io components.controller.devfile.io
109+
kubectl delete customresourcedefinitions.apiextensions.k8s.io devworkspaceroutings.controller.devfile.io
112110
kubectl delete customresourcedefinitions.apiextensions.k8s.io devworkspaces.workspace.devfile.io
113111
# 4. Remove DevWorkspace Webhook Server Deployment itself
114112
kubectl delete deployment/devworkspace-webhook-server -n openshift-operators
115113
# 5. Remove lingering service, secrets, and configmaps
116114
kubectl delete all --selector app.kubernetes.io/part-of=devworkspace-operator,app.kubernetes.io/name=devworkspace-webhook-server
117115
kubectl delete serviceaccounts devworkspace-webhook-server -n openshift-operators
118-
kubectl delete configmap devworkspace-controller -n openshift-operators
119116
kubectl delete clusterrole devworkspace-webhook-server
120117
kubectl delete clusterrolebinding devworkspace-webhook-server
121118
# 6. Remove mutating/validating webhooks configuration

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ This repo includes a `Makefile` to simplify deploying the Operator to a cluster:
3636
| `make register_catalogsource` | Register the CatalogSource but do not install the operator. This enables the operator to be installed manually through OperatorHub. |
3737
| `make unregister_catalogsource` | Remove the CatalogSource from the cluster. |
3838
| `make uninstall` | uninstalls the Web Terminal Operator Subscription and related ClusterServiceVersion |
39-
| `make uninstall_v1_2` | Remove the installed WTO 1.2 from the cluster |
4039

4140
The commands above require being logged in to the cluster as a `cluster-admin`. See `make help` for a full list of supported environment variables and rules available.
4241

@@ -78,4 +77,4 @@ Execute
7877
| source | destination | sync job |
7978
| --- | --- | --- |
8079
| [devworkspace-controller](https://github.com/devfile/devworkspace-operator/) | [web-terminal](http://pkgs.devel.redhat.com/cgit/containers/web-terminal) | [Jenkins job](https://codeready-workspaces-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/web-terminal-sync-web-terminal-operator/) |
81-
| [web-terminal-operator](https://github.com/redhat-developer/web-terminal-operator) | [web-terminal-dev-operator-metadata](http://pkgs.devel.redhat.com/cgit/containers/web-terminal-dev-operator-metadata) | [Jenkins job](https://codeready-workspaces-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/web-terminal-sync-web-terminal-operator-metadata/)
80+
| [web-terminal-operator](https://github.com/redhat-developer/web-terminal-operator) | [web-terminal-dev-operator-metadata](http://pkgs.devel.redhat.com/cgit/containers/web-terminal-dev-operator-metadata) | [Jenkins job](https://codeready-workspaces-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/web-terminal-sync-web-terminal-operator-metadata/)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM quay.io/devfile/universal-developer-image:latest
2+
3+
USER root
4+
5+
# Install gettext
6+
RUN dnf install -y gettext
7+
8+
# Install the Operator SDK
9+
ENV OPERATOR_SDK_VERSION="v0.17.2"
10+
ENV OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}
11+
RUN curl -sSLO ${OPERATOR_SDK_DL_URL}/operator-sdk_linux_amd64 && \
12+
chmod +x operator-sdk_linux_amd64 && \
13+
mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk
14+
15+
# Install opm CLI
16+
ENV OPM_VERSION="v1.13.1"
17+
RUN curl -sSLO https://github.com/operator-framework/operator-registry/releases/download/${OPM_VERSION}/linux-amd64-opm && \
18+
chmod +x linux-amd64-opm && \
19+
mv linux-amd64-opm /usr/local/bin/opm
20+
21+
USER 1001

docs/uninstall.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Manual steps are required to uninstall the Web Terminal Operator in order to avo
88

99
```
1010
kubectl delete devworkspaces.workspace.devfile.io --all-namespaces --all --wait
11-
kubectl delete workspaceroutings.controller.devfile.io --all-namespaces --all --wait
11+
kubectl delete devworkspaceroutings.controller.devfile.io --all-namespaces --all --wait
1212
kubectl delete components.controller.devfile.io --all-namespaces --all --wait
1313
```
1414
Note: This step must be done first, as otherwise the resources above may have finalizers that block automatic cleanup.
@@ -18,7 +18,7 @@ Manual steps are required to uninstall the Web Terminal Operator in order to avo
1818
3. Remove the custom resource definitions installed by the operator
1919

2020
```
21-
kubectl delete customresourcedefinitions.apiextensions.k8s.io workspaceroutings.controller.devfile.io
21+
kubectl delete customresourcedefinitions.apiextensions.k8s.io devworkspaceroutings.controller.devfile.io
2222
kubectl delete customresourcedefinitions.apiextensions.k8s.io components.controller.devfile.io
2323
kubectl delete customresourcedefinitions.apiextensions.k8s.io devworkspaces.workspace.devfile.io
2424
```

0 commit comments

Comments
 (0)