Skip to content
Draft

Helm #78

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions charts/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
16 changes: 16 additions & 0 deletions charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v2
name: cluster-thruster
description: A helm chart for the cluster thruster api, which starts the server, aswell as a mongodb instance

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: 0.1.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.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
62 changes: 62 additions & 0 deletions charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cluster-thruster.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 "cluster-thruster.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 "cluster-thruster.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cluster-thruster.labels" -}}
helm.sh/chart: {{ include "cluster-thruster.chart" . }}
{{ include "cluster-thruster.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cluster-thruster.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cluster-thruster.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cluster-thruster.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cluster-thruster.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
34 changes: 34 additions & 0 deletions charts/templates/mongo_db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb-deployment
labels:
app: mongodb
spec:
replicas: 1
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo
ports:
- containerPort: 27017

---
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
selector:
app: mongodb
ports:
- protocol: TCP
port: 27017
targetPort: 27017
15 changes: 15 additions & 0 deletions charts/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "cluster-thruster.fullname" . }}-test-connection"
labels:
{{- include "cluster-thruster.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "cluster-thruster.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
32 changes: 32 additions & 0 deletions charts/templates/thruster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: cluster-thruster
spec:
selector:
matchLabels:
run: cluster-thruster
template:
metadata:
labels:
run: cluster-thruster
spec:
containers:
- name: cluster-thruster
image: cluster-thruster
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: cluster-thruster-external
spec:
clusterIP: 10.102.68.76
type: LoadBalancer
selector:
run: cluster-thruster
ports:
- name: http
protocol: TCP
port: 8080
9 changes: 9 additions & 0 deletions charts/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Default values configuration for the cluster thruster backend.
# Feel free to create your own version according to your requirements
#
# As for naming conventions:
# - start with lower case letters
# - use camelcase
#
# For every property in this file we expect you write a docstring with a short
# explanation on said property
28 changes: 28 additions & 0 deletions skaffold.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: skaffold/v2beta29
kind: Config
metadata:
name: app
build:
artifacts:
- image: cluster-thruster
context: .
deploy:
kubectl:
manifests:
- ./kubernetes/mongo_db.yml
- ./kubernetes/thruster.yml
profiles:
# "gcb" profile allows building and pushing the images
# on Google Container Builder without requiring docker
# installed on the developer machine. However, note that
# since GCB does not cache the builds, each build will
# start from scratch and therefore take a long time.
#
# This is not used by default. To use it, run:
# skaffold run -p gcb
- name: gcb
build:
googleCloudBuild:
diskSizeGb: 300
machineType: N1_HIGHCPU_32
timeout: 4000s