Skip to content

Commit

Permalink
Merge pull request #9 from BuoyantIO/flynn/chart-improvements
Browse files Browse the repository at this point in the history
Chart improvements
  • Loading branch information
kflynn authored Mar 20, 2024
2 parents 32df45c + 0f97ecf commit aa2a8c5
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 9 deletions.
21 changes: 13 additions & 8 deletions assets/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -876,20 +876,25 @@ <H1>Faces</H1>
class Key {
constructor(keyDiv) {
let keyEntries = [
[ "smiling", "green", "grey", "24px", "Success!" ],
[ "confused", "red", "grey", "", "Face service error" ],
[ "sleeping", "pink", "grey", "", "Timeout" ],
[ "kaboom", "red", "grey", "24px", "Service overwhelmed" ],
[ "smiling", "grey", "red", "", "Color service error" ],
[ "cursing", "green", "red", "24px", "Smiley service error" ],
[ "-", "-", "-", "", "Slow service" ]
[ "smiling", "blue", "grey", "24px", "Success!" ],
[ "confused", "red", "grey", "", "Face service error" ],
[ "sleeping", "pink", "grey", "", "Timeout" ],
[ "kaboom", "red", "grey", "24px", "Service overwhelmed" ],
[ "smiling", "grey", "transparent", "", "Color service error" ],
[ "", "blue", "red", "24px", "Smiley service error" ],
[ "-", "-", "-", "", "Slow service" ]
]

for (let i = 0; i < keyEntries.length; i++) {
let [ smileyName, bgColor, borderColor, margin, text ] = keyEntries[i]

if (smileyName != "-") {
let smiley = Cell.smilies[smileyName]
let smiley = ""

if (smileyName != "") {
smiley = Cell.smilies[smileyName]
}

let style = `background: ${bgColor}; border: 2px solid ${borderColor};`

if (margin) {
Expand Down
31 changes: 31 additions & 0 deletions faces-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@
{{- include "partials.select-errorFraction" (dict "source" .Values.color "default" .Values.backend) -}}
{{- end -}}

{{- define "partials.color2-image" -}}
{{- include "partials.select-image" (dict "source" .Values.color2 "default" .Values.backend "root" .) -}}
{{- end -}}

{{- define "partials.color2-imagePullPolicy" -}}
{{- include "partials.select-imagePullPolicy" (dict "source" .Values.color2 "default" .Values.backend "root" .) -}}
{{- end -}}

{{- define "partials.color2-delayBuckets" -}}
{{- include "partials.select-delayBuckets" (dict "source" .Values.color2 "default" .Values.backend) -}}
{{- end -}}

{{- define "partials.color2-errorFraction" -}}
{{- include "partials.select-errorFraction" (dict "source" .Values.color2 "default" .Values.backend) -}}
{{- end -}}

{{- define "partials.smiley-image" -}}
{{- include "partials.select-image" (dict "source" .Values.smiley "default" .Values.backend "root" .) -}}
{{- end -}}
Expand All @@ -123,3 +139,18 @@
{{- include "partials.select-errorFraction" (dict "source" .Values.smiley "default" .Values.backend) -}}
{{- end -}}

{{- define "partials.smiley2-image" -}}
{{- include "partials.select-image" (dict "source" .Values.smiley2 "default" .Values.backend "root" .) -}}
{{- end -}}

{{- define "partials.smiley2-imagePullPolicy" -}}
{{- include "partials.select-imagePullPolicy" (dict "source" .Values.smiley2 "default" .Values.backend "root" .) -}}
{{- end -}}

{{- define "partials.smiley2-delayBuckets" -}}
{{- include "partials.select-delayBuckets" (dict "source" .Values.smiley2 "default" .Values.backend) -}}
{{- end -}}

{{- define "partials.smiley2-errorFraction" -}}
{{- include "partials.select-errorFraction" (dict "source" .Values.smiley2 "default" .Values.backend) -}}
{{- end -}}
2 changes: 2 additions & 0 deletions faces-chart/templates/color.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ spec:
env:
- name: FACES_SERVICE
value: "color"
- name: COLOR
value: {{ .Values.color.color }}
{{- include "partials.color-errorFraction" . }}
{{- include "partials.color-delayBuckets" . }}
resources:
Expand Down
52 changes: 52 additions & 0 deletions faces-chart/templates/color2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{- if .Values.color2.enabled -}}
---
apiVersion: v1
kind: Service
metadata:
name: color2
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
selector:
service: color2
ports:
- port: 80
targetPort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: color2
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
service: color2
template:
metadata:
labels:
service: color2
spec:
containers:
- name: color2
image: {{ include "partials.color2-image" . }}
imagePullPolicy: {{ include "partials.color2-imagePullPolicy" . }}
ports:
- name: http
containerPort: 8000
env:
- name: FACES_SERVICE
value: "color"
- name: COLOR
value: {{ .Values.color2.color }}
{{- include "partials.color2-errorFraction" . }}
{{- include "partials.color2-delayBuckets" . }}
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 250m
memory: 128Mi
{{- end -}}
2 changes: 2 additions & 0 deletions faces-chart/templates/smiley.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ spec:
env:
- name: FACES_SERVICE
value: "smiley"
- name: SMILEY
value: {{ .Values.smiley.smiley }}
{{- include "partials.smiley-errorFraction" . }}
{{- include "partials.smiley-delayBuckets" . }}
resources:
Expand Down
52 changes: 52 additions & 0 deletions faces-chart/templates/smiley2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{- if .Values.smiley2.enabled -}}
---
apiVersion: v1
kind: Service
metadata:
name: smiley2
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
selector:
service: smiley2
ports:
- port: 80
targetPort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: smiley2
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
service: smiley2
template:
metadata:
labels:
service: smiley2
spec:
containers:
- name: smiley2
image: {{ include "partials.smiley2-image" . }}
imagePullPolicy: {{ include "partials.smiley2-imagePullPolicy" . }}
ports:
- name: http
containerPort: 8000
env:
- name: FACES_SERVICE
value: "smiley"
- name: SMILEY
value: {{ .Values.smiley2.smiley }}
{{- include "partials.smiley2-errorFraction" . }}
{{- include "partials.smiley2-delayBuckets" . }}
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 250m
memory: 128Mi
{{ end }}
24 changes: 23 additions & 1 deletion faces-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
defaultImageTag: "" # If not set, uses the appVersion

# Default imagePullPolicy. This is used only if not set in the sections below.
defaultImagePullPolicy: Always
defaultImagePullPolicy: IfNotPresent

gui:
image: "" # If set, overrides the imageName/imageTag pair
Expand Down Expand Up @@ -39,6 +39,17 @@ smiley:
imagePullPolicy: "" # If not set, uses backend.imagePullPolicy
errorFraction: "" # If not set, uses backend.errorFraction
delayBuckets: "" # If not set, uses backend.delayBuckets
smiley: "Smiling" # Override if desired

smiley2:
enabled: False # If set to True, enables the second smiley workload
image: "" # If set, overrides the imageName/imageTag pair
imageName: "" # If not set, uses backend.imageName
imageTag: "" # If not set, uses backend.imageTag
imagePullPolicy: "" # If not set, uses backend.imagePullPolicy
errorFraction: "" # If not set, uses backend.errorFraction
delayBuckets: "" # If not set, uses backend.delayBuckets
smiley: "HeartEyes" # Override if desired

color:
image: "" # If set, overrides the imageName/imageTag pair
Expand All @@ -47,3 +58,14 @@ color:
imagePullPolicy: "" # If not set, uses backend.imagePullPolicy
errorFraction: "" # If not set, uses backend.errorFraction
delayBuckets: "" # If not set, uses backend.delayBuckets
color: "blue" # Override if desired

color2:
enabled: False # If set to True, enables the second color workload
image: "" # If set, overrides the imageName/imageTag pair
imageName: "" # If not set, uses backend.imageName
imageTag: "" # If not set, uses backend.imageTag
imagePullPolicy: "" # If not set, uses backend.imagePullPolicy
errorFraction: "" # If not set, uses backend.errorFraction
delayBuckets: "" # If not set, uses backend.delayBuckets
color: "orange" # Override if desired

0 comments on commit aa2a8c5

Please sign in to comment.