Skip to content

Commit 015d8b9

Browse files
Add gateway chart
Signed-off-by: Justin Hollingsworth <justin.hollingsworth@coveros.com>
1 parent fa3aa2e commit 015d8b9

File tree

7 files changed

+215
-0
lines changed

7 files changed

+215
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v2
2+
name: codeveros-gateway
3+
description: Codeveros Gateway Helm chart
4+
type: application
5+
version: 0.2.0
6+
appVersion: latest
7+
home: https://coveros.com
8+
maintainers:
9+
- name: justin-coveros
10+
email: justin.hollingsworth@coveros.com
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Thank you for installing {{ .Chart.Name }}.
2+
Your release is named {{ .Release.Name }}.
3+
To learn more about the release, try:
4+
$ helm status {{ .Release.Name }}
5+
$ helm get {{ .Release.Name }}
6+
7+
Get the application URL by running these commands:
8+
{{- if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "codeveros-gateway.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 "ClusterIP" .Values.service.type }}
13+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "codeveros-gateway.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
14+
echo "Visit http://127.0.0.1:8080 to use your application"
15+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
16+
{{- end }}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "codeveros-gateway.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 "codeveros-gateway.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 "codeveros-gateway.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Common labels
36+
*/}}
37+
{{- define "codeveros-gateway.labels" -}}
38+
helm.sh/chart: {{ include "codeveros-gateway.chart" . }}
39+
{{ include "codeveros-gateway.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 "codeveros-gateway.selectorLabels" -}}
50+
app.kubernetes.io/name: {{ include "codeveros-gateway.name" . }}
51+
app.kubernetes.io/instance: {{ .Release.Name }}
52+
{{- end -}}
53+
54+
{{/*
55+
Create Auth Service Endpoint
56+
*/}}
57+
{{- define "codeveros-gateway.authServiceEndpoint" -}}
58+
{{- if .Values.authServiceNameOverride -}}
59+
{{- $serviceName := .Values.authServiceNameOverride | trunc 63 | trimSuffix "-" -}}
60+
{{- printf "http://%s:8080" $serviceName | trunc 63 | trimSuffix "-" -}}
61+
{{- else -}}
62+
{{- $serviceName := printf "%s-%s" .Release.Name .Values.authServiceName | trunc 63 | trimSuffix "-" -}}
63+
{{- printf "http://%s:8080" $serviceName | trunc 63 | trimSuffix "-" -}}
64+
{{- end -}}
65+
{{- end -}}
66+
67+
{{/*
68+
Create Training Service Endpoint
69+
*/}}
70+
{{- define "codeveros-gateway.trainingServiceEndpoint" -}}
71+
{{- if .Values.trainingServiceNameOverride -}}
72+
{{- $serviceName := .Values.trainingServiceNameOverride | trunc 63 | trimSuffix "-" -}}
73+
{{- printf "http://%s:8080" $serviceName | trunc 63 | trimSuffix "-" -}}
74+
{{- else -}}
75+
{{- $serviceName := (printf "%s-%s" .Release.Name .Values.trainingServiceName | trunc 63 | trimSuffix "-") -}}
76+
{{- printf "http://%s:8080" $serviceName | trunc 63 | trimSuffix "-" -}}
77+
{{- end -}}
78+
{{- end -}}
79+
80+
{{/*
81+
Create User Service Endpoint
82+
*/}}
83+
{{- define "codeveros-gateway.userServiceEndpoint" -}}
84+
{{- if .Values.userServiceNameOverride -}}
85+
{{- $serviceName := .Values.userServiceNameOverride | trunc 63 | trimSuffix "-" -}}
86+
{{- printf "http://%s:8080" $serviceName | trunc 63 | trimSuffix "-" -}}
87+
{{- else -}}
88+
{{- $serviceName := (printf "%s-%s" .Release.Name .Values.userServiceName | trunc 63 | trimSuffix "-") -}}
89+
{{- printf "http://%s:8080" $serviceName | trunc 63 | trimSuffix "-" -}}
90+
{{- end -}}
91+
{{- end -}}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "codeveros-gateway.fullname" . }}
5+
labels:
6+
{{- include "codeveros-gateway.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "codeveros-gateway.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
labels:
15+
{{- include "codeveros-gateway.selectorLabels" . | nindent 8 }}
16+
spec:
17+
{{- with .Values.imagePullSecrets }}
18+
imagePullSecrets:
19+
{{- toYaml . | nindent 8 }}
20+
{{- end }}
21+
containers:
22+
- name: {{ .Chart.Name }}
23+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
24+
imagePullPolicy: {{ .Values.image.pullPolicy }}
25+
ports:
26+
- name: http
27+
containerPort: 8080
28+
protocol: TCP
29+
livenessProbe:
30+
httpGet:
31+
path: /health-check
32+
port: http
33+
readinessProbe:
34+
httpGet:
35+
path: /health-check
36+
port: http
37+
env:
38+
- name: TRAINING_SERVICE
39+
value: {{ include "codeveros-gateway.trainingServiceEndpoint" . | quote }}
40+
- name: USER_SERVICE
41+
value: {{ include "codeveros-gateway.userServiceEndpoint" . | quote }}
42+
- name: AUTH_SERVICE
43+
value: {{ include "codeveros-gateway.authServiceEndpoint" . | quote }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "codeveros-gateway.fullname" . }}
5+
labels:
6+
{{- include "codeveros-gateway.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
{{- include "codeveros-gateway.selectorLabels" . | nindent 4 }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: "{{ include "codeveros-gateway.fullname" . }}-test-connection"
5+
labels:
6+
{{- include "codeveros-gateway.labels" . | nindent 4 }}
7+
annotations:
8+
"helm.sh/hook": test
9+
spec:
10+
activeDeadlineSeconds: 60
11+
template:
12+
spec:
13+
containers:
14+
- name: wget
15+
image: busybox
16+
command: ['wget']
17+
args: ['{{ include "codeveros-gateway.fullname" . }}:{{ .Values.service.port }}/health-check']
18+
restartPolicy: Never
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
replicaCount: 1
2+
3+
image:
4+
repository: coveros/codeveros-gateway
5+
pullPolicy: Always
6+
tag: ""
7+
8+
nameOverride: ""
9+
fullnameOverride: ""
10+
imagePullSecrets: []
11+
12+
authServiceNameOverride: ""
13+
userServiceNameOverride: ""
14+
trainingServiceNameOverride: ""
15+
16+
service:
17+
type: ClusterIP
18+
port: 8080
19+
20+
authServiceName: "codeveros-auth-service"
21+
trainingServiceName: "codeveros-training-service"
22+
userServiceName: "codeveros-user-service"

0 commit comments

Comments
 (0)