Skip to content

Commit 88bba2d

Browse files
committed
Chart enchantments
1 parent f4b7ad9 commit 88bba2d

File tree

9 files changed

+170
-45
lines changed

9 files changed

+170
-45
lines changed

charts/kubernetes-event-exporter/Chart.yaml

+2-11
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ apiVersion: v2
22
name: kubernetes-event-exporter
33
description: Export Kubernetes events to multiple destinations with routing and filtering
44
type: application
5-
6-
# This is the chart version. This version number should be incremented each time you make changes
7-
# to the chart and its templates, including the app version.
8-
# Versions are expected to follow Semantic Versioning (https://semver.org/)
9-
version: 0.1.0
10-
11-
# This is the version number of the application being deployed. This version number should be
12-
# incremented each time you make changes to the application. Versions are not expected to
13-
# follow Semantic Versioning. They should reflect the version the application is using.
14-
# It is recommended to use it with quotes.
15-
appVersion: "1.16.0"
5+
version: 0.2.0
6+
appVersion: "v1.1"
167
home: https://github.com/resmoio/kubernetes-event-exporter

charts/kubernetes-event-exporter/README.md

-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ See [App Configuration](../../README.md) for reference.
3030
3131
## Install Chart
3232
33-
Ensure `monitoring` namespace exists
34-
35-
```shell
36-
kubectl create ns monitoring
37-
```
38-
3933
Install chart
4034
4135
```bash

charts/kubernetes-event-exporter/templates/configmap.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ kind: ConfigMap
33
metadata:
44
name: {{ include "kubernetes-event-exporter.fullname" . }}-cfg
55
namespace: {{ template "kubernetes-event-exporter.namespace" . }}
6+
labels:
7+
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
68
data:
79
config.yaml: |
810
{{ .Values.config | indent 4 }}

charts/kubernetes-event-exporter/templates/deployment.yaml

+23-3
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4+
{{- with .Values.deploymentAnnotations }}
5+
annotations:
6+
{{- toYaml . | nindent 4 }}
7+
{{- end }}
48
name: {{ include "kubernetes-event-exporter.fullname" . }}
59
namespace: {{ include "kubernetes-event-exporter.namespace" . }}
10+
labels:
11+
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
12+
{{- with .Values.deploymentLabels }}
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
615
spec:
716
replicas: {{ .Values.replicaCount }}
817
selector:
918
matchLabels:
1019
{{- include "kubernetes-event-exporter.selectorLabels" . | nindent 6 }}
1120
template:
1221
metadata:
13-
{{- with .Values.podAnnotations }}
1422
annotations:
23+
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
24+
{{- with .Values.podAnnotations }}
1525
{{- toYaml . | nindent 8 }}
1626
{{- end }}
1727
labels:
1828
{{- include "kubernetes-event-exporter.selectorLabels" . | nindent 8 }}
1929
spec:
20-
{{- with .Values.imagePullSecrets }}
30+
{{- with .Values.global.imagePullSecrets }}
2131
imagePullSecrets:
2232
{{- toYaml . | nindent 8 }}
2333
{{- end }}
@@ -28,7 +38,7 @@ spec:
2838
- name: {{ .Chart.Name }}
2939
securityContext:
3040
{{- toYaml .Values.securityContext | nindent 12 }}
31-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
41+
image: "{{ .Values.global.imageRegistry | default .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
3242
imagePullPolicy: {{ .Values.image.pullPolicy }}
3343
ports:
3444
- name: metrics
@@ -47,6 +57,9 @@ spec:
4757
volumeMounts:
4858
- mountPath: /data
4959
name: cfg
60+
{{- with .Values.extraVolumeMounts }}
61+
{{- toYaml . | nindent 12 }}
62+
{{- end }}
5063
resources:
5164
{{- toYaml .Values.resources | nindent 12 }}
5265
{{- with .Values.nodeSelector }}
@@ -61,7 +74,14 @@ spec:
6174
tolerations:
6275
{{- toYaml . | nindent 8 }}
6376
{{- end }}
77+
{{- with .Values.topologySpreadConstraints }}
78+
topologySpreadConstraints:
79+
{{- toYaml . | nindent 8 }}
80+
{{- end }}
6481
volumes:
6582
- name: cfg
6683
configMap:
6784
name: {{ include "kubernetes-event-exporter.fullname" . }}-cfg
85+
{{- with .Values.extraVolumes }}
86+
{{- toYaml . | nindent 8 }}
87+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{{- if .Values.rbac.create }}
22
---
33
apiVersion: rbac.authorization.k8s.io/v1
4-
kind: ClusterRole
4+
kind: {{ .Values.rbac.namespaced | ternary "Role" "ClusterRole" }}
55
metadata:
66
name: {{ include "kubernetes-event-exporter.fullname" . }}
7+
labels:
8+
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
79
rules:
8-
- apiGroups: ["*"]
9-
resources: ["*"]
10-
verbs: ["get", "watch", "list"]
10+
{{ toYaml .Values.rbac.rules }}
1111
{{- end -}}

charts/kubernetes-event-exporter/templates/rolebinding.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{{- if .Values.rbac.create }}
22
---
33
apiVersion: rbac.authorization.k8s.io/v1
4-
kind: ClusterRoleBinding
4+
kind: {{ .Values.rbac.namespaced | ternary "RoleBinding" "ClusterRoleBinding" }}
55
metadata:
6-
name: {{ include "kubernetes-event-exporter.fullname" . }}
6+
name: {{ include "kubernetes-event-exporter.fullname" . }}
7+
labels:
8+
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
79
roleRef:
810
apiGroup: rbac.authorization.k8s.io
911
kind: ClusterRole

charts/kubernetes-event-exporter/templates/serviceaccount.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ kind: ServiceAccount
44
metadata:
55
name: {{ include "kubernetes-event-exporter.serviceAccountName" . }}
66
namespace: {{ include "kubernetes-event-exporter.namespace" . }}
7+
labels:
8+
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
79
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{{- if .Values.serviceMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ template "kubernetes-event-exporter.fullname" . }}
6+
{{- if .Values.serviceMonitor.namespace }}
7+
namespace: {{ . }}
8+
{{- else }}
9+
namespace: {{ include "kubernetes-event-exporter.namespace" . }}
10+
{{- end }}
11+
labels:
12+
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
13+
spec:
14+
endpoints:
15+
- port: metrics
16+
{{- if .Values.serviceMonitor.interval }}
17+
interval: {{ .Values.serviceMonitor.interval }}
18+
{{- end }}
19+
{{- if .Values.serviceMonitor.scheme }}
20+
scheme: {{ .Values.serviceMonitor.scheme }}
21+
{{- end }}
22+
{{- if .Values.serviceMonitor.bearerTokenFile }}
23+
bearerTokenFile: {{ .Values.serviceMonitor.bearerTokenFile }}
24+
{{- end }}
25+
{{- if .Values.serviceMonitor.tlsConfig }}
26+
tlsConfig: {{ toYaml .Values.serviceMonitor.tlsConfig | nindent 6 }}
27+
{{- end }}
28+
{{- if .Values.serviceMonitor.scrapeTimeout }}
29+
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
30+
{{- end }}
31+
path: /metrics
32+
honorLabels: {{ .Values.serviceMonitor.honorLabels }}
33+
{{- if .Values.serviceMonitor.metricRelabelings }}
34+
metricRelabelings:
35+
{{- tpl (toYaml .Values.serviceMonitor.metricRelabelings | nindent 4) . }}
36+
{{- end }}
37+
{{- if .Values.serviceMonitor.relabelings }}
38+
relabelings:
39+
{{ toYaml .Values.serviceMonitor.relabelings | nindent 4 }}
40+
{{- end }}
41+
namespaceSelector:
42+
matchNames:
43+
- {{ template "kubernetes-event-exporter.namespace" . }}
44+
selector:
45+
matchLabels:
46+
{{- include "kubernetes-event-exporter.selectorLabels" . | nindent 6 }}
47+
{{- end -}}

charts/kubernetes-event-exporter/values.yaml

+86-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1+
global:
2+
imagePullSecrets: []
3+
14
# Default values for event-exporter.
25
# This is a YAML-formatted file.
36
# Declare variables to be passed into your templates.
47

58
replicaCount: 1
69

710
image:
8-
repository: ghcr.io/resmoio/kubernetes-event-exporter
11+
registry: ghcr.io
12+
repository: resmoio/kubernetes-event-exporter
913
pullPolicy: IfNotPresent
1014
# Overrides the image tag whose default is the chart appVersion.
11-
tag: latest
15+
tag: ""
1216

1317
imagePullSecrets: []
1418
nameOverride: ""
1519
fullnameOverride: ""
1620

21+
## Override the deployment namespace
22+
namespaceOverride: ""
23+
1724
serviceAccount:
1825
# Specifies whether a service account should be created
1926
create: true
@@ -23,21 +30,28 @@ serviceAccount:
2330
# If not set and create is true, a name is generated using the fullname template
2431
name: ""
2532

26-
podAnnotations:
27-
prometheus.io/scrape: 'true'
28-
prometheus.io/port: '2112'
29-
prometheus.io/path: '/metrics'
30-
31-
podSecurityContext: {}
32-
# fsGroup: 2000
33-
34-
securityContext: {}
35-
# capabilities:
36-
# drop:
37-
# - ALL
38-
# readOnlyRootFilesystem: true
39-
# runAsNonRoot: true
40-
# runAsUser: 1000
33+
deploymentAnnotations: { }
34+
deploymentLabels: {}
35+
36+
podAnnotations: {}
37+
# prometheus.io/scrape: 'true'
38+
# prometheus.io/port: '2112'
39+
# prometheus.io/path: '/metrics'
40+
41+
podLabels: {}
42+
43+
podSecurityContext:
44+
runAsNonRoot: true
45+
securityContext:
46+
allowPrivilegeEscalation: false
47+
capabilities:
48+
drop:
49+
- ALL
50+
readOnlyRootFilesystem: true
51+
runAsUser: 65530
52+
runAsGroup: 65530
53+
seccompProfile:
54+
type: RuntimeDefault
4155

4256
service:
4357
type: ClusterIP
@@ -59,12 +73,20 @@ ingress:
5973
# hosts:
6074
# - chart-example.local
6175

62-
## Override the deployment namespace
63-
namespaceOverride: "monitoring"
76+
# -- Additional Volume mounts
77+
extraVolumeMounts: []
78+
79+
# -- Additional Volumes
80+
extraVolumes: []
6481

6582
rbac:
6683
# If true, create & use RBAC resources
6784
create: true
85+
namespaced: false
86+
rules:
87+
- apiGroups: [ "*" ]
88+
resources: [ "*" ]
89+
verbs: [ "get", "watch", "list" ]
6890

6991
resources: {}
7092
# We usually recommend not to specify default resources and to leave this as a conscious
@@ -94,3 +116,48 @@ config: |
94116
receivers:
95117
- name: "dump"
96118
stdout: {}
119+
120+
121+
# Enable this if you're using https://github.com/coreos/prometheus-operator
122+
serviceMonitor:
123+
enabled: false
124+
# namespace: monitoring
125+
126+
# Fallback to the prometheus default unless specified
127+
# interval: 10s
128+
129+
## scheme: HTTP scheme to use for scraping. Can be used with `tlsConfig` for example if using istio mTLS.
130+
# scheme: ""
131+
132+
## tlsConfig: TLS configuration to use when scraping the endpoint. For example if using istio mTLS.
133+
## Of type: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#tlsconfig
134+
# tlsConfig: {}
135+
136+
# bearerTokenFile:
137+
# Fallback to the prometheus default unless specified
138+
# scrapeTimeout: 30s
139+
140+
## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with
141+
## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec
142+
additionalLabels: {}
143+
144+
# Retain the job and instance labels of the metrics pushed to the Pushgateway
145+
# [Scraping Pushgateway](https://github.com/prometheus/pushgateway#configure-the-pushgateway-as-a-target-to-scrape)
146+
honorLabels: true
147+
148+
## Metric relabel configs to apply to samples before ingestion.
149+
## [Metric Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs)
150+
metricRelabelings: []
151+
# - action: keep
152+
# regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
153+
# sourceLabels: [__name__]
154+
155+
## Relabel configs to apply to samples before ingestion.
156+
## [Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config)
157+
relabelings: []
158+
# - sourceLabels: [__meta_kubernetes_pod_node_name]
159+
# separator: ;
160+
# regex: ^(.*)$
161+
# targetLabel: nodename
162+
# replacement: $1
163+
# action: replace

0 commit comments

Comments
 (0)