-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[horizontal-pod-autoscalers] Add chart
- Loading branch information
1 parent
90ab24b
commit bf5a2ae
Showing
9 changed files
with
134 additions
and
0 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 |
---|---|---|
|
@@ -39,7 +39,9 @@ jobs: | |
- name: Prepare library charts | ||
run: | | ||
cp charts/cron-jobs/library-ci/*.yaml charts/cron-jobs/templates/ | ||
cp charts/horizontal-pod-autoscalers/library-ci/*.yaml charts/horizontal-pod-autoscalers/templates/ | ||
sed -i 's/library/application/g' charts/cron-jobs/Chart.yaml | ||
sed -i 's/library/application/g' charts/horizontal-pod-autoscalers/Chart.yaml | ||
- name: Test charts | ||
uses: helm/[email protected] | ||
|
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
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,22 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,10 @@ | ||
apiVersion: v2 | ||
name: horizontal-pod-autoscalers | ||
description: Horizontal Pod Autoscalers library | ||
home: https://github.com/wyrihaximusnet/helm-charts | ||
icon: https://helm.wyrihaximus.net/images/charts/horizontal-pod-autoscalers.png | ||
type: library | ||
version: 0.1.0 | ||
maintainers: | ||
- name: WyriHaximus | ||
email: [email protected] |
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,29 @@ | ||
# Horizontal Pod Autoscalers | ||
|
||
<p align="center"> | ||
<img src="https://helm.wyrihaximus.net/images/charts/horizontal-pod-autoscalers.png"> | ||
</p> | ||
|
||
Opinionated helm library chart for easy creation of horizontal pod autoscalers. | ||
|
||
# Example | ||
|
||
Very basic example that uses the current apps fullname and replica count as minimum replicate count, defaults to 1024 as the max replica count: | ||
|
||
```gotemplate | ||
{{- include "horizontal-pod-autoscalers.hpa" (dict "name" (include "default-backend.fullname" .) "replicas" (dict "min" .Values.replicas)) -}} | ||
``` | ||
|
||
The following configuration options are available: | ||
|
||
```yaml | ||
name: your-applications-deployment-name # Required, this MUST match the deployment we're autoscaling | ||
replicas: | ||
min: 2 # Optional, defaults to 2, but strongly suggest making it match the deployment replica count | ||
max: 1024 # Optional, defaults to 1024 | ||
``` | ||
## Opinionated decisions | ||
* 1024 max replica's | ||
* scales when average CPU usage goes above 50% |
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 @@ | ||
replicas: 2 |
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,48 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: default-backend | ||
labels: | ||
app: default-backend | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: default-backend | ||
replicas: {{ .Values.replicas }} | ||
template: | ||
metadata: | ||
annotations: | ||
prometheus.io/scrape: "true" | ||
prometheus.io/port: "9696" | ||
labels: | ||
app: default-backend | ||
spec: | ||
containers: | ||
- name: default-backend | ||
image: "wyrihaximusnet/default-backend:random" | ||
imagePullPolicy: Always | ||
ports: | ||
- name: default-backend | ||
containerPort: 6969 | ||
protocol: TCP | ||
- name: metrics | ||
containerPort: 9696 | ||
protocol: TCP | ||
livenessProbe: | ||
failureThreshold: 6 | ||
httpGet: | ||
path: / | ||
port: metrics | ||
readinessProbe: | ||
failureThreshold: 6 | ||
httpGet: | ||
path: / | ||
port: metrics | ||
startupProbe: | ||
httpGet: | ||
path: / | ||
port: metrics | ||
failureThreshold: 90 | ||
periodSeconds: 1 | ||
{{ include "horizontal-pod-autoscalers.hpa" (dict "name" "default-backend" "replicas" (dict "min" .Values.replicas)) }} |
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,21 @@ | ||
{{- define "horizontal-pod-autoscalers.hpa" }} | ||
--- | ||
apiVersion: autoscaling/v2beta2 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: {{ .name }} | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: {{ .name }} | ||
minReplicas: {{ .replicas.min | default 2 }} | ||
maxReplicas: {{ .replicas.max | default 1024 }} | ||
metrics: | ||
- type: Resource | ||
resource: | ||
name: cpu | ||
target: | ||
type: Utilization | ||
averageUtilization: 50 | ||
{{- end }} |
Empty file.