Skip to content

chore : add a devfile for using project from Cloud Develpment Environments #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#
# Copyright (c) 2020-2024 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
schemaVersion: 2.2.0
metadata:
name: web-terminal-operator
components:
- name: tools
container:
image: quay.io/wto/web-terminal-operator-devtools:latest
memoryRequest: 1Gi
memoryLimit: 16Gi
cpuLimit: '4'
cpuRequest: '0.5'
env:
- name: DOCKER
value: podman
commands:
- id: build-and-push-controller
exec:
label: "1. Build and push WTO controller image"
component: tools
commandLine: |
read -p "ENTER a container registry org to push the web-terminal-operator images (e.g. quay.io/janedoe): " WTO_IMG_REPO &&
read -p "ENTER the tag for the image (e.g. dev): " WTO_IMG_TAG &&
export WTO_IMG=${WTO_IMG_REPO}/web-terminal-operator:${WTO_IMG_TAG} &&
export BUNDLE_IMG=${WTO_IMG_REPO}/web-terminal-operator-metadata:${WTO_IMG_TAG} &&
export INDEX_IMG=${WTO_IMG_REPO}/web-terminal-operator-index:${WTO_IMG_TAG} &&
make build
group:
kind: build
- id: install-operator
exec:
label: "2. Register CatalogSource and install the operator"
component: tools
commandLine: |
read -p "ENTER a container registry org to use the web-terminal-operator images (e.g. quay.io/janedoe): " WTO_IMG_REPO &&
read -p "ENTER the tag for the image (e.g. dev): " WTO_IMG_TAG &&
export WTO_IMG=${WTO_IMG_REPO}/web-terminal-operator:${WTO_IMG_TAG} &&
export BUNDLE_IMG=${WTO_IMG_REPO}/web-terminal-operator-metadata:${WTO_IMG_TAG} &&
export INDEX_IMG=${WTO_IMG_REPO}/web-terminal-operator-index:${WTO_IMG_TAG} &&
make install
group:
kind: run

- id: register-catalogsource
exec:
label: "3. Register CatalogSource only"
component: tools
commandLine: |
read -p "ENTER a container registry org to push the web-terminal-operator images (e.g. quay.io/janedoe): " WTO_IMG_REPO &&
read -p "ENTER the tag for the image (e.g. dev): " WTO_IMG_TAG &&
export WTO_IMG=${WTO_IMG_REPO}/web-terminal-operator:${WTO_IMG_TAG} &&
export BUNDLE_IMG=${WTO_IMG_REPO}/web-terminal-operator-metadata:${WTO_IMG_TAG} &&
export INDEX_IMG=${WTO_IMG_REPO}/web-terminal-operator-index:${WTO_IMG_TAG} &&
make register_catalogsource
group:
kind: run

- id: unregister-catalogsource
exec:
label: "4. Unregister CatalogSource"
component: tools
commandLine: make unregister_catalogsource
group:
kind: run

- id: uninstall-operator
exec:
label: "5. Uninstall the Web Terminal Operator"
component: tools
commandLine: make uninstall
group:
kind: run
58 changes: 58 additions & 0 deletions .github/workflows/devtools-image-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# Copyright (c) 2020-2024 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
name: Devtools container build

on:
push:
branches: [ main ]

env:
PUSH_REGISTRY: quay.io
PUSH_USERNAME: wto


jobs:

build-devtools-img:

runs-on: ubuntu-24.04

outputs:
git-sha: ${{ steps.git-sha.outputs.sha }}

steps:
- name: Checkout devworkspace-operator source code
uses: actions/checkout@v4

- name: Set output for Git short SHA
id: git-sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Login to quay.io
uses: docker/login-action@v3
with:
username: ${{ env.PUSH_USERNAME }}
password: ${{ secrets.PUSH_PASSWORD }}
registry: ${{ env.PUSH_REGISTRY }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push devworkspace-devtools image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ env.PUSH_REGISTRY }}/${{ env.PUSH_USERNAME }}/web-terminal-operator-devtools:latest
${{ env.PUSH_REGISTRY }}/${{ env.PUSH_USERNAME }}/web-terminal-operator-devtools:sha-${{ steps.git-sha.outputs.sha }}
file: ./build/dockerfiles/devtools.Dockerfile
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,19 @@ uninstall:
# 1. Ensure that all DevWorkspace Custom Resources are removed to avoid issues with finalizers
# make sure depending objects are clean up as well
kubectl delete devworkspaces.workspace.devfile.io --all-namespaces --all --wait
kubectl delete workspaceroutings.controller.devfile.io --all-namespaces --all --wait
kubectl delete components.controller.devfile.io --all-namespaces --all --wait
kubectl delete devworkspaceroutings.controller.devfile.io --all-namespaces --all --wait
# 2. Uninstall the Operator
kubectl delete subscriptions.operators.coreos.com web-terminal -n openshift-operators --ignore-not-found
$(eval WTO_CSV := $(shell kubectl get csv -o=json | jq -r '[.items[] | select (.metadata.name | contains("web-terminal.v1"))][0].metadata.name'))
kubectl delete csv ${WTO_CSV} -n openshift-operators
# 3. Remove CRDs
kubectl delete customresourcedefinitions.apiextensions.k8s.io workspaceroutings.controller.devfile.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io components.controller.devfile.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io devworkspaceroutings.controller.devfile.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io devworkspaces.workspace.devfile.io
# 4. Remove DevWorkspace Webhook Server Deployment itself
kubectl delete deployment/devworkspace-webhook-server -n openshift-operators
# 5. Remove lingering service, secrets, and configmaps
kubectl delete all --selector app.kubernetes.io/part-of=devworkspace-operator,app.kubernetes.io/name=devworkspace-webhook-server
kubectl delete serviceaccounts devworkspace-webhook-server -n openshift-operators
kubectl delete configmap devworkspace-controller -n openshift-operators
kubectl delete clusterrole devworkspace-webhook-server
kubectl delete clusterrolebinding devworkspace-webhook-server
# 6. Remove mutating/validating webhooks configuration
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ This repo includes a `Makefile` to simplify deploying the Operator to a cluster:
| `make register_catalogsource` | Register the CatalogSource but do not install the operator. This enables the operator to be installed manually through OperatorHub. |
| `make unregister_catalogsource` | Remove the CatalogSource from the cluster. |
| `make uninstall` | uninstalls the Web Terminal Operator Subscription and related ClusterServiceVersion |
| `make uninstall_v1_2` | Remove the installed WTO 1.2 from the cluster |

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.

Expand Down Expand Up @@ -78,4 +77,4 @@ Execute
| source | destination | sync job |
| --- | --- | --- |
| [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/) |
| [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/)
| [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/)
31 changes: 31 additions & 0 deletions build/dockerfiles/devtools.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2021-2024 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
FROM quay.io/devfile/universal-developer-image:latest

USER root

# Install gettext
RUN dnf install -y gettext

# Install the Operator SDK
ENV OPERATOR_SDK_VERSION="v0.17.2"
ENV OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}
RUN curl -sSLO ${OPERATOR_SDK_DL_URL}/operator-sdk_linux_amd64 && \
chmod +x operator-sdk_linux_amd64 && \
mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk

# Install opm CLI
ENV OPM_VERSION="v1.13.1"
RUN curl -sSLO https://github.com/operator-framework/operator-registry/releases/download/${OPM_VERSION}/linux-amd64-opm && \
chmod +x linux-amd64-opm && \
mv linux-amd64-opm /usr/local/bin/opm

USER 1001
4 changes: 2 additions & 2 deletions docs/uninstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Manual steps are required to uninstall the Web Terminal Operator in order to avo

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

```
kubectl delete customresourcedefinitions.apiextensions.k8s.io workspaceroutings.controller.devfile.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io devworkspaceroutings.controller.devfile.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io components.controller.devfile.io
kubectl delete customresourcedefinitions.apiextensions.k8s.io devworkspaces.workspace.devfile.io
```
Expand Down