Skip to content

Commit 2936c0a

Browse files
committed
refactoring
1 parent 499fdf3 commit 2936c0a

File tree

12 files changed

+71
-52
lines changed

12 files changed

+71
-52
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
# keepup-helm-scraper
22

3-
## TO DO
3+
## Helm Repository
4+
5+
```bash
6+
helm repo add keepup-helm-scraper https://code-tool.github.io/keepup-helm-scraper/
7+
```
8+
9+
Set mandatory variables
10+
```yaml
11+
env:
12+
CLUSTER_NAME: 'unique-name-for-metrics-labels'
13+
API_URL: 'https://keepup.host/helm-cluster'
14+
API_TOKEN: 'api-token-to-access-the-API_URL'
15+
```
16+
17+
Deploy
18+
```bash
19+
helm install keepup-helm-scraper/keepup-helm-scraper
20+
```

charts/helm-scraper/templates/clusterrolebinding.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

charts/helm-scraper/templates/serviceaccount.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

charts/helm-scraper/values.yaml

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
apiVersion: v2
2-
name: helm-scraper
2+
name: keepup-helm-scraper
33
description: A Helm chart for scrape charts release information.
44
type: application
55
version: 0.1.0
6+
appVersion: 0.1.0
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
{{- if .Values.rbac.create }}
12
apiVersion: rbac.authorization.k8s.io/v1
23
kind: ClusterRole
34
metadata:
4-
name: scraper-role
5+
name: {{ .Release.Name }}
56
rules:
67
- apiGroups: [""]
78
resources: ["namespaces", "secrets"]
8-
verbs: ["get", "list"]
9+
verbs: ["get", "list"]
10+
{{- end }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if .Values.rbac.create }}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
name: {{ .Release.Name }}
6+
subjects:
7+
- kind: ServiceAccount
8+
name: {{ .Release.Name }}
9+
namespace: {{ .Release.Namespace }}
10+
roleRef:
11+
kind: ClusterRole
12+
name: {{ .Release.Name }}
13+
apiGroup: rbac.authorization.k8s.io
14+
{{- end }}
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
apiVersion: batch/v1
22
kind: CronJob
33
metadata:
4-
name: helm-release-scraper
5-
namespace: default
4+
name: {{ .Release.Name }}
65
spec:
76
schedule: "{{ .Values.cronjob.schedule }}"
87
successfulJobsHistoryLimit: 3
@@ -11,16 +10,18 @@ spec:
1110
spec:
1211
template:
1312
spec:
14-
serviceAccountName: {{ .Values.serviceAccount.name }}
13+
{{- if .Values.rbac.create }}
14+
serviceAccountName: {{ .Release.Name }}
15+
{{- end }}
1516
restartPolicy: {{ .Values.cronjob.restartPolicy }}
1617
containers:
1718
- name: helm-scraper
18-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
19+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
1920
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
21+
{{- if .Values.env }}
2022
env:
21-
- name: CLUSTER_NAME
22-
value: "{{ .Values.cluster.name }}"
23-
- name: API_URL
24-
value: "{{ .Values.api.url }}"
25-
- name: API_TOKEN
26-
value: "{{ .Values.api.token }}"
23+
{{- range $name, $value := .Values.env }}
24+
- name: {{ $name }}
25+
value: {{ $value }}
26+
{{- end }}
27+
{{- end }}

0 commit comments

Comments
 (0)