From 1b6ddb66f0b09ab9ad67f50cef6275e0731e17b0 Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Wed, 2 Sep 2020 20:41:58 +0100 Subject: [PATCH 01/19] Re-commit 0f1bbc --- deployment/chart/Chart.yaml | 5 + deployment/chart/README.md | 115 ++++++++++++++ deployment/chart/templates/NOTES.txt | 25 +++ deployment/chart/templates/_helpers.tpl | 43 ++++++ deployment/chart/templates/deployment.yaml | 144 ++++++++++++++++++ deployment/chart/templates/ingress.yaml | 39 +++++ deployment/chart/templates/pvc.yaml | 29 ++++ deployment/chart/templates/secrets.yaml | 18 +++ deployment/chart/templates/service.yaml | 19 +++ .../chart/templates/serviceaccount.yaml | 11 ++ .../templates/tests/test-connection.yaml | 18 +++ deployment/chart/values.yaml | 135 ++++++++++++++++ deployment/manifests/aws/deployment.yaml | 74 +++++++++ deployment/manifests/deployment.yaml | 43 ++++++ 14 files changed, 718 insertions(+) create mode 100644 deployment/chart/Chart.yaml create mode 100644 deployment/chart/README.md create mode 100644 deployment/chart/templates/NOTES.txt create mode 100644 deployment/chart/templates/_helpers.tpl create mode 100644 deployment/chart/templates/deployment.yaml create mode 100644 deployment/chart/templates/ingress.yaml create mode 100644 deployment/chart/templates/pvc.yaml create mode 100644 deployment/chart/templates/secrets.yaml create mode 100644 deployment/chart/templates/service.yaml create mode 100644 deployment/chart/templates/serviceaccount.yaml create mode 100644 deployment/chart/templates/tests/test-connection.yaml create mode 100644 deployment/chart/values.yaml create mode 100644 deployment/manifests/aws/deployment.yaml create mode 100644 deployment/manifests/deployment.yaml diff --git a/deployment/chart/Chart.yaml b/deployment/chart/Chart.yaml new file mode 100644 index 000000000..283eea6de --- /dev/null +++ b/deployment/chart/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for code-server +name: code-server +version: 1.0.0 diff --git a/deployment/chart/README.md b/deployment/chart/README.md new file mode 100644 index 000000000..34481eaf7 --- /dev/null +++ b/deployment/chart/README.md @@ -0,0 +1,115 @@ +# code-server + +[code-server](https://github.com/cdr/code-server) code-server is VS Code running +on a remote server, accessible through the browser. + +## TL;DR; + +```console +$ git clone https://github.com/cdr/code-server.git +$ helm install deployment/chart +``` + +## Introduction + +This chart bootstraps a code-server deployment on a +[Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) +package manager. + +## Prerequisites + + - Kubernetes 1.6+ + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm install --name my-release deployment/chart +``` + +The command deploys code-server on the Kubernetes cluster in the default +configuration. The [configuration](#configuration) section lists the parameters +that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and +deletes the release. + +## Configuration + +The following table lists the configurable parameters of the nginx-ingress chart +and their default values. + + +The following table lists the configurable parameters of the code-server chart +and their default values. + +| Parameter | Description | Default | +| --------------------------------- | ------------------------------------------ | --------------------------------------------------------- | +| `image.registry` | Code-server image registry | `docker.io` | +| `image.repository` | Code-server Image name | `codercom/code-server` | +| `image.tag` | Code-server Image tag | `{TAG_NAME}` | +| `image.pullPolicy` | Code-server image pull policy | `IfNotPresent` | +| `nameOverride` | String to partially override code-server.fullname template with a string (will prepend the release name) | `nil` | +| `fullnameOverride` | String to fully override code-server.fullname template with a string | +| `hostnameOverride` | String to fully override code-server container hostname | +| `service.type` | Kubernetes Service type | `NodePort` | +| `service.port` | Service HTTP port | `8443` | +| `ingress.enabled` | Enable ingress controller resource | `false` | +| `ingress.hosts[0].name` | Hostname to your code-server installation | `code-server.local` | +| `ingress.hosts[0].path` | Path within the url structure | `/` | +| `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` | +| `ingress.hosts[0].certManager` | Add annotations for cert-manager | `false` | +| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `code-server.local-tls-secret` | +| `ingress.hosts[0].annotations` | Annotations for this host's ingress record | `[]` | +| `ingress.secrets[0].name` | TLS Secret Name | `nil` | +| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` | +| `ingress.secrets[0].key` | TLS Secret Key | `nil` | +| `extraArgs` | Additional code-server container arguments | `{}` | +| `extraVars` | Optional environment variables for code-server | `{}` | +| `volumePermissions.enabled` | Enable volume permissions init container | `true` | +| `volumePermissions.securityContext.runAsUser` | User ID for the init container | `0` | +| `securityContext.enabled` | Enable security context | `true` | +| `securityContext.fsGroup` | Group ID for the container | `1000` | +| `securityContext.runAsUser` | User ID for the container | `1000` | +| `resources` | CPU/Memory resource requests/limits | `{}` | +| `persistence.enabled` | Enable persistence using PVC | `true` | +| `persistence.storageClass` | PVC Storage Class for code-server volume | `nil` | +| `persistence.accessMode` | PVC Access Mode for code-server volume | `ReadWriteOnce` | +| `persistence.size` | PVC Storage Request for code-server volume | `8Gi` | +| `extraContainers` | Sidecar containers to add to the code-server pod | `{}` | +| `extraSecretMounts` | Additional code-server server secret mounts | `[]` | +| `extraVolumeMounts` | Additional code-server server volume mounts | `[]` | +| `extraConfigmapMounts` | Additional code-server server configMap volume mounts | `[]` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm +install`. For example, + +```console +$ helm install --name my-release \ + --set persistence.enabled=false \ + deployment/chart +``` + +The above command sets the the persistence storage to false. + +Alternatively, a YAML file that specifies the values for the above parameters +can be provided while installing the chart. For example, + +```console +$ helm install --name my-release -f values.yaml deployment/chart +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + + diff --git a/deployment/chart/templates/NOTES.txt b/deployment/chart/templates/NOTES.txt new file mode 100644 index 000000000..e9af85992 --- /dev/null +++ b/deployment/chart/templates/NOTES.txt @@ -0,0 +1,25 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "code-server.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "code-server.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "code-server.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "code-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} + +Administrator credentials: + + Password : $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "code-server.fullname" . }} -o jsonpath="{.data.password}" | base64 --decode) diff --git a/deployment/chart/templates/_helpers.tpl b/deployment/chart/templates/_helpers.tpl new file mode 100644 index 000000000..811252b9e --- /dev/null +++ b/deployment/chart/templates/_helpers.tpl @@ -0,0 +1,43 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "code-server.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "code-server.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "code-server.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "code-server.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "code-server.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/deployment/chart/templates/deployment.yaml b/deployment/chart/templates/deployment.yaml new file mode 100644 index 000000000..63a84d61d --- /dev/null +++ b/deployment/chart/templates/deployment.yaml @@ -0,0 +1,144 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "code-server.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + {{- if .Values.hostnameOverride }} + hostname: {{ .Values.hostnameOverride }} + {{- end }} + {{- if .Values.securityContext.enabled }} + securityContext: + fsGroup: {{ .Values.securityContext.fsGroup }} + {{- end }} + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + initContainers: + - name: init-chmod-data + image: busybox:latest + imagePullPolicy: IfNotPresent + command: + - sh + - -c + - | + chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /home/coder + securityContext: + runAsUser: {{ .Values.volumePermissions.securityContext.runAsUser }} + volumeMounts: + - name: data + mountPath: /home/coder + {{- end }} + containers: +{{- if .Values.extraContainers }} +{{ toYaml .Values.extraContainers | indent 8}} +{{- end }} + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.securityContext.enabled }} + securityContext: + runAsUser: {{ .Values.securityContext.runAsUser }} + {{- end }} + env: + {{- if .Values.extraVars }} +{{ toYaml .Values.extraVars | indent 10 }} + {{- end }} + - name: PASSWORD + valueFrom: + secretKeyRef: + {{- if .Values.existingSecret }} + name: {{ .Values.existingSecret }} + {{- else }} + name: {{ template "code-server.fullname" . }} + {{- end }} + key: password + {{- if .Values.extraArgs }} + args: +{{ toYaml .Values.extraArgs | indent 10 }} + {{- end }} + volumeMounts: + - name: data + mountPath: /home/coder/project + subPath: project + - name: data + mountPath: /home/coder/.local/share/code-server + subPath: code-server + {{- range .Values.extraConfigmapMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + subPath: {{ .subPath | default "" }} + readOnly: {{ .readOnly }} + {{- end }} + {{- range .Values.extraSecretMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + readOnly: {{ .readOnly }} + {{- end }} + {{- range .Values.extraVolumeMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + subPath: {{ .subPath | default "" }} + readOnly: {{ .readOnly }} + {{- end }} + ports: + - name: http + containerPort: 8443 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ template "code-server.serviceAccountName" . }} + volumes: + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "code-server.fullname" .) }} + {{- else }} + emptyDir: {} + {{- end -}} + {{- range .Values.extraSecretMounts }} + - name: {{ .name }} + secret: + secretName: {{ .secretName }} + defaultMode: {{ .defaultMode }} + {{- end }} + {{- range .Values.extraVolumeMounts }} + - name: {{ .name }} + persistentVolumeClaim: + claimName: {{ .existingClaim }} + {{- end }} diff --git a/deployment/chart/templates/ingress.yaml b/deployment/chart/templates/ingress.yaml new file mode 100644 index 000000000..1858bb5f2 --- /dev/null +++ b/deployment/chart/templates/ingress.yaml @@ -0,0 +1,39 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "code-server.fullname" . -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: http + {{- end }} + {{- end }} +{{- end }} diff --git a/deployment/chart/templates/pvc.yaml b/deployment/chart/templates/pvc.yaml new file mode 100644 index 000000000..f29301477 --- /dev/null +++ b/deployment/chart/templates/pvc.yaml @@ -0,0 +1,29 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "code-server.fullname" . }} + namespace: {{ .Release.Namespace }} +{{- with .Values.persistence.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} diff --git a/deployment/chart/templates/secrets.yaml b/deployment/chart/templates/secrets.yaml new file mode 100644 index 000000000..6c600417a --- /dev/null +++ b/deployment/chart/templates/secrets.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "code-server.fullname" . }} + annotations: + "helm.sh/hook": "pre-install" + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +type: Opaque +data: + {{ if .Values.password }} + password: "{{ .Values.password | b64enc }}" + {{ else }} + password: "{{ randAlphaNum 24 | b64enc }}" + {{ end }} diff --git a/deployment/chart/templates/service.yaml b/deployment/chart/templates/service.yaml new file mode 100644 index 000000000..038b6cd0d --- /dev/null +++ b/deployment/chart/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "code-server.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ include "code-server.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/deployment/chart/templates/serviceaccount.yaml b/deployment/chart/templates/serviceaccount.yaml new file mode 100644 index 000000000..df9e1e375 --- /dev/null +++ b/deployment/chart/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +{{- if or .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + name: {{ template "code-server.serviceAccountName" . }} +{{- end -}} diff --git a/deployment/chart/templates/tests/test-connection.yaml b/deployment/chart/templates/tests/test-connection.yaml new file mode 100644 index 000000000..2e67f56ec --- /dev/null +++ b/deployment/chart/templates/tests/test-connection.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "code-server.fullname" . }}-test-connection" + labels: + app.kubernetes.io/name: {{ include "code-server.name" . }} + helm.sh/chart: {{ include "code-server.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "code-server.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/deployment/chart/values.yaml b/deployment/chart/values.yaml new file mode 100644 index 000000000..102ef620f --- /dev/null +++ b/deployment/chart/values.yaml @@ -0,0 +1,135 @@ +# Default values for code-server. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + repository: codercom/code-server + tag: 1.1156-vsc1.33.1 + pullPolicy: Always + +nameOverride: "" +fullnameOverride: "" +hostnameOverride: "" + +service: + type: NodePort + port: 8443 + +ingress: + enabled: false + #annotations: + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + #hosts: + # - host: code-server.example.loc + # paths: + # - / + + #tls: + # - secretName: code-server + # hosts: + # - code-server.example.loc + +# Optional additional arguments +extraArgs: [] +# - --allow-http +# - --no-auth + +# Optional additional environment variables +extraVars: [] +# - name: DISABLE_TELEMETRY +# value: true + +## +## Init containers parameters: +## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup +## +volumePermissions: + enabled: true + securityContext: + runAsUser: 0 + +## Pod Security Context +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ +## +securityContext: + enabled: true + fsGroup: 1000 + runAsUser: 1000 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 1000Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +## Persist data to a persistent volume +persistence: + enabled: true + ## code-server data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + accessMode: ReadWriteOnce + size: 1Gi + annotations: {} + +serviceAccount: + create: true + name: + +## Enable an Specify container in extraContainers. +## This is meant to allow adding code-server dependencies, like docker-dind. +extraContainers: | +#- name: docker-dind +# image: docker:19.03-dind +# imagePullPolicy: IfNotPresent +# resources: +# requests: +# cpu: 250m +# memory: 256M +# securityContext: +# privileged: true +# procMount: Default +# env: +# - name: DOCKER_TLS_CERTDIR +# value: "" +# - name: DOCKER_DRIVER +# value: "overlay2" + +## Additional code-server secret mounts +extraSecretMounts: [] + # - name: secret-files + # mountPath: /etc/secrets + # secretName: code-server-secret-files + # readOnly: true + +## Additional code-server volume mounts +extraVolumeMounts: [] + # - name: extra-volume + # mountPath: /mnt/volume + # readOnly: true + # existingClaim: volume-claim + +extraConfigmapMounts: [] + # - name: certs-configmap + # mountPath: /etc/code-server/ssl/ + # subPath: certificates.crt # (optional) + # configMap: certs-configmap + # readOnly: true diff --git a/deployment/manifests/aws/deployment.yaml b/deployment/manifests/aws/deployment.yaml new file mode 100644 index 000000000..6f265634d --- /dev/null +++ b/deployment/manifests/aws/deployment.yaml @@ -0,0 +1,74 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: code-server +--- +apiVersion: v1 +kind: Service +metadata: + name: code-server + namespace: code-server +spec: + ports: + - port: 8443 + name: https + protocol: TCP + selector: + app: code-server + type: ClusterIP +--- +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: gp2 + annotations: + storageclass.kubernetes.io/is-default-class: "true" +provisioner: kubernetes.io/aws-ebs +parameters: + type: gp2 + fsType: ext4 +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: code-store + namespace: code-server +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 60Gi +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + app: code-server + name: code-server + namespace: code-server +spec: + selector: + matchLabels: + app: code-server + replicas: 1 + template: + metadata: + labels: + app: code-server + spec: + containers: + - image: codercom/code-server + imagePullPolicy: Always + name: code-servery + ports: + - containerPort: 8443 + name: https + volumeMounts: + - name: code-server-storage + mountPath: /go/src + volumes: + - name: code-server-storage + persistentVolumeClaim: + claimName: code-store + diff --git a/deployment/manifests/deployment.yaml b/deployment/manifests/deployment.yaml new file mode 100644 index 000000000..a032d5234 --- /dev/null +++ b/deployment/manifests/deployment.yaml @@ -0,0 +1,43 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: code-server +--- +apiVersion: v1 +kind: Service +metadata: + name: code-server + namespace: code-server +spec: + ports: + - port: 8443 + name: https + protocol: TCP + selector: + app: code-server + type: ClusterIP +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + labels: + app: code-server + name: code-server + namespace: code-server +spec: + selector: + matchLabels: + app: code-server + replicas: 1 + template: + metadata: + labels: + app: code-server + spec: + containers: + - image: codercom/code-server + imagePullPolicy: Always + name: code-server + ports: + - containerPort: 8443 + name: https From 85d5858b1df861fd1d8cb0a4379bab55ebe25adf Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Wed, 2 Sep 2020 20:43:57 +0100 Subject: [PATCH 02/19] Remove Kubernetes native manifests --- deployment/manifests/aws/deployment.yaml | 74 ------------------------ deployment/manifests/deployment.yaml | 43 -------------- 2 files changed, 117 deletions(-) delete mode 100644 deployment/manifests/aws/deployment.yaml delete mode 100644 deployment/manifests/deployment.yaml diff --git a/deployment/manifests/aws/deployment.yaml b/deployment/manifests/aws/deployment.yaml deleted file mode 100644 index 6f265634d..000000000 --- a/deployment/manifests/aws/deployment.yaml +++ /dev/null @@ -1,74 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: code-server ---- -apiVersion: v1 -kind: Service -metadata: - name: code-server - namespace: code-server -spec: - ports: - - port: 8443 - name: https - protocol: TCP - selector: - app: code-server - type: ClusterIP ---- -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - name: gp2 - annotations: - storageclass.kubernetes.io/is-default-class: "true" -provisioner: kubernetes.io/aws-ebs -parameters: - type: gp2 - fsType: ext4 ---- -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: code-store - namespace: code-server -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 60Gi ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: code-server - name: code-server - namespace: code-server -spec: - selector: - matchLabels: - app: code-server - replicas: 1 - template: - metadata: - labels: - app: code-server - spec: - containers: - - image: codercom/code-server - imagePullPolicy: Always - name: code-servery - ports: - - containerPort: 8443 - name: https - volumeMounts: - - name: code-server-storage - mountPath: /go/src - volumes: - - name: code-server-storage - persistentVolumeClaim: - claimName: code-store - diff --git a/deployment/manifests/deployment.yaml b/deployment/manifests/deployment.yaml deleted file mode 100644 index a032d5234..000000000 --- a/deployment/manifests/deployment.yaml +++ /dev/null @@ -1,43 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: code-server ---- -apiVersion: v1 -kind: Service -metadata: - name: code-server - namespace: code-server -spec: - ports: - - port: 8443 - name: https - protocol: TCP - selector: - app: code-server - type: ClusterIP ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: code-server - name: code-server - namespace: code-server -spec: - selector: - matchLabels: - app: code-server - replicas: 1 - template: - metadata: - labels: - app: code-server - spec: - containers: - - image: codercom/code-server - imagePullPolicy: Always - name: code-server - ports: - - containerPort: 8443 - name: https From d33df756629f137d77c4c10f161c3b398cc2b561 Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Wed, 2 Sep 2020 21:00:12 +0100 Subject: [PATCH 03/19] Add updated Helm chart --- charts/code-server/Chart.yaml | 23 +++++++++++++++++ .../chart => charts/code-server}/README.md | 0 .../code-server}/templates/NOTES.txt | 0 .../code-server}/templates/_helpers.tpl | 0 .../code-server}/templates/deployment.yaml | 0 .../code-server}/templates/ingress.yaml | 0 .../code-server}/templates/pvc.yaml | 0 .../code-server}/templates/secrets.yaml | 0 .../code-server}/templates/service.yaml | 0 .../templates/serviceaccount.yaml | 0 .../templates/tests/test-connection.yaml | 0 .../chart => charts/code-server}/values.yaml | 25 +++++++++++++++++++ deployment/chart/Chart.yaml | 5 ---- 13 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 charts/code-server/Chart.yaml rename {deployment/chart => charts/code-server}/README.md (100%) rename {deployment/chart => charts/code-server}/templates/NOTES.txt (100%) rename {deployment/chart => charts/code-server}/templates/_helpers.tpl (100%) rename {deployment/chart => charts/code-server}/templates/deployment.yaml (100%) rename {deployment/chart => charts/code-server}/templates/ingress.yaml (100%) rename {deployment/chart => charts/code-server}/templates/pvc.yaml (100%) rename {deployment/chart => charts/code-server}/templates/secrets.yaml (100%) rename {deployment/chart => charts/code-server}/templates/service.yaml (100%) rename {deployment/chart => charts/code-server}/templates/serviceaccount.yaml (100%) rename {deployment/chart => charts/code-server}/templates/tests/test-connection.yaml (100%) rename {deployment/chart => charts/code-server}/values.yaml (85%) delete mode 100644 deployment/chart/Chart.yaml diff --git a/charts/code-server/Chart.yaml b/charts/code-server/Chart.yaml new file mode 100644 index 000000000..ba9281ab8 --- /dev/null +++ b/charts/code-server/Chart.yaml @@ -0,0 +1,23 @@ +apiVersion: v2 +name: code-server +description: A Helm chart for cdr/code-server + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 1.0.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +appVersion: 3.5.0 diff --git a/deployment/chart/README.md b/charts/code-server/README.md similarity index 100% rename from deployment/chart/README.md rename to charts/code-server/README.md diff --git a/deployment/chart/templates/NOTES.txt b/charts/code-server/templates/NOTES.txt similarity index 100% rename from deployment/chart/templates/NOTES.txt rename to charts/code-server/templates/NOTES.txt diff --git a/deployment/chart/templates/_helpers.tpl b/charts/code-server/templates/_helpers.tpl similarity index 100% rename from deployment/chart/templates/_helpers.tpl rename to charts/code-server/templates/_helpers.tpl diff --git a/deployment/chart/templates/deployment.yaml b/charts/code-server/templates/deployment.yaml similarity index 100% rename from deployment/chart/templates/deployment.yaml rename to charts/code-server/templates/deployment.yaml diff --git a/deployment/chart/templates/ingress.yaml b/charts/code-server/templates/ingress.yaml similarity index 100% rename from deployment/chart/templates/ingress.yaml rename to charts/code-server/templates/ingress.yaml diff --git a/deployment/chart/templates/pvc.yaml b/charts/code-server/templates/pvc.yaml similarity index 100% rename from deployment/chart/templates/pvc.yaml rename to charts/code-server/templates/pvc.yaml diff --git a/deployment/chart/templates/secrets.yaml b/charts/code-server/templates/secrets.yaml similarity index 100% rename from deployment/chart/templates/secrets.yaml rename to charts/code-server/templates/secrets.yaml diff --git a/deployment/chart/templates/service.yaml b/charts/code-server/templates/service.yaml similarity index 100% rename from deployment/chart/templates/service.yaml rename to charts/code-server/templates/service.yaml diff --git a/deployment/chart/templates/serviceaccount.yaml b/charts/code-server/templates/serviceaccount.yaml similarity index 100% rename from deployment/chart/templates/serviceaccount.yaml rename to charts/code-server/templates/serviceaccount.yaml diff --git a/deployment/chart/templates/tests/test-connection.yaml b/charts/code-server/templates/tests/test-connection.yaml similarity index 100% rename from deployment/chart/templates/tests/test-connection.yaml rename to charts/code-server/templates/tests/test-connection.yaml diff --git a/deployment/chart/values.yaml b/charts/code-server/values.yaml similarity index 85% rename from deployment/chart/values.yaml rename to charts/code-server/values.yaml index 102ef620f..ebbdbc167 100644 --- a/deployment/chart/values.yaml +++ b/charts/code-server/values.yaml @@ -2,15 +2,40 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. +replicaCount: 1 + image: repository: codercom/code-server tag: 1.1156-vsc1.33.1 pullPolicy: Always +imagePullSecrets: [] nameOverride: "" fullnameOverride: "" hostnameOverride: "" +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + service: type: NodePort port: 8443 diff --git a/deployment/chart/Chart.yaml b/deployment/chart/Chart.yaml deleted file mode 100644 index 283eea6de..000000000 --- a/deployment/chart/Chart.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: v1 -appVersion: "1.0" -description: A Helm chart for code-server -name: code-server -version: 1.0.0 From 34f8c77a0309013742ac5b90ef6eb61d64791fb1 Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Wed, 2 Sep 2020 21:05:57 +0100 Subject: [PATCH 04/19] Change service default to ClusterIP and add helmignore --- charts/code-server/.helmignore | 23 +++++++++++++++++++++++ charts/code-server/values.yaml | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 charts/code-server/.helmignore diff --git a/charts/code-server/.helmignore b/charts/code-server/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/charts/code-server/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/code-server/values.yaml b/charts/code-server/values.yaml index ebbdbc167..408741115 100644 --- a/charts/code-server/values.yaml +++ b/charts/code-server/values.yaml @@ -37,7 +37,7 @@ securityContext: {} # runAsUser: 1000 service: - type: NodePort + type: ClusterIP port: 8443 ingress: From 341cb342b25a316a2dcc68ecd98c4d9f7cac7cdb Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Wed, 2 Sep 2020 21:53:52 +0100 Subject: [PATCH 05/19] Patch helm chart to stable with v3.5.0 --- charts/code-server/templates/_helpers.tpl | 20 +++++++++++++ charts/code-server/templates/deployment.yaml | 2 +- charts/code-server/templates/ingress.yaml | 30 +++++++++++--------- charts/code-server/values.yaml | 2 +- 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/charts/code-server/templates/_helpers.tpl b/charts/code-server/templates/_helpers.tpl index 811252b9e..bb36e8c21 100644 --- a/charts/code-server/templates/_helpers.tpl +++ b/charts/code-server/templates/_helpers.tpl @@ -31,6 +31,26 @@ Create chart name and version as used by the chart label. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* +Common labels +*/}} +{{- define "code-server.labels" -}} +helm.sh/chart: {{ include "code-server.chart" . }} +{{ include "code-server.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "code-server.selectorLabels" -}} +app.kubernetes.io/name: {{ include "code-server.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + {{/* Create the name of the service account to use */}} diff --git a/charts/code-server/templates/deployment.yaml b/charts/code-server/templates/deployment.yaml index 63a84d61d..52c1ee954 100644 --- a/charts/code-server/templates/deployment.yaml +++ b/charts/code-server/templates/deployment.yaml @@ -98,7 +98,7 @@ spec: {{- end }} ports: - name: http - containerPort: 8443 + containerPort: 8080 protocol: TCP livenessProbe: httpGet: diff --git a/charts/code-server/templates/ingress.yaml b/charts/code-server/templates/ingress.yaml index 1858bb5f2..07a3abd0b 100644 --- a/charts/code-server/templates/ingress.yaml +++ b/charts/code-server/templates/ingress.yaml @@ -1,39 +1,41 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "code-server.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} apiVersion: extensions/v1beta1 +{{- end }} kind: Ingress metadata: name: {{ $fullName }} labels: - app.kubernetes.io/name: {{ include "code-server.name" . }} - helm.sh/chart: {{ include "code-server.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- include "code-server.labels" . | nindent 4 }} {{- with .Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: -{{- if .Values.ingress.tls }} + {{- if .Values.ingress.tls }} tls: - {{- range .Values.ingress.tls }} + {{- range .Values.ingress.tls }} - hosts: - {{- range .hosts }} + {{- range .hosts }} - {{ . | quote }} - {{- end }} + {{- end }} secretName: {{ .secretName }} + {{- end }} {{- end }} -{{- end }} rules: - {{- range .Values.ingress.hosts }} + {{- range .Values.ingress.hosts }} - host: {{ .host | quote }} http: paths: - {{- range .paths }} + {{- range .paths }} - path: {{ . }} backend: serviceName: {{ $fullName }} - servicePort: http - {{- end }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} {{- end }} -{{- end }} diff --git a/charts/code-server/values.yaml b/charts/code-server/values.yaml index 408741115..72dc5501e 100644 --- a/charts/code-server/values.yaml +++ b/charts/code-server/values.yaml @@ -6,7 +6,7 @@ replicaCount: 1 image: repository: codercom/code-server - tag: 1.1156-vsc1.33.1 + tag: '3.5.0' pullPolicy: Always imagePullSecrets: [] From 559d05bb7b5e1654e99dc7fb004be97fe8297758 Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Wed, 2 Sep 2020 22:02:37 +0100 Subject: [PATCH 06/19] Update readme and service port --- charts/code-server/README.md | 77 ++++++++++++++++++---------------- charts/code-server/values.yaml | 2 +- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/charts/code-server/README.md b/charts/code-server/README.md index 34481eaf7..0044909c0 100644 --- a/charts/code-server/README.md +++ b/charts/code-server/README.md @@ -1,5 +1,7 @@ # code-server +![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.5.0](https://img.shields.io/badge/AppVersion-3.5.0-informational?style=flat-square) + [code-server](https://github.com/cdr/code-server) code-server is VS Code running on a remote server, accessible through the browser. @@ -54,43 +56,44 @@ and their default values. The following table lists the configurable parameters of the code-server chart and their default values. -| Parameter | Description | Default | -| --------------------------------- | ------------------------------------------ | --------------------------------------------------------- | -| `image.registry` | Code-server image registry | `docker.io` | -| `image.repository` | Code-server Image name | `codercom/code-server` | -| `image.tag` | Code-server Image tag | `{TAG_NAME}` | -| `image.pullPolicy` | Code-server image pull policy | `IfNotPresent` | -| `nameOverride` | String to partially override code-server.fullname template with a string (will prepend the release name) | `nil` | -| `fullnameOverride` | String to fully override code-server.fullname template with a string | -| `hostnameOverride` | String to fully override code-server container hostname | -| `service.type` | Kubernetes Service type | `NodePort` | -| `service.port` | Service HTTP port | `8443` | -| `ingress.enabled` | Enable ingress controller resource | `false` | -| `ingress.hosts[0].name` | Hostname to your code-server installation | `code-server.local` | -| `ingress.hosts[0].path` | Path within the url structure | `/` | -| `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` | -| `ingress.hosts[0].certManager` | Add annotations for cert-manager | `false` | -| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `code-server.local-tls-secret` | -| `ingress.hosts[0].annotations` | Annotations for this host's ingress record | `[]` | -| `ingress.secrets[0].name` | TLS Secret Name | `nil` | -| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` | -| `ingress.secrets[0].key` | TLS Secret Key | `nil` | -| `extraArgs` | Additional code-server container arguments | `{}` | -| `extraVars` | Optional environment variables for code-server | `{}` | -| `volumePermissions.enabled` | Enable volume permissions init container | `true` | -| `volumePermissions.securityContext.runAsUser` | User ID for the init container | `0` | -| `securityContext.enabled` | Enable security context | `true` | -| `securityContext.fsGroup` | Group ID for the container | `1000` | -| `securityContext.runAsUser` | User ID for the container | `1000` | -| `resources` | CPU/Memory resource requests/limits | `{}` | -| `persistence.enabled` | Enable persistence using PVC | `true` | -| `persistence.storageClass` | PVC Storage Class for code-server volume | `nil` | -| `persistence.accessMode` | PVC Access Mode for code-server volume | `ReadWriteOnce` | -| `persistence.size` | PVC Storage Request for code-server volume | `8Gi` | -| `extraContainers` | Sidecar containers to add to the code-server pod | `{}` | -| `extraSecretMounts` | Additional code-server server secret mounts | `[]` | -| `extraVolumeMounts` | Additional code-server server volume mounts | `[]` | -| `extraConfigmapMounts` | Additional code-server server configMap volume mounts | `[]` | +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| extraArgs | list | `[]` | | +| extraConfigmapMounts | list | `[]` | | +| extraContainers | string | `""` | | +| extraSecretMounts | list | `[]` | | +| extraVars | list | `[]` | | +| extraVolumeMounts | list | `[]` | | +| fullnameOverride | string | `""` | | +| hostnameOverride | string | `""` | | +| image.pullPolicy | string | `"Always"` | | +| image.repository | string | `"codercom/code-server"` | | +| image.tag | string | `"3.5.0"` | | +| imagePullSecrets | list | `[]` | | +| ingress.enabled | bool | `false` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| persistence.accessMode | string | `"ReadWriteOnce"` | | +| persistence.annotations | object | `{}` | | +| persistence.enabled | bool | `true` | | +| persistence.size | string | `"1Gi"` | | +| podAnnotations | object | `{}` | | +| podSecurityContext | object | `{}` | | +| replicaCount | int | `1` | | +| resources | object | `{}` | | +| securityContext.enabled | bool | `true` | | +| securityContext.fsGroup | int | `1000` | | +| securityContext.runAsUser | int | `1000` | | +| service.port | int | `8443` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `nil` | | +| tolerations | list | `[]` | | +| volumePermissions.enabled | bool | `true` | | +| volumePermissions.securityContext.runAsUser | int | `0` | | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/charts/code-server/values.yaml b/charts/code-server/values.yaml index 72dc5501e..57a01d873 100644 --- a/charts/code-server/values.yaml +++ b/charts/code-server/values.yaml @@ -38,7 +38,7 @@ securityContext: {} service: type: ClusterIP - port: 8443 + port: 8080 ingress: enabled: false From 8fe7986d0d42d917fa739d090235f50dc466b16a Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Wed, 2 Sep 2020 22:19:56 +0100 Subject: [PATCH 07/19] Add kubeval workflow --- .github/workflows/helm_validation.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/helm_validation.yaml diff --git a/.github/workflows/helm_validation.yaml b/.github/workflows/helm_validation.yaml new file mode 100644 index 000000000..02d991247 --- /dev/null +++ b/.github/workflows/helm_validation.yaml @@ -0,0 +1,10 @@ +name: Helm Validation + +on: [pull_request, issues] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Kubeval Helm Chart + uses: junior/kubeval-helm-chart-action@0.2.0-alpha.0 From 70b73d7cb9709f0213907651402af015619dc36a Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Wed, 2 Sep 2020 22:24:24 +0100 Subject: [PATCH 08/19] Add kubernetes version environment variable --- .github/workflows/helm_validation.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/helm_validation.yaml b/.github/workflows/helm_validation.yaml index 02d991247..39581f4d9 100644 --- a/.github/workflows/helm_validation.yaml +++ b/.github/workflows/helm_validation.yaml @@ -8,3 +8,5 @@ jobs: steps: - name: Kubeval Helm Chart uses: junior/kubeval-helm-chart-action@0.2.0-alpha.0 + env: + INPUT_KUBERNETES_VERSION: 1.19 From 96a78c98d15548405736b595c7524f1e151ec5eb Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Wed, 2 Sep 2020 22:26:06 +0100 Subject: [PATCH 09/19] Add checkout of repo --- .github/workflows/helm_validation.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/helm_validation.yaml b/.github/workflows/helm_validation.yaml index 39581f4d9..9ba82ec08 100644 --- a/.github/workflows/helm_validation.yaml +++ b/.github/workflows/helm_validation.yaml @@ -6,6 +6,8 @@ jobs: validate: runs-on: ubuntu-latest steps: + - name: Checkout Repo + uses: actions/checkout@v2 - name: Kubeval Helm Chart uses: junior/kubeval-helm-chart-action@0.2.0-alpha.0 env: From 40b1efa142babc7df0ecbf1024c2b51efe7d5005 Mon Sep 17 00:00:00 2001 From: Hossam Hammady Date: Mon, 12 Oct 2020 10:45:26 +0000 Subject: [PATCH 10/19] Add echo command in NOTES to get password --- charts/code-server/templates/NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/code-server/templates/NOTES.txt b/charts/code-server/templates/NOTES.txt index e9af85992..17c25f646 100644 --- a/charts/code-server/templates/NOTES.txt +++ b/charts/code-server/templates/NOTES.txt @@ -22,4 +22,4 @@ Administrator credentials: - Password : $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "code-server.fullname" . }} -o jsonpath="{.data.password}" | base64 --decode) + Password: echo $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "code-server.fullname" . }} -o jsonpath="{.data.password}" | base64 --decode) From d323f4f75bea04339043a28f4b31761641099721 Mon Sep 17 00:00:00 2001 From: Hossam Hammady Date: Mon, 12 Oct 2020 10:46:52 +0000 Subject: [PATCH 11/19] Add missing existingClaim in values.yaml comments --- charts/code-server/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/code-server/values.yaml b/charts/code-server/values.yaml index 57a01d873..182116546 100644 --- a/charts/code-server/values.yaml +++ b/charts/code-server/values.yaml @@ -114,6 +114,7 @@ persistence: accessMode: ReadWriteOnce size: 1Gi annotations: {} + # existingClaim: "" serviceAccount: create: true From fd241d555bacdbc49f64537edd1e8c15880e375d Mon Sep 17 00:00:00 2001 From: Hossam Hammady Date: Mon, 12 Oct 2020 10:49:21 +0000 Subject: [PATCH 12/19] Fix indentation for extra mounts --- charts/code-server/templates/deployment.yaml | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/charts/code-server/templates/deployment.yaml b/charts/code-server/templates/deployment.yaml index 52c1ee954..60caa3307 100644 --- a/charts/code-server/templates/deployment.yaml +++ b/charts/code-server/templates/deployment.yaml @@ -80,21 +80,21 @@ spec: mountPath: /home/coder/.local/share/code-server subPath: code-server {{- range .Values.extraConfigmapMounts }} - - name: {{ .name }} - mountPath: {{ .mountPath }} - subPath: {{ .subPath | default "" }} - readOnly: {{ .readOnly }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + subPath: {{ .subPath | default "" }} + readOnly: {{ .readOnly }} {{- end }} {{- range .Values.extraSecretMounts }} - - name: {{ .name }} - mountPath: {{ .mountPath }} - readOnly: {{ .readOnly }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + readOnly: {{ .readOnly }} {{- end }} {{- range .Values.extraVolumeMounts }} - - name: {{ .name }} - mountPath: {{ .mountPath }} - subPath: {{ .subPath | default "" }} - readOnly: {{ .readOnly }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + subPath: {{ .subPath | default "" }} + readOnly: {{ .readOnly }} {{- end }} ports: - name: http From b4fd47b5af431e2d2f6daea4e89ed841e72c498f Mon Sep 17 00:00:00 2001 From: Hossam Hammady Date: Mon, 12 Oct 2020 11:59:53 +0000 Subject: [PATCH 13/19] Add support for hostPath volumes --- charts/code-server/templates/deployment.yaml | 26 ++++++++++++++------ charts/code-server/templates/pvc.yaml | 2 +- charts/code-server/values.yaml | 2 ++ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/charts/code-server/templates/deployment.yaml b/charts/code-server/templates/deployment.yaml index 60caa3307..e1036291c 100644 --- a/charts/code-server/templates/deployment.yaml +++ b/charts/code-server/templates/deployment.yaml @@ -126,19 +126,31 @@ spec: volumes: - name: data {{- if .Values.persistence.enabled }} + {{- if not .Values.persistence.hostPath }} persistentVolumeClaim: claimName: {{ .Values.persistence.existingClaim | default (include "code-server.fullname" .) }} + {{- else }} + hostPath: + path: {{ .Values.persistence.hostPath }} + type: Directory + {{- end -}} {{- else }} emptyDir: {} {{- end -}} {{- range .Values.extraSecretMounts }} - - name: {{ .name }} - secret: - secretName: {{ .secretName }} - defaultMode: {{ .defaultMode }} + - name: {{ .name }} + secret: + secretName: {{ .secretName }} + defaultMode: {{ .defaultMode }} {{- end }} {{- range .Values.extraVolumeMounts }} - - name: {{ .name }} - persistentVolumeClaim: - claimName: {{ .existingClaim }} + - name: {{ .name }} + {{- if .existingClaim }} + persistentVolumeClaim: + claimName: {{ .existingClaim }} + {{- else }} + hostPath: + path: {{ .hostPath }} + type: Directory + {{- end }} {{- end }} diff --git a/charts/code-server/templates/pvc.yaml b/charts/code-server/templates/pvc.yaml index f29301477..2f1c87405 100644 --- a/charts/code-server/templates/pvc.yaml +++ b/charts/code-server/templates/pvc.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +{{- if and (and .Values.persistence.enabled (not .Values.persistence.existingClaim)) (not .Values.persistence.hostPath) }} kind: PersistentVolumeClaim apiVersion: v1 metadata: diff --git a/charts/code-server/values.yaml b/charts/code-server/values.yaml index 182116546..eff180351 100644 --- a/charts/code-server/values.yaml +++ b/charts/code-server/values.yaml @@ -115,6 +115,7 @@ persistence: size: 1Gi annotations: {} # existingClaim: "" + # hostPath: /data serviceAccount: create: true @@ -152,6 +153,7 @@ extraVolumeMounts: [] # mountPath: /mnt/volume # readOnly: true # existingClaim: volume-claim + # hostPath: "" extraConfigmapMounts: [] # - name: certs-configmap From 83465a2f4f8475b3c7ff2b3665066ed1fcc9f414 Mon Sep 17 00:00:00 2001 From: Hossam Hammady Date: Mon, 12 Oct 2020 12:50:43 +0000 Subject: [PATCH 14/19] Simplify data volume mount --- charts/code-server/templates/deployment.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/charts/code-server/templates/deployment.yaml b/charts/code-server/templates/deployment.yaml index e1036291c..9364a4706 100644 --- a/charts/code-server/templates/deployment.yaml +++ b/charts/code-server/templates/deployment.yaml @@ -74,11 +74,7 @@ spec: {{- end }} volumeMounts: - name: data - mountPath: /home/coder/project - subPath: project - - name: data - mountPath: /home/coder/.local/share/code-server - subPath: code-server + mountPath: /home/coder {{- range .Values.extraConfigmapMounts }} - name: {{ .name }} mountPath: {{ .mountPath }} From 77c2a72cf8b5f0c800a2c8d53b219b877b3b9fe0 Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Tue, 10 Nov 2020 20:07:38 +0000 Subject: [PATCH 15/19] Bump version and update README --- charts/code-server/README.md | 10 +++------- charts/code-server/values.yaml | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/charts/code-server/README.md b/charts/code-server/README.md index 0044909c0..f6cca84f0 100644 --- a/charts/code-server/README.md +++ b/charts/code-server/README.md @@ -1,6 +1,6 @@ # code-server -![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.5.0](https://img.shields.io/badge/AppVersion-3.5.0-informational?style=flat-square) +![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.6.2](https://img.shields.io/badge/AppVersion-3.6.2-informational?style=flat-square) [code-server](https://github.com/cdr/code-server) code-server is VS Code running on a remote server, accessible through the browser. @@ -9,7 +9,7 @@ on a remote server, accessible through the browser. ```console $ git clone https://github.com/cdr/code-server.git -$ helm install deployment/chart +$ helm install code-server/charts/code-server ``` ## Introduction @@ -27,7 +27,7 @@ package manager. To install the chart with the release name `my-release`: ```console -$ helm install --name my-release deployment/chart +$ helm install --name my-release charts/code-server ``` The command deploys code-server on the Kubernetes cluster in the default @@ -49,10 +49,6 @@ deletes the release. ## Configuration -The following table lists the configurable parameters of the nginx-ingress chart -and their default values. - - The following table lists the configurable parameters of the code-server chart and their default values. diff --git a/charts/code-server/values.yaml b/charts/code-server/values.yaml index eff180351..5cc74185d 100644 --- a/charts/code-server/values.yaml +++ b/charts/code-server/values.yaml @@ -6,7 +6,7 @@ replicaCount: 1 image: repository: codercom/code-server - tag: '3.5.0' + tag: '3.6.2' pullPolicy: Always imagePullSecrets: [] From 03aa7709cad0d041caf0e6dcf4b29f374ec3ee9b Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Tue, 10 Nov 2020 20:09:13 +0000 Subject: [PATCH 16/19] Add maintainers --- charts/code-server/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/code-server/README.md b/charts/code-server/README.md index f6cca84f0..b9162b65d 100644 --- a/charts/code-server/README.md +++ b/charts/code-server/README.md @@ -5,6 +5,8 @@ [code-server](https://github.com/cdr/code-server) code-server is VS Code running on a remote server, accessible through the browser. +This chart is community maintained by [@Matthew-Beckett](https://github.com/Matthew-Beckett) and [@alexgorbatchev](https://github.com/alexgorbatchev) + ## TL;DR; ```console From 0e39bb9f2c31d04f0d6ec8a4da505afd82931207 Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Tue, 10 Nov 2020 20:09:48 +0000 Subject: [PATCH 17/19] Fix trailing line breaks --- charts/code-server/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/charts/code-server/README.md b/charts/code-server/README.md index b9162b65d..e0a9aa63c 100644 --- a/charts/code-server/README.md +++ b/charts/code-server/README.md @@ -112,5 +112,3 @@ $ helm install --name my-release -f values.yaml deployment/chart ``` > **Tip**: You can use the default [values.yaml](values.yaml) - - From 10799aa1eca3bb92134224a609f999330c1fbb2c Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Tue, 10 Nov 2020 20:10:50 +0000 Subject: [PATCH 18/19] Bump chart app version --- charts/code-server/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/code-server/Chart.yaml b/charts/code-server/Chart.yaml index ba9281ab8..28f98f000 100644 --- a/charts/code-server/Chart.yaml +++ b/charts/code-server/Chart.yaml @@ -20,4 +20,4 @@ version: 1.0.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 3.5.0 +appVersion: 3.6.2 From aa7415a479e61c294f858ae3ecd71197f9b2415d Mon Sep 17 00:00:00 2001 From: Matthew Beckett Date: Tue, 10 Nov 2020 20:37:14 +0000 Subject: [PATCH 19/19] Update CODEOWNERS file --- .github/CODEOWNERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c68d7da5e..a66dcc9ef 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,2 @@ -* @code-asher @nhooyr +charts/code-server @Matthew-Beckett @alexgorbatchev +* @code-asher @nhooyr \ No newline at end of file