diff --git a/charts/cluster-warmer/Chart.yaml b/charts/cluster-warmer/Chart.yaml new file mode 100644 index 0000000..523549f --- /dev/null +++ b/charts/cluster-warmer/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +name: cluster-warmer +description: A Helm Chart to deploy pods to force scaling in a node-pool to keep it warm +version: 0.1.0 +icon: https://raw.githubusercontent.com/snowplow-devops/helm-charts/master/docs/logo/snowplow.png +home: https://github.com/snowplow-devops/helm-charts +sources: + - https://github.com/snowplow-devops/helm-charts +maintainers: + - name: jbeemster + url: https://github.com/jbeemster + email: jbeemster@users.noreply.github.com +keywords: + - cluster-autoscaler diff --git a/charts/cluster-warmer/README.md b/charts/cluster-warmer/README.md new file mode 100644 index 0000000..11efc5a --- /dev/null +++ b/charts/cluster-warmer/README.md @@ -0,0 +1,32 @@ +# cluster-warmer + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) + +A Helm Chart to deploy pods to force scaling in a node-pool to keep it warm + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| jbeemster | | | + +## Source Code + +* + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| fullnameOverride | string | `""` | Overrides the full-name given to the deployment resources (default: .Release.Name) | +| hpa.replicas | int | `1` | Number of replicas to setup to manage how many warm nodes are created | +| image.isRepositoryPublic | bool | `true` | Whether the repository is public | +| image.pullPolicy | string | `"IfNotPresent"` | The image pullPolicy to use | +| image.repository | string | `"registry.k8s.io/pause"` | | +| image.tag | string | `"3.9"` | | +| resources | object | `{}` | Map of resource constraints for the warm pods (should be set to a sufficiently high number to trigger scaling) | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) diff --git a/charts/cluster-warmer/templates/_helpers.tpl b/charts/cluster-warmer/templates/_helpers.tpl new file mode 100644 index 0000000..b3e2c0f --- /dev/null +++ b/charts/cluster-warmer/templates/_helpers.tpl @@ -0,0 +1,13 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Create a default fully qualified app name. +We truncate at 50 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 "app.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 50 | trimSuffix "-" -}} +{{- else -}} +{{- .Release.Name | trunc 50 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} diff --git a/charts/cluster-warmer/templates/deployment.yaml b/charts/cluster-warmer/templates/deployment.yaml new file mode 100644 index 0000000..0f7425f --- /dev/null +++ b/charts/cluster-warmer/templates/deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "app.fullname" . }} +spec: + selector: + matchLabels: + app: {{ include "app.fullname" . }} + template: + metadata: + labels: + app: {{ include "app.fullname" . }} + spec: + priorityClassName: {{ include "app.fullname" . }} + terminationGracePeriodSeconds: 0 + containers: + - name: "{{ include "app.fullname" . }}" + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }} + resources: + {{- toYaml .Values.resources | nindent 10 }} diff --git a/charts/cluster-warmer/templates/hpa.yaml b/charts/cluster-warmer/templates/hpa.yaml new file mode 100644 index 0000000..9f5cf38 --- /dev/null +++ b/charts/cluster-warmer/templates/hpa.yaml @@ -0,0 +1,12 @@ +apiVersion: autoscaling/v1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "app.fullname" . }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "app.fullname" . }} + minReplicas: {{ .Values.hpa.replicas }} + maxReplicas: {{ .Values.hpa.replicas }} + targetCPUUtilizationPercentage: 95 diff --git a/charts/cluster-warmer/templates/priorityclass.yaml b/charts/cluster-warmer/templates/priorityclass.yaml new file mode 100644 index 0000000..0b954fa --- /dev/null +++ b/charts/cluster-warmer/templates/priorityclass.yaml @@ -0,0 +1,6 @@ +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: {{ include "app.fullname" . }} +value: -1 +globalDefault: false diff --git a/charts/cluster-warmer/values.yaml b/charts/cluster-warmer/values.yaml new file mode 100644 index 0000000..3dd2cd0 --- /dev/null +++ b/charts/cluster-warmer/values.yaml @@ -0,0 +1,19 @@ +# -- Overrides the full-name given to the deployment resources (default: .Release.Name) +fullnameOverride: "" + +image: + repository: "registry.k8s.io/pause" + tag: "3.9" + # -- Whether the repository is public + isRepositoryPublic: true + # -- The image pullPolicy to use + pullPolicy: "IfNotPresent" + +# -- Map of resource constraints for the warm pods (should be set to a sufficiently high number to trigger scaling) +resources: {} +# requests: +# cpu: 400m + +hpa: + # -- Number of replicas to setup to manage how many warm nodes are created + replicas: 1