Skip to content

Commit a70f87f

Browse files
committed
feat(deploy): Create Helm charts
1 parent ec8e8c1 commit a70f87f

File tree

8 files changed

+454
-0
lines changed

8 files changed

+454
-0
lines changed

charts/chisel-operator/.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/

charts/chisel-operator/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: chisel-operator
3+
description: Kubernetes Operator for deploying Chisel reverse proxies
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: 0.1.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+
# It is recommended to use it with quotes.
24+
appVersion: "0.3.0"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "chisel-operator.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "chisel-operator.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "chisel-operator.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "chisel-operator.labels" -}}
37+
helm.sh/chart: {{ include "chisel-operator.chart" . }}
38+
{{ include "chisel-operator.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "chisel-operator.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "chisel-operator.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "chisel-operator.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "chisel-operator.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
2+
3+
{{- if .Values.createCrds }}
4+
apiVersion: apiextensions.k8s.io/v1
5+
kind: CustomResourceDefinition
6+
metadata:
7+
name: exitnodeprovisioners.chisel-operator.io
8+
spec:
9+
group: chisel-operator.io
10+
names:
11+
categories: []
12+
kind: ExitNodeProvisioner
13+
plural: exitnodeprovisioners
14+
shortNames: []
15+
singular: exitnodeprovisioner
16+
scope: Namespaced
17+
versions:
18+
- additionalPrinterColumns: []
19+
name: v1
20+
schema:
21+
openAPIV3Schema:
22+
description: Auto-generated derived type for ExitNodeProvisionerSpec via `CustomResource`
23+
properties:
24+
spec:
25+
description: ExitNodeProvisioner is a custom resource that represents a Chisel exit node provisioner on a cloud provider.
26+
oneOf:
27+
- required:
28+
- DigitalOcean
29+
- required:
30+
- Linode
31+
- required:
32+
- AWS
33+
properties:
34+
AWS:
35+
properties:
36+
auth:
37+
description: Reference to a secret containing the AWS access key ID and secret access key, under the `access_key_id` and `secret_access_key` secret keys
38+
type: string
39+
region:
40+
description: Region ID for the AWS region to provision the exit node in See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
41+
type: string
42+
security_group:
43+
description: Security group name to use for the exit node, uses the default security group if not specified
44+
nullable: true
45+
type: string
46+
size:
47+
default: t2.micro
48+
description: Size for the EC2 instance See https://aws.amazon.com/ec2/instance-types/
49+
type: string
50+
required:
51+
- auth
52+
- region
53+
type: object
54+
DigitalOcean:
55+
properties:
56+
auth:
57+
description: Reference to a secret containing the DigitalOcean API token, under the `DIGITALOCEAN_TOKEN` secret key
58+
type: string
59+
region:
60+
default: ''
61+
description: Region ID of the DigitalOcean datacenter to provision the exit node in If empty, DigitalOcean will randomly select a region for you, which might not be what you want See https://slugs.do-api.dev/
62+
type: string
63+
size:
64+
default: s-1vcpu-1gb
65+
description: Size for the DigitalOcean droplet See https://slugs.do-api.dev/
66+
type: string
67+
ssh_fingerprints:
68+
default: []
69+
description: SSH key fingerprints to add to the exit node
70+
items:
71+
type: string
72+
type: array
73+
required:
74+
- auth
75+
type: object
76+
Linode:
77+
properties:
78+
auth:
79+
description: Name of the secret containing the Linode API token, under the `LINODE_TOKEN` secret key
80+
type: string
81+
region:
82+
description: Region ID of the Linode datacenter to provision the exit node in See https://api.linode.com/v4/regions
83+
type: string
84+
size:
85+
default: g6-nanode-1
86+
description: Size for the Linode instance See https://api.linode.com/v4/linode/
87+
type: string
88+
required:
89+
- auth
90+
- region
91+
type: object
92+
type: object
93+
required:
94+
- spec
95+
title: ExitNodeProvisioner
96+
type: object
97+
served: true
98+
storage: true
99+
subresources: {}
100+
101+
{{- end }}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{{- if .Values.createCrds -}}
2+
3+
apiVersion: apiextensions.k8s.io/v1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
name: exitnodes.chisel-operator.io
7+
spec:
8+
group: chisel-operator.io
9+
names:
10+
categories: []
11+
kind: ExitNode
12+
plural: exitnodes
13+
shortNames: []
14+
singular: exitnode
15+
scope: Namespaced
16+
versions:
17+
- additionalPrinterColumns: []
18+
name: v1
19+
schema:
20+
openAPIV3Schema:
21+
description: Auto-generated derived type for ExitNodeSpec via `CustomResource`
22+
properties:
23+
spec:
24+
description: ExitNode is a custom resource that represents a Chisel exit node. It will be used as the reverse proxy for all services in the cluster.
25+
properties:
26+
auth:
27+
description: Optional authentication secret name to connect to the control plane
28+
nullable: true
29+
type: string
30+
chisel_image:
31+
description: Optional value for the chisel client image used to connect to the chisel server If not provided, jpillora/chisel:latest is used
32+
nullable: true
33+
type: string
34+
default_route:
35+
default: false
36+
description: Optional boolean value for whether to make the exit node the default route for the cluster If true, the exit node will be the default route for the cluster default value is false
37+
type: boolean
38+
external_host:
39+
description: Optional real external hostname/IP of exit node If not provided, the host field will be used
40+
nullable: true
41+
type: string
42+
fingerprint:
43+
description: Optional but highly recommended fingerprint to perform host-key validation against the server's public key
44+
nullable: true
45+
type: string
46+
host:
47+
description: Hostname or IP address of the chisel server
48+
type: string
49+
port:
50+
description: Control plane port of the chisel server
51+
format: uint16
52+
minimum: 0.0
53+
type: integer
54+
required:
55+
- host
56+
- port
57+
type: object
58+
status:
59+
nullable: true
60+
properties:
61+
id:
62+
nullable: true
63+
type: string
64+
ip:
65+
type: string
66+
name:
67+
type: string
68+
provider:
69+
type: string
70+
service_binding:
71+
nullable: true
72+
properties:
73+
name:
74+
type: string
75+
namespace:
76+
type: string
77+
required:
78+
- name
79+
- namespace
80+
type: object
81+
required:
82+
- ip
83+
- name
84+
- provider
85+
type: object
86+
required:
87+
- spec
88+
title: ExitNode
89+
type: object
90+
served: true
91+
storage: true
92+
subresources:
93+
status: {}
94+
95+
{{- end -}}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "chisel-operator.fullname" . }}
5+
labels:
6+
name: {{- include "chisel-operator.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount}}
9+
selector:
10+
matchLabels:
11+
{{- include "chisel-operator.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
{{- with .Values.podAnnotations }}
15+
annotations:
16+
{{- toYaml . | nindent 8 }}
17+
{{- end }}
18+
labels:
19+
{{- include "chisel-operator.selectorLabels" . | nindent 8 }}
20+
spec:
21+
{{- if .Values.serviceAccount.create }}
22+
serviceAccountName: {{ include "chisel-operator.serviceAccountName" . }}
23+
automountServiceAccountToken: true # This is required
24+
{{- end }}
25+
{{- with .Values.imagePullSecrets }}
26+
imagePullSecrets:
27+
{{- toYaml . | nindent 8 }}
28+
{{- end }}
29+
serviceAccountName: {{ include "chisel-operator.serviceAccountName" . }}
30+
containers:
31+
- name: {{ .Chart.Name }}
32+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
33+
imagePullPolicy: {{ .Values.image.pullPolicy }}
34+
resources:
35+
{{- toYaml .Values.resources | nindent 12 }}
36+
37+
{{- with .Values.nodeSelector }}
38+
nodeSelector:
39+
{{- toYaml . | nindent 8 }}
40+
{{- end }}
41+
{{- with .Values.affinity }}
42+
affinity:
43+
{{- toYaml . | nindent 8 }}
44+
{{- end }}
45+
{{- with .Values.tolerations }}
46+
tolerations:
47+
{{- toYaml . | nindent 8 }}
48+
{{- end }}
49+

0 commit comments

Comments
 (0)