Skip to content

Commit e905088

Browse files
committed
charts/cron-hpa/
1 parent 7a7c3f6 commit e905088

13 files changed

Lines changed: 651 additions & 0 deletions

File tree

charts/cron-hpa/.helmignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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/
23+
# additional files
24+
tests/
25+
*.ignore.yaml
26+
README.md

charts/cron-hpa/Chart.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apiVersion: v2
2+
name: cron-hpa
3+
version: 0.0.1
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{- range $jobName, $params := .Values.managedHPA }}
2+
apiVersion: batch/v1
3+
kind: CronJob
4+
metadata:
5+
name: {{ $jobName }}
6+
spec:
7+
schedule: {{ $.Values.cronSchedule | quote }}
8+
concurrencyPolicy: "Replace"
9+
startingDeadlineSeconds: 200
10+
suspend: false
11+
successfulJobsHistoryLimit: 1
12+
failedJobsHistoryLimit: 1
13+
jobTemplate:
14+
spec:
15+
template:
16+
spec:
17+
serviceAccountName: cron-hpa
18+
containers:
19+
- name: cron-hpa
20+
image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Capabilities.KubeVersion }}"
21+
imagePullPolicy: {{ $.Values.image.pullPolicy }}
22+
automountServiceAccountToken: false
23+
command:
24+
- /bin/sh
25+
- -c
26+
- {{ printf "kubectl patch hpa %s -p '{\"spec\":{\"minReplicas\":%s, \"maxReplicas\":%s}}'" $params.name $params.minReplicas $params.maxReplicas }}
27+
restartPolicy: OnFailure
28+
---
29+
{{- end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
kind: Role
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
metadata:
4+
name: cron-hpa
5+
rules:
6+
- apiGroups: ["autoscaling"]
7+
resources: ["horizontalpodautoscalers", "horizontalpodautoscalers/status"]
8+
verbs: ["get", "patch", "list", "watch", "update"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: RoleBinding
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
metadata:
4+
name: cron-hpa
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: Role
8+
name: cron-hpa
9+
subjects:
10+
- kind: ServiceAccount
11+
name: cron-hpa
12+
namespace: {{ .Release.Namespace }}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
kind: ServiceAccount
2+
apiVersion: v1
3+
metadata:
4+
name: cron-hpa
5+

charts/cron-hpa/tests/go.mod

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
module tests
2+
3+
go 1.21
4+
5+
require (
6+
github.com/gruntwork-io/terratest v0.46.7
7+
github.com/stretchr/testify v1.8.4
8+
)
9+
10+
require (
11+
github.com/aws/aws-sdk-go v1.44.122 // indirect
12+
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
13+
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
14+
github.com/davecgh/go-spew v1.1.1 // indirect
15+
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
16+
github.com/ghodss/yaml v1.0.0 // indirect
17+
github.com/go-errors/errors v1.0.2-0.20180813162953-d98b870cc4e0 // indirect
18+
github.com/go-logr/logr v1.2.3 // indirect
19+
github.com/go-openapi/jsonpointer v0.19.6 // indirect
20+
github.com/go-openapi/jsonreference v0.20.1 // indirect
21+
github.com/go-openapi/swag v0.22.3 // indirect
22+
github.com/go-sql-driver/mysql v1.4.1 // indirect
23+
github.com/gogo/protobuf v1.3.2 // indirect
24+
github.com/golang/protobuf v1.5.3 // indirect
25+
github.com/google/gnostic v0.5.7-v3refs // indirect
26+
github.com/google/go-cmp v0.5.9 // indirect
27+
github.com/google/gofuzz v1.1.0 // indirect
28+
github.com/google/uuid v1.3.0 // indirect
29+
github.com/gruntwork-io/go-commons v0.8.0 // indirect
30+
github.com/hashicorp/errwrap v1.0.0 // indirect
31+
github.com/hashicorp/go-multierror v1.1.0 // indirect
32+
github.com/imdario/mergo v0.3.11 // indirect
33+
github.com/jmespath/go-jmespath v0.4.0 // indirect
34+
github.com/josharian/intern v1.0.0 // indirect
35+
github.com/json-iterator/go v1.1.12 // indirect
36+
github.com/mailru/easyjson v0.7.7 // indirect
37+
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
38+
github.com/mitchellh/go-homedir v1.1.0 // indirect
39+
github.com/moby/spdystream v0.2.0 // indirect
40+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
41+
github.com/modern-go/reflect2 v1.0.2 // indirect
42+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
43+
github.com/pmezard/go-difflib v1.0.0 // indirect
44+
github.com/pquerna/otp v1.2.0 // indirect
45+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
46+
github.com/spf13/pflag v1.0.5 // indirect
47+
github.com/urfave/cli v1.22.2 // indirect
48+
golang.org/x/crypto v0.14.0 // indirect
49+
golang.org/x/net v0.17.0 // indirect
50+
golang.org/x/oauth2 v0.7.0 // indirect
51+
golang.org/x/sys v0.13.0 // indirect
52+
golang.org/x/term v0.13.0 // indirect
53+
golang.org/x/text v0.13.0 // indirect
54+
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
55+
google.golang.org/appengine v1.6.7 // indirect
56+
google.golang.org/protobuf v1.31.0 // indirect
57+
gopkg.in/inf.v0 v0.9.1 // indirect
58+
gopkg.in/yaml.v2 v2.4.0 // indirect
59+
gopkg.in/yaml.v3 v3.0.1 // indirect
60+
k8s.io/api v0.27.2 // indirect
61+
k8s.io/apimachinery v0.27.2 // indirect
62+
k8s.io/client-go v0.27.2 // indirect
63+
k8s.io/klog/v2 v2.90.1 // indirect
64+
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
65+
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
66+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
67+
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
68+
sigs.k8s.io/yaml v1.3.0 // indirect
69+
)

0 commit comments

Comments
 (0)