Skip to content

Commit a482144

Browse files
authored
Merge pull request #113 from krmichel/master
Add a helm chart
2 parents 0afddc5 + c1d4d02 commit a482144

File tree

15 files changed

+405
-2
lines changed

15 files changed

+405
-2
lines changed

.github/cr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
release-name-template: "helm-chart-{{ .Name }}-{{ .Version }}"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release Helm Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "charts/**"
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
- name: Configure Git
19+
run: |
20+
git config user.name "$GITHUB_ACTOR"
21+
git config user.email "[email protected]"
22+
- name: Run chart-releaser
23+
uses: helm/[email protected]
24+
env:
25+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
26+
with:
27+
config: .github/cr.yaml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/.push-*
44
/.container-*
55
/.dockerfile-*
6+
/.idea/

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ Usage of cluster-proportional-autoscaler:
3030
--max-sync-failures=[0]: Number of consecutive polling failures before exiting. Default value of 0 will allow for unlimited retries.
3131
```
3232

33+
## Installation with helm
34+
35+
Add the cluster-proportional-autoscaler Helm repository:
36+
```sh
37+
helm repo add cluster-proportional-autoscaler https://kubernetes-sigs.github.io/cluster-proportional-autoscaler
38+
helm repo update
39+
```
40+
41+
Then install a release using the chart. The [charts default values file](charts/cluster-proportional-autoscaler/values.yaml) provides some commented out examples for setting some of the values. There are several required values, but helm should fail with messages that indicate which value is missing.
42+
```sh
43+
helm upgrade --install cluster-proportional-autoscaler \
44+
cluster-proportional-autoscaler/cluster-proportional-autoscaler --values <<name_of_your_values_file>>.yaml
45+
```
46+
3347
## Examples
3448
3549
Please try out the examples in [the examples folder](examples/).
@@ -90,9 +104,9 @@ replicas to take care of all 13 cores. Controller will choose the greater one, w
90104
91105
When `includeUnschedulableNodes` is set to `true`, the replicas will scale based on the total number of nodes.
92106
Otherwise, the replicas will only scale based on the number of schedulable nodes (i.e., cordoned and draining nodes are
93-
excluded.)
107+
excluded.)
94108
95-
Either one of the `coresPerReplica` or `nodesPerReplica` could be omitted. All of `min`, `max`,
109+
Either one of the `coresPerReplica` or `nodesPerReplica` could be omitted. All of `min`, `max`,
96110
`preventSinglePointFailure` and `includeUnscheduleableNodes` are optional. If not set, `min` would be default to `1`,
97111
`preventSinglePointFailure` will be default to `false` and `includeUnschedulableNodes` will be default to `false`.
98112
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
22+
.vscode/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v2
2+
name: cluster-proportional-autoscaler
3+
version: 1.0.0
4+
appVersion: 1.8.4
5+
description: This chart is used to deploy an instance of the cluster-proportional-autoscaler.
6+
maintainers:
7+
- name: krmichel
8+
url: https://github.com/krmichel
9+
- name: d-mcd
10+
url: https://github.com/d-mcd
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "cluster-proportional-autoscaler.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "cluster-proportional-autoscaler.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "cluster-proportional-autoscaler.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Common labels
36+
*/}}
37+
{{- define "cluster-proportional-autoscaler.labels" -}}
38+
helm.sh/chart: {{ include "cluster-proportional-autoscaler.chart" . }}
39+
{{ include "cluster-proportional-autoscaler.selectorLabels" . }}
40+
{{- if .Chart.AppVersion }}
41+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
42+
{{- end }}
43+
app.kubernetes.io/managed-by: {{ .Release.Service }}
44+
{{- end -}}
45+
46+
{{/*
47+
Selector labels
48+
*/}}
49+
{{- define "cluster-proportional-autoscaler.selectorLabels" -}}
50+
app.kubernetes.io/name: {{ include "cluster-proportional-autoscaler.name" . }}
51+
app.kubernetes.io/instance: {{ .Release.Name }}
52+
{{- end -}}
53+
54+
{{/*
55+
Create the name of the service account to use
56+
*/}}
57+
{{- define "cluster-proportional-autoscaler.serviceAccountName" -}}
58+
{{- if .Values.serviceAccount.create -}}
59+
{{ default (include "cluster-proportional-autoscaler.fullname" .) .Values.serviceAccount.name }}
60+
{{- else -}}
61+
{{ default "default" .Values.serviceAccount.name }}
62+
{{- end -}}
63+
{{- end -}}
64+
65+
{{/*
66+
Calculate node values based on provided values
67+
*/}}
68+
{{- define "cluster-proportional-autoscaler.nodeLables" -}}
69+
{{- if .Values.options.nodeLabels }}
70+
{{- $labels := list }}
71+
{{- range $k, $v := .Values.options.nodeLabels }}
72+
{{- $labels = mustAppend $labels (printf "%s=%s" $k $v) }}
73+
{{- end }}
74+
{{- join "," $labels }}
75+
{{- end }}
76+
{{- end }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
kind: ClusterRole
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
metadata:
4+
name: {{ include "cluster-proportional-autoscaler.fullname" . }}
5+
labels:
6+
{{- include "cluster-proportional-autoscaler.labels" . | nindent 4 }}
7+
rules:
8+
- apiGroups: [""]
9+
resources: ["nodes"]
10+
verbs: ["list", "watch"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
kind: ClusterRoleBinding
3+
apiVersion: rbac.authorization.k8s.io/v1
4+
metadata:
5+
name: {{ include "cluster-proportional-autoscaler.fullname" . }}
6+
labels:
7+
{{- include "cluster-proportional-autoscaler.labels" . | nindent 4 }}
8+
subjects:
9+
- kind: ServiceAccount
10+
name: {{ include "cluster-proportional-autoscaler.serviceAccountName" . }}
11+
namespace: {{ .Release.Namespace }}
12+
roleRef:
13+
kind: ClusterRole
14+
name: {{ include "cluster-proportional-autoscaler.fullname" . }}
15+
apiGroup: rbac.authorization.k8s.io
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{ $config := pick .Values.config "ladder" "linear" }}
2+
{{ if not $config }}
3+
{{ fail "A config must be supplied for either ladder mode or linear mode" }}
4+
{{- end }}
5+
{{- if and $config.ladder $config.linear }}
6+
{{ fail "You must supply a config for either ladder mode or linear mode but not both" }}
7+
{{- end }}
8+
{{ $key := mustFirst (keys $config) }}
9+
kind: ConfigMap
10+
apiVersion: v1
11+
metadata:
12+
name: {{ include "cluster-proportional-autoscaler.fullname" . }}
13+
namespace: {{ default .Release.Namespace .Values.options.namespace }}
14+
data:
15+
{{ $key }}: |-
16+
{{- get $config $key | mustToJson | nindent 4 }}

0 commit comments

Comments
 (0)