-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
279 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{{- if ne .Release.Namespace "codezero" }} | ||
{{- fail "The CodeZero LB has to be installed in codezero namespace" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "lb.name" -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if hasSuffix .Values.lb.name $name }} | ||
{{- $name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" $name .Values.lb.name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- 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 "lb.fullname" -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if .Values.fullnameOverride }} | ||
{{- $name = .Values.fullnameOverride }} | ||
{{- else }} | ||
{{- if contains $name .Release.Name }} | ||
{{- $name = .Release.Name }} | ||
{{- else }} | ||
{{- $name = printf "%s-%s" .Release.Name $name }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if hasSuffix .Values.lb.name $name }} | ||
{{- $name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" $name .Values.lb.name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "lb.labels" -}} | ||
{{ include "codezero.labels" . }} | ||
{{ include "lb.selectorLabels" . }} | ||
{{- with .Values.lb.labels }} | ||
{{ . | toYaml }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "lb.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "lb.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Pod labels | ||
*/}} | ||
{{- define "lb.podLabels" -}} | ||
{{ include "codezero.podLabels" . }} | ||
{{ include "lb.selectorLabels" . }} | ||
{{- with .Values.lb.podLabels }} | ||
{{ . | toYaml }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Pod annotations | ||
*/}} | ||
{{- define "lb.podAnnotations" -}} | ||
{{ include "codezero.podAnnotations" . }} | ||
checksum/configmap: {{ include (print .Template.BasePath "/lb/configmap.yaml") . | sha1sum }} | ||
{{- with .Values.lb.podAnnotations }} | ||
{{ . | toYaml }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "lb.serviceAccountName" -}} | ||
{{- if .Values.lb.serviceAccount.create }} | ||
{{- default (include "lb.fullname" .) .Values.lb.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.lb.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "lb.fullname" . }} | ||
labels: | ||
{{- include "lb.labels" . | nindent 4 }} | ||
data: | ||
haproxy.cfg: | | ||
global | ||
log stdout format raw local0 | ||
maxconn 4096 | ||
defaults | ||
log global | ||
timeout client 60s | ||
timeout connect 60s | ||
timeout server 60s | ||
frontend system | ||
bind :8800 ssl crt /etc/ssl/certs/space/server.pem | ||
default_backend system | ||
backend system | ||
server system codezero-system:8800 check | ||
frontend orchestrator | ||
bind :8900 ssl crt /etc/ssl/certs/space/server.pem | ||
default_backend orchestrator | ||
backend orchestrator | ||
server orchestrator codezero-orchestrator:8900 check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "lb.fullname" . }} | ||
labels: | ||
{{- include "lb.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.lb.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "lb.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
{{- include "lb.podAnnotations" . | nindent 8 }} | ||
labels: | ||
{{- include "lb.podLabels" . | nindent 8 }} | ||
spec: | ||
serviceAccountName: {{ include "lb.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.lb.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: {{ include "lb.name" . }} | ||
securityContext: | ||
{{- toYaml .Values.lb.securityContext | nindent 12 }} | ||
image: "haproxytech/haproxy-alpine:{{ .Values.lb.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.lb.image.pullPolicy }} | ||
args: ["-f", "/usr/local/etc/haproxy/haproxy.cfg"] | ||
ports: | ||
- containerPort: 8800 | ||
protocol: TCP | ||
- containerPort: 8900 | ||
protocol: TCP | ||
resources: | ||
{{- toYaml .Values.lb.resources | nindent 12 }} | ||
volumeMounts: | ||
- name: haproxy-config | ||
mountPath: /usr/local/etc/haproxy/haproxy.cfg | ||
subPath: haproxy.cfg | ||
- mountPath: /etc/ssl/certs/space | ||
name: codezero-cert | ||
readOnly: true | ||
volumes: | ||
- name: haproxy-config | ||
configMap: | ||
name: {{ include "lb.fullname" . }} | ||
- name: codezero-cert | ||
secret: | ||
secretName: codezero-cert | ||
{{- with .Values.lb.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.lb.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.lb.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: codezero | ||
labels: | ||
{{- include "lb.labels" . | nindent 4 }} | ||
spec: | ||
type: {{ .Values.lb.service.type }} | ||
ports: | ||
- port: 8800 | ||
targetPort: 8800 | ||
protocol: TCP | ||
name: system-http | ||
- port: 8900 | ||
targetPort: 8900 | ||
protocol: TCP | ||
name: orchestrator-http | ||
selector: | ||
{{- include "lb.selectorLabels" . | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if .Values.lb.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "lb.serviceAccountName" . }} | ||
labels: | ||
{{- include "lb.labels" . | nindent 4 }} | ||
{{- with .Values.lb.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.