Skip to content

Commit affa64c

Browse files
authored
Merge pull request #2048 from Matthew-Beckett/feature/helm3
Update Kubernetes Helm Chart
2 parents 5e60305 + aa7415a commit affa64c

15 files changed

+715
-1
lines changed

.github/CODEOWNERS

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
* @code-asher @nhooyr
1+
charts/code-server @Matthew-Beckett @alexgorbatchev
2+
* @code-asher @nhooyr
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Helm Validation
2+
3+
on: [pull_request, issues]
4+
5+
jobs:
6+
validate:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout Repo
10+
uses: actions/checkout@v2
11+
- name: Kubeval Helm Chart
12+
uses: junior/[email protected]
13+
env:
14+
INPUT_KUBERNETES_VERSION: 1.19

charts/code-server/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/code-server/Chart.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v2
2+
name: code-server
3+
description: A Helm chart for cdr/code-server
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 1.0.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
appVersion: 3.6.2

charts/code-server/README.md

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# code-server
2+
3+
![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)
4+
5+
[code-server](https://github.com/cdr/code-server) code-server is VS Code running
6+
on a remote server, accessible through the browser.
7+
8+
This chart is community maintained by [@Matthew-Beckett](https://github.com/Matthew-Beckett) and [@alexgorbatchev](https://github.com/alexgorbatchev)
9+
10+
## TL;DR;
11+
12+
```console
13+
$ git clone https://github.com/cdr/code-server.git
14+
$ helm install code-server/charts/code-server
15+
```
16+
17+
## Introduction
18+
19+
This chart bootstraps a code-server deployment on a
20+
[Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh)
21+
package manager.
22+
23+
## Prerequisites
24+
25+
- Kubernetes 1.6+
26+
27+
## Installing the Chart
28+
29+
To install the chart with the release name `my-release`:
30+
31+
```console
32+
$ helm install --name my-release charts/code-server
33+
```
34+
35+
The command deploys code-server on the Kubernetes cluster in the default
36+
configuration. The [configuration](#configuration) section lists the parameters
37+
that can be configured during installation.
38+
39+
> **Tip**: List all releases using `helm list`
40+
41+
## Uninstalling the Chart
42+
43+
To uninstall/delete the `my-release` deployment:
44+
45+
```console
46+
$ helm delete my-release
47+
```
48+
49+
The command removes all the Kubernetes components associated with the chart and
50+
deletes the release.
51+
52+
## Configuration
53+
54+
The following table lists the configurable parameters of the code-server chart
55+
and their default values.
56+
57+
## Values
58+
59+
| Key | Type | Default | Description |
60+
|-----|------|---------|-------------|
61+
| affinity | object | `{}` | |
62+
| extraArgs | list | `[]` | |
63+
| extraConfigmapMounts | list | `[]` | |
64+
| extraContainers | string | `""` | |
65+
| extraSecretMounts | list | `[]` | |
66+
| extraVars | list | `[]` | |
67+
| extraVolumeMounts | list | `[]` | |
68+
| fullnameOverride | string | `""` | |
69+
| hostnameOverride | string | `""` | |
70+
| image.pullPolicy | string | `"Always"` | |
71+
| image.repository | string | `"codercom/code-server"` | |
72+
| image.tag | string | `"3.5.0"` | |
73+
| imagePullSecrets | list | `[]` | |
74+
| ingress.enabled | bool | `false` | |
75+
| nameOverride | string | `""` | |
76+
| nodeSelector | object | `{}` | |
77+
| persistence.accessMode | string | `"ReadWriteOnce"` | |
78+
| persistence.annotations | object | `{}` | |
79+
| persistence.enabled | bool | `true` | |
80+
| persistence.size | string | `"1Gi"` | |
81+
| podAnnotations | object | `{}` | |
82+
| podSecurityContext | object | `{}` | |
83+
| replicaCount | int | `1` | |
84+
| resources | object | `{}` | |
85+
| securityContext.enabled | bool | `true` | |
86+
| securityContext.fsGroup | int | `1000` | |
87+
| securityContext.runAsUser | int | `1000` | |
88+
| service.port | int | `8443` | |
89+
| service.type | string | `"ClusterIP"` | |
90+
| serviceAccount.create | bool | `true` | |
91+
| serviceAccount.name | string | `nil` | |
92+
| tolerations | list | `[]` | |
93+
| volumePermissions.enabled | bool | `true` | |
94+
| volumePermissions.securityContext.runAsUser | int | `0` | |
95+
96+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm
97+
install`. For example,
98+
99+
```console
100+
$ helm install --name my-release \
101+
--set persistence.enabled=false \
102+
deployment/chart
103+
```
104+
105+
The above command sets the the persistence storage to false.
106+
107+
Alternatively, a YAML file that specifies the values for the above parameters
108+
can be provided while installing the chart. For example,
109+
110+
```console
111+
$ helm install --name my-release -f values.yaml deployment/chart
112+
```
113+
114+
> **Tip**: You can use the default [values.yaml](values.yaml)
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "code-server.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "code-server.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "code-server.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
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}")
19+
echo "Visit http://127.0.0.1:8080 to use your application"
20+
kubectl port-forward $POD_NAME 8080:80
21+
{{- end }}
22+
23+
Administrator credentials:
24+
25+
Password: echo $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "code-server.fullname" . }} -o jsonpath="{.data.password}" | base64 --decode)
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "code-server.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "code-server.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "code-server.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Common labels
36+
*/}}
37+
{{- define "code-server.labels" -}}
38+
helm.sh/chart: {{ include "code-server.chart" . }}
39+
{{ include "code-server.selectorLabels" . }}
40+
{{- if .Chart.AppVersion }}
41+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
42+
{{- end }}
43+
app.kubernetes.io/managed-by: {{ .Release.Service }}
44+
{{- end }}
45+
46+
{{/*
47+
Selector labels
48+
*/}}
49+
{{- define "code-server.selectorLabels" -}}
50+
app.kubernetes.io/name: {{ include "code-server.name" . }}
51+
app.kubernetes.io/instance: {{ .Release.Name }}
52+
{{- end }}
53+
54+
{{/*
55+
Create the name of the service account to use
56+
*/}}
57+
{{- define "code-server.serviceAccountName" -}}
58+
{{- if .Values.serviceAccount.create -}}
59+
{{ default (include "code-server.fullname" .) .Values.serviceAccount.name }}
60+
{{- else -}}
61+
{{ default "default" .Values.serviceAccount.name }}
62+
{{- end -}}
63+
{{- end -}}

0 commit comments

Comments
 (0)