Skip to content

Commit

Permalink
fix: save static build in hyperglass to speed up pod start (#83)
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Ortega <[email protected]>
  • Loading branch information
M0NsTeRRR authored Jul 19, 2024
1 parent a96c47b commit b3380b0
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tgz
6 changes: 6 additions & 0 deletions charts/hyperglass/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: valkey
repository: oci://registry-1.docker.io/bitnamicharts
version: 0.3.10
digest: sha256:bf09d6ee88a17d2e1ea1ba81d494344255d8a0e2b2e7c86f1c5bb85d2c9d9c15
generated: "2024-07-19T09:33:05.049437699+02:00"
2 changes: 1 addition & 1 deletion charts/hyperglass/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kubeVersion: ">=1.23.0-0"
name: hyperglass
description: hyperglass helm chart for Kubernetes
type: application
version: 0.1.8
version: 0.1.9
# image: ghcr.io/m0nsterrr/hyperglass
appVersion: "v2.0.4"
maintainers:
Expand Down
9 changes: 8 additions & 1 deletion charts/hyperglass/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# hyperglass

![Version: 0.1.8](https://img.shields.io/badge/Version-0.1.8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.0.4](https://img.shields.io/badge/AppVersion-v2.0.4-informational?style=flat-square)
![Version: 0.1.9](https://img.shields.io/badge/Version-0.1.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.0.4](https://img.shields.io/badge/AppVersion-v2.0.4-informational?style=flat-square)

hyperglass helm chart for Kubernetes

Expand Down Expand Up @@ -41,6 +41,12 @@ helm repo add adminafk https://helm-charts.adminafk.fr
| autoscaling.maxReplicas | int | `100` | |
| autoscaling.minReplicas | int | `1` | |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| build | object | `{"persistence":{"accessModes":["ReadWriteOnce"],"annotations":{},"enabled":true,"name":"","size":"200Mi","volumeName":""}}` | Creating PVC to store UI build artifact |
| build.persistence.accessModes | list | `["ReadWriteOnce"]` | Access modes of persistent disk |
| build.persistence.annotations | object | `{}` | Annotations for PVCs |
| build.persistence.name | string | `""` | Config name |
| build.persistence.size | string | `"200Mi"` | Size of persistent disk |
| build.persistence.volumeName | string | `""` | Name of the permanent volume to reference in the claim. Can be used to bind to existing volumes. |
| extraEnv | list | `[]` | Environment variables to add to the as212510.net pods |
| extraEnvFrom | list | `[]` | Environment variables from secrets or configmaps to add to the as212510.net pods |
| fullnameOverride | string | `""` | |
Expand Down Expand Up @@ -79,6 +85,7 @@ helm repo add adminafk https://helm-charts.adminafk.fr
| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | If not set and create is true, a name is generated using the fullname template |
| strategy | object | `{"type":"Recreate"}` | Deployment strategy |
| tolerations | list | `[]` | |
| valkey.architecture | string | `"standalone"` | |
| valkey.auth.enabled | bool | `false` | |
Expand Down
7 changes: 7 additions & 0 deletions charts/hyperglass/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,10 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name of the pvc build to use
*/}}
{{- define "hyperglass.buildPersistenceName" -}}
{{- default (printf "%s-build" (include "hyperglass.fullname" .)) .Values.build.persistence.name }}
{{- end }}
19 changes: 17 additions & 2 deletions charts/hyperglass/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
strategy:
type: {{ .Values.strategy.type }}
selector:
matchLabels:
{{- include "hyperglass.selectorLabels" . | nindent 6 }}
Expand Down Expand Up @@ -65,14 +67,27 @@ spec:
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumeMounts }}
{{- if or .Values.build.persistence.enabled .Values.volumeMounts }}
volumeMounts:
{{- if .Values.build.persistence.enabled }}
- name: build
mountPath: /etc/hyperglass/static
{{- end }}
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
{{- end }}
{{- if or .Values.build.persistence.enabled .Values.volumes }}
volumes:
{{- if .Values.build.persistence.enabled }}
- name: build
persistentVolumeClaim:
claimName: {{ include "hyperglass.buildPersistenceName" . }}
{{- end }}
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
22 changes: 22 additions & 0 deletions charts/hyperglass/templates/persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.build.persistence.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "hyperglass.buildPersistenceName" . }}
labels:
{{- include "hyperglass.labels" . | nindent 4 }}
spec:
{{- with .Values.build.persistence.accessModes }}
accessModes:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.build.persistence.volumeName }}
volumeName: {{ .Values.build.persistence.volumeName }}
{{- end }}
{{- with .Values.build.persistence.storageClass }}
storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }}
{{- end }}
resources:
requests:
storage: "{{ .Values.build.persistence.size }}"
{{- end }}
21 changes: 21 additions & 0 deletions charts/hyperglass/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

# -- Deployment strategy
strategy:
type: Recreate

# -- Environment variables to add to the as212510.net pods
extraEnv: []
# -- Environment variables from secrets or configmaps to add to the as212510.net pods
Expand Down Expand Up @@ -72,6 +76,23 @@ service:
type: ClusterIP
port: 80

# -- Creating PVC to store UI build artifact
build:
persistence:
enabled: true
# -- Size of persistent disk
size: 200Mi
# -- Annotations for PVCs
annotations: {}
# -- Access modes of persistent disk
accessModes:
- ReadWriteOnce
# -- Config name
name: ""
# -- Name of the permanent volume to reference in the claim.
# Can be used to bind to existing volumes.
volumeName: ""

ingress:
enabled: false
ingressClassName: ""
Expand Down

0 comments on commit b3380b0

Please sign in to comment.