Kubernetes operator based on microsoft/vscode and developed with python3 using kubernetes and kopf libraries.
It gives you a declarative way to deploy instances of vscode on-the-web automating the creation of related native objects:
- Deployment
- Service
- Ingresses
- Persitent volume claim
$ cat qa/sample1.yaml
---
apiVersion: davidp1404.github.com/v1
kind: vcodeWorkspace
metadata:
name: sample1
namespace: default
spec:
volumeSize: "100Mi"
storageClassName: "nfs-volumes"
resources:
requests:
cpu: "1"
password: "1234"
$ k get vcws sample1
NAME STORAGECLASSNAME VOLUMESIZE RESOURCES AGE
sample1 nfs-volumes 100Mi {"limits":{"cpu":"1","memory":"1Gi"},"requests":{"cpu":"1","memory":"1Gi"}} 29m
$ k get vcws sample1 -o yaml
apiVersion: davidp1404.github.com/v1
kind: vcodeWorkspace
metadata:
name: sample1
namespace: default
spec:
image: codercom/code-server
ingress-class: nginx
ingress-host: ""
password: "1234"
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: "1"
memory: 1Gi
storageClassName: nfs-volumes
volumeSize: 100Mi
As a result and instance of microsoft/vscode will become available at address https://<your_ingress_fqdn>/<namespace>/<name>/
- Allow developing of apps from inside the k8s instance, solving issues that port-forward doesn't usually solve well (like connect to kafka brokers or any distributted component).
- Restrict access to sensible code avoiding copies outside your control.
$ git clone --depth 1 --branch v1.0 https://github.com/davidp1404/vcode-operator.git
$ cd vcode-operator
# Tune the docker-image defintion in the Makefile to reflect your scenario
# Modify yaml/vcode-operator-deployment.yaml file with the image url/tag chosen
# Ensure your kubeconfig/context grants you the privileges needed to create crds, clusterroles, clusterrolebindings, serviceaccounts, configmaps, deployments
$ make docker-image
$ make install-crd
$ make install-operator
$ make install-qasamples
$ make uninstall-crd
$ make uninstall-operator
$ make uninstall-qasamples
Maturity: early beta
Limitations:
- WIP to manage pvc changes
- Based on jinja2 templates you can easily adapt to your particularities
- Makefile to create docker images and install
- Operator with multiple replicas
- Package with kustomize
- Replace password for something better like oidc2 auth