Skip to content

Commit d045c7d

Browse files
committed
feat: add basic helm chart
1 parent 7df5827 commit d045c7d

File tree

8 files changed

+283
-0
lines changed

8 files changed

+283
-0
lines changed

helm/.helmignore

Lines changed: 23 additions & 0 deletions
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/

helm/Chart.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: v2
2+
name: coder
3+
description: Remote development environments on your infrastructure.
4+
home: https://github.com/coder/coder
5+
6+
# version and appVersion are injected at release.
7+
type: application
8+
version: "0.1.0"
9+
appVersion: "0.1.0"
10+
11+
# Coder has a hard requirement on Kubernetes 1.19, as this version
12+
# introduced the networking.k8s.io/v1 API for the Ingress and
13+
# NetworkPolicy resources.
14+
#
15+
# Additionally, the NOTES.txt file emits a warning if the cluster
16+
# version is outside our soft requirement, in accordance with our
17+
# official support policy.
18+
kubeVersion: ">= 1.19.0-0"
19+
20+
keywords:
21+
- coder
22+
- terraform
23+
sources:
24+
- https://github.com/coder/coder/tree/main/helm
25+
icon: https://helm.coder.com/coder_logo_black.png
26+
maintainers:
27+
- name: Coder Technologies, Inc.
28+
email: support@coder.com
29+
url: https://coder.com/contact

helm/templates/NOTES.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- if not (semverCompare ">= 1.21.0-0" .Capabilities.KubeVersion.Version) -}}
2+
============================== KUBERNETES SUPPORT ==============================
3+
4+
NOTICE: Coder follows the Kubernetes upstream version support policy, and the
5+
latest stable release version of Coder supports the previous two minor releases
6+
as well as the current release of Kubernetes at time of publication.
7+
8+
Your Kubernetes version is: {{ .Capabilities.KubeVersion }}
9+
10+
Coder {{ .Chart.AppVersion }} requires Kubernetes >= 1.21
11+
12+
Coder cannot provide any guarantees of compatibility nor technical support for
13+
this version of Kubernetes.
14+
15+
============================== KUBERNETES SUPPORT ==============================
16+
{{- end -}}

helm/templates/_helpers.tpl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "coder.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create chart name and version as used by the chart label.
10+
*/}}
11+
{{- define "coder.chart" -}}
12+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
13+
{{- end }}
14+
15+
{{/*
16+
Common labels
17+
*/}}
18+
{{- define "coder.labels" -}}
19+
helm.sh/chart: {{ include "coder.chart" . }}
20+
{{ include "coder.selectorLabels" . }}
21+
{{- if .Chart.AppVersion }}
22+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
23+
{{- end }}
24+
app.kubernetes.io/managed-by: {{ .Release.Service }}
25+
{{- end }}
26+
27+
{{/*
28+
Selector labels
29+
*/}}
30+
{{- define "coder.selectorLabels" -}}
31+
app.kubernetes.io/name: {{ include "coder.name" . }}
32+
app.kubernetes.io/instance: {{ .Release.Name }}
33+
{{- end }}

helm/templates/deployment.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: coder
5+
labels:
6+
{{- include "coder.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.coder.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "coder.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
labels:
15+
{{- include "coder.selectorLabels" . | nindent 8 }}
16+
spec:
17+
restartPolicy: Always
18+
terminationGracePeriodSeconds: 300
19+
containers:
20+
- name: coder
21+
image: "{{ .Values.coder.image.repo }}:{{ .Values.coder.image.tag | default .Chart.AppVersion }}"
22+
imagePullPolicy: {{ .Values.coder.image.pullPolicy }}
23+
resources:
24+
{{- toYaml .Values.resources | nindent 12 }}
25+
env:
26+
- name: CODER_ADDRESS
27+
value: "0.0.0.0:80"
28+
{{- if .Values.coder.tls.secretName }}
29+
- name: CODER_TLS_ENABLE
30+
value: "true"
31+
- name: CODER_TLS_CERT_FILE
32+
value: /etc/ssl/certs/coder/tls.crt
33+
- name: CODER_TLS_KEY_FILE
34+
value: /etc/ssl/certs/coder/tls.key
35+
{{- end }}
36+
{{- with .Values.coder.env -}}
37+
{{ toYaml . | nindent 12 }}
38+
{{- end }}
39+
ports:
40+
- name: http
41+
containerPort: 80
42+
protocol: TCP
43+
readinessProbe:
44+
httpGet:
45+
path: /
46+
port: http
47+
livenessProbe:
48+
httpGet:
49+
path: /
50+
port: http

helm/templates/ingress.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if .Values.coder.ingress.enable }}
2+
---
3+
apiVersion: networking.k8s.io/v1
4+
kind: Ingress
5+
metadata:
6+
name: coder
7+
labels:
8+
{{- include "coder.labels" . | nindent 4 }}
9+
spec:
10+
{{- if .Values.coder.ingress.className }}
11+
{{/* If this is set to an empty string it fails validation on K8s */}}
12+
ingressClassName: {{ .Values.coder.ingress.className | quote }}
13+
{{- end }}
14+
rules:
15+
- host: {{ .Values.coder.ingress.host | quote }}
16+
http:
17+
paths:
18+
- path: /
19+
pathType: Prefix
20+
backend:
21+
service:
22+
name: coder
23+
port:
24+
name: http
25+
26+
{{- if .Values.coder.ingress.tls.enable }}
27+
tls:
28+
- hosts:
29+
- {{ .Values.coder.ingress.host | quote }}
30+
secretName: {{ .Values.coder.ingress.tls.secretName | quote}}
31+
{{- end }}
32+
{{- end }}

helm/templates/service.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: coder
5+
labels:
6+
{{- include "coder.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.coder.service.type }}
9+
ports:
10+
- name: http
11+
port: 80
12+
targetPort: http
13+
protocol: TCP
14+
- name: https
15+
port: 443
16+
targetPort: https
17+
protocol: TCP
18+
selector:
19+
{{- include "coder.selectorLabels" . | nindent 4 }}

helm/values.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# coder -- Primary configuration for `coder server`.
2+
coder:
3+
# coder.replicaCount -- The number of Kubernetes deployment replicas.
4+
replicaCount: 1
5+
6+
# coder.image -- The image to use for Coder.
7+
image:
8+
# coder.image.repo -- The repository of the image.
9+
repo: "ghcr.io/coder/coder"
10+
# coder.image.tag -- The tag of the image, defaults to the same version as
11+
# the chart.
12+
tag: "{{.Release.Version}}"
13+
# coder.image.pullPolicy -- The pull policy to use for the image. See:
14+
# https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy
15+
pullPolicy: IfNotPresent
16+
17+
# coder.service -- The Service object to expose for Coder.
18+
service:
19+
# coder.service.type -- The type of service to expose. See:
20+
# https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
21+
type: LoadBalancer
22+
# coder.service.externalTrafficPolicy -- The external traffic policy to use.
23+
# On AWS EKS you may need to change this to "Cluster". See:
24+
# https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip
25+
externalTrafficPolicy: Local
26+
# coder.service.loadBalancerIP -- The IP address of the LoadBalancer. If not
27+
# specified, a new IP will be generated each time the load balancer is
28+
# recreated. It is recommended to manually create a static IP address in
29+
# your cloud and specify it here in production to avoid accidental IP
30+
# address changes.
31+
loadBalancerIP: ""
32+
33+
# coder.ingress -- The Ingress object to expose for Coder.
34+
ingress:
35+
# coder.ingress.enable -- Whether to enable the Ingress.
36+
enable: false
37+
# coder.ingress.className -- The name of the Ingress class to use.
38+
className: ""
39+
# coder.ingress.host -- The hostname to match on.
40+
host: "coder.example.com"
41+
# coder.ingress.tls -- The TLS configuration to use for the Ingress.
42+
tls:
43+
# coder.ingress.tls.enable -- Whether to enable TLS on the Ingress.
44+
enable: false
45+
# coder.ingress.tls.secretName -- The name of the TLS secret to use.
46+
secretName: ""
47+
48+
# coder.tls -- The TLS configuration for Coder.
49+
tls:
50+
# coder.tls.secretName -- The name of the secret containing the TLS
51+
# certificate. The secret should exist in the same namespace as the Helm
52+
# deployment and should be of type "kubernetes.io/tls". The secret will be
53+
# automatically mounted into the pod if specified, and the correct
54+
# "CODER_TLS_*" environment variables will be set for you.
55+
secretName: ""
56+
57+
# coder.resources -- The resources to request for Coder. These are optional
58+
# and are not set by default.
59+
resources: {}
60+
# limits:
61+
# cpu: 100m
62+
# memory: 128Mi
63+
# requests:
64+
# cpu: 100m
65+
# memory: 128Mi
66+
67+
# coder.env -- The environment variables to set for Coder. These can be used
68+
# to configure all aspects of `coder server`. Please see `coder server --help`
69+
# for information about what environment variables can be set.
70+
#
71+
# Note: The following environment variables are set by default and cannot be
72+
# overridden:
73+
# - CODER_ADDRESS: set to 0.0.0.0:80 and cannot be changed.
74+
# - CODER_TLS_ENABLE: set if tls.secretName is not empty.
75+
# - CODER_TLS_CERT_FILE: set if tls.secretName is not empty.
76+
# - CODER_TLS_KEY_FILE: set if tls.secretName is not empty.
77+
env:
78+
- name: CODER_ACCESS_URL
79+
value: "https://coder.example.com"
80+
- name: CODER_PG_CONNECTION_URL
81+
value: "postgres://coder:password@postgres:5432/coder?sslmode=disable"

0 commit comments

Comments
 (0)