-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from BuoyantIO/flynn/chart-work
Rework the Helm chart to make it easier to add more color & smiley backends.
- Loading branch information
Showing
8 changed files
with
322 additions
and
382 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# The backend-* partials are used to grab things with defaults taken first by | ||
# looking in .Values.backend, and then (for image and imagePullPolicy) from | ||
# .Values.defaultImage and .Values.defaultImagePullPolicy if needed. This | ||
# makes sense in that the backend workloads are similar (though honestly, | ||
# backend-image is making less sense now that color has its own image). | ||
# | ||
# params: .root for the root, .which for the name of the workload | ||
{{- define "partials.backend-image" -}} | ||
{{- $source := index .root.Values .which -}} | ||
{{- include "partials.select-image" | ||
(dict "root" .root | ||
"source" $source | ||
"default" .root.Values.backend) -}} | ||
{{- end -}} | ||
|
||
# params: .root for the root, .which for the name of the workload | ||
{{- define "partials.backend-imagePullPolicy" -}} | ||
{{- $source := index .root.Values .which -}} | ||
{{- include "partials.select-key" | ||
(dict "root" .root "source" $source "key" "imagePullPolicy" "default" .root.Values.backend) -}} | ||
{{- end -}} | ||
|
||
# params: .root for the root, .which for the name of the workload | ||
{{- define "partials.backend-delayBuckets" -}} | ||
{{- $source := index .root.Values .which -}} | ||
{{- include "partials.select-env" | ||
(dict "root" .root | ||
"source" $source | ||
"key" "delayBuckets" | ||
"name" "DELAY_BUCKETS" | ||
"default" .root.Values.backend) -}} | ||
{{- end -}} | ||
|
||
# params: .root for the root, .which for the name of the workload | ||
{{- define "partials.backend-errorFraction" -}} | ||
{{- $source := index .root.Values .which -}} | ||
{{- include "partials.select-env" | ||
(dict "root" .root | ||
"source" $source | ||
"key" "errorFraction" | ||
"name" "ERROR_FRACTION" | ||
"default" .root.Values.backend) -}} | ||
{{- end -}} | ||
|
||
# partials.backend does all the heavy lifting for a backend workload | ||
# params: .root for the root, .name for the name of the workload, | ||
# .workload for what kind of workload -- so e.g. you might see "color2" | ||
# for .name, but .workload would still be "color" in that case. | ||
{{- define "partials.backend" -}} | ||
{{- $info := index .root.Values .name -}} | ||
{{- if $info -}} | ||
{{- if $info.enabled }} | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .name | quote }} | ||
namespace: {{ .root.Release.Namespace }} | ||
labels: | ||
service: {{ .name | quote }} | ||
spec: | ||
type: ClusterIP | ||
selector: | ||
service: {{ .name | quote }} | ||
ports: | ||
- port: 80 | ||
targetPort: http | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .name | quote }} | ||
namespace: {{ .root.Release.Namespace }} | ||
labels: | ||
service: {{ .name | quote }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
service: {{ .name | quote }} | ||
template: | ||
metadata: | ||
labels: | ||
service: {{ .name | quote }} | ||
spec: | ||
containers: | ||
- name: {{ .name | quote }} | ||
image: {{ include "partials.backend-image" (dict "root" .root "which" .name) }} | ||
imagePullPolicy: {{ include "partials.backend-imagePullPolicy" (dict "root" .root "which" .name) }} | ||
ports: | ||
- name: http | ||
containerPort: 8000 | ||
env: | ||
- name: FACES_SERVICE | ||
value: {{ .workload | quote }} | ||
- name: USER_HEADER_NAME | ||
value: {{ .root.Values.authHeader | quote }} | ||
{{- if index $info .workload }} | ||
- name: {{ .workload | upper | quote }} | ||
value: {{ index $info .workload }} | ||
{{- end -}} | ||
{{- include "partials.backend-delayBuckets" (dict "root" .root "which" .name) }} | ||
{{- include "partials.backend-errorFraction" (dict "root" .root "which" .name) }} | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 64Mi | ||
limits: | ||
cpu: 250m | ||
memory: 128Mi | ||
{{- end -}} | ||
{{- 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,107 @@ | ||
# The frontend-* partials are used to grab things with no defaults except for | ||
# .Values.defaultImage and .Values.defaultImagePullPolicy for image and | ||
# imagePullPolicy respectively. This is because the frontend workloads (face, | ||
# faces-gui, and the poor-man's ingress if configured) don't really have much | ||
# in common. | ||
# | ||
# params: .root for the root, .which for the name of the workload | ||
{{- define "partials.frontend-image" -}} | ||
{{- $source := index .root.Values .which -}} | ||
{{- include "partials.select-image" | ||
(dict "root" .root | ||
"source" $source) -}} | ||
{{- end -}} | ||
|
||
# params: .root for the root, .which for the name of the workload | ||
{{- define "partials.frontend-imagePullPolicy" -}} | ||
{{- $source := index .root.Values .which -}} | ||
{{- include "partials.select-key" | ||
(dict "root" .root | ||
"source" $source | ||
"key" "imagePullPolicy") -}} | ||
{{- end -}} | ||
|
||
# params: .root for the root, .which for the name of the workload | ||
{{- define "partials.frontend-delayBuckets" -}} | ||
{{- $source := index .root.Values .which -}} | ||
{{- include "partials.select-env" | ||
(dict "root" .root | ||
"source" $source | ||
"key" "delayBuckets" | ||
"name" "DELAY_BUCKETS") -}} | ||
{{- end -}} | ||
|
||
# params: .root for the root, .which for the name of the workload | ||
{{- define "partials.frontend-errorFraction" -}} | ||
{{- $source := index .root.Values .which -}} | ||
{{- include "partials.select-env" | ||
(dict "root" .root | ||
"source" $source | ||
"key" "errorFraction" | ||
"name" "ERROR_FRACTION") -}} | ||
{{- end -}} | ||
|
||
# We use all the above to provide nicer helpers for each of the workloads. | ||
# Given that the frontend workloads are all different enough that it's not | ||
# worth having the equivalent of partials-backend, we need to include a lot | ||
# more partials in the frontend workload templates, so we provide these to | ||
# make them easier to read. | ||
{{- define "partials.gui-image" -}} | ||
{{- include "partials.frontend-image" | ||
(dict "root" . | ||
"which" "gui") -}} | ||
{{- end -}} | ||
|
||
{{- define "partials.gui-imagePullPolicy" -}} | ||
{{- include "partials.frontend-imagePullPolicy" | ||
(dict "root" . | ||
"which" "gui") -}} | ||
{{- end -}} | ||
|
||
{{- define "partials.face-image" -}} | ||
{{- include "partials.frontend-image" | ||
(dict "root" . | ||
"which" "face") -}} | ||
{{- end -}} | ||
|
||
{{- define "partials.face-imagePullPolicy" -}} | ||
{{- include "partials.frontend-imagePullPolicy" | ||
(dict "root" . | ||
"which" "face") -}} | ||
{{- end -}} | ||
|
||
{{- define "partials.face-delayBuckets" -}} | ||
{{- include "partials.frontend-delayBuckets" | ||
(dict "root" . | ||
"which" "face") -}} | ||
{{- end -}} | ||
|
||
{{- define "partials.face-errorFraction" -}} | ||
{{- include "partials.frontend-errorFraction" | ||
(dict "root" . | ||
"which" "face") -}} | ||
{{- end -}} | ||
|
||
{{- define "partials.ingress-image" -}} | ||
{{- include "partials.frontend-image" | ||
(dict "root" . | ||
"which" "ingress") -}} | ||
{{- end -}} | ||
|
||
{{- define "partials.ingress-imagePullPolicy" -}} | ||
{{- include "partials.frontend-imagePullPolicy" | ||
(dict "root" . | ||
"which" "ingress") -}} | ||
{{- end -}} | ||
|
||
{{- define "partials.ingress-delayBuckets" -}} | ||
{{- include "partials.frontend-delayBuckets" | ||
(dict "root" . | ||
"which" "ingress") -}} | ||
{{- end -}} | ||
|
||
{{- define "partials.ingress-errorFraction" -}} | ||
{{- include "partials.frontend-errorFraction" | ||
(dict "root" . | ||
"which" "ingress") -}} | ||
{{- end -}} |
Oops, something went wrong.