Skip to content

Commit 01f500d

Browse files
committed
chore : add a devfile for using project from Cloud Develpment Environments
Signed-off-by: Rohan Kumar <[email protected]>
1 parent 2022108 commit 01f500d

File tree

6 files changed

+173
-9
lines changed

6 files changed

+173
-9
lines changed

.devfile.yaml

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

build/dockerfiles/devtools.Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) 2021-2024 Red Hat, Inc.
2+
# This program and the accompanying materials are made
3+
# available under the terms of the Eclipse Public License 2.0
4+
# which is available at https://www.eclipse.org/legal/epl-2.0/
5+
#
6+
# SPDX-License-Identifier: EPL-2.0
7+
#
8+
# Contributors:
9+
# Red Hat, Inc. - initial API and implementation
10+
#
11+
FROM quay.io/devfile/universal-developer-image:latest
12+
13+
USER root
14+
15+
# Install gettext
16+
RUN dnf install -y gettext
17+
18+
# Install the Operator SDK
19+
ENV OPERATOR_SDK_VERSION="v0.17.2"
20+
ENV OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}
21+
RUN curl -sSLO ${OPERATOR_SDK_DL_URL}/operator-sdk_linux_amd64 && \
22+
chmod +x operator-sdk_linux_amd64 && \
23+
mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk
24+
25+
# Install opm CLI
26+
ENV OPM_VERSION="v1.13.1"
27+
RUN curl -sSLO https://github.com/operator-framework/operator-registry/releases/download/${OPM_VERSION}/linux-amd64-opm && \
28+
chmod +x linux-amd64-opm && \
29+
mv linux-amd64-opm /usr/local/bin/opm
30+
31+
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)