Skip to content

Commit

Permalink
try to fix helm
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaakin committed Jul 21, 2023
1 parent 1532ef0 commit 381a75a
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 75 deletions.
15 changes: 12 additions & 3 deletions charts/kubernetes-event-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ apiVersion: v2
name: kubernetes-event-exporter
description: Export Kubernetes events to multiple destinations with routing and filtering
type: application
version: 0.3.0
appVersion: "v1.1"
home: https://github.com/resmoio/kubernetes-event-exporter

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.4.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
home: https://github.com/resmoio/kubernetes-event-exporter
2 changes: 1 addition & 1 deletion charts/kubernetes-event-exporter/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
{{- end }}
7 changes: 1 addition & 6 deletions charts/kubernetes-event-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ helm.sh/chart: {{ include "kubernetes-event-exporter.chart" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/component: metrics
app.kubernetes.io/part-of: {{ template "kubernetes-event-exporter.name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.additionalLabels }}
{{ toYaml .Values.additionalLabels }}
{{- end }}
{{- end }}

{{/*
Expand Down Expand Up @@ -75,4 +70,4 @@ Allow the release namespace to be overridden for multi-namespace deployments in
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
{{- end -}}
4 changes: 1 addition & 3 deletions charts/kubernetes-event-exporter/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
name: {{ include "kubernetes-event-exporter.fullname" . }}-cfg
namespace: {{ template "kubernetes-event-exporter.namespace" . }}
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
data:
config.yaml: |
{{ .Values.config | indent 4 }}
{{ .Values.config | indent 4 }}
40 changes: 29 additions & 11 deletions charts/kubernetes-event-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
{{- with .Values.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ include "kubernetes-event-exporter.fullname" . }}
namespace: {{ include "kubernetes-event-exporter.namespace" . }}
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
{{- with .Values.deploymentLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "kubernetes-event-exporter.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 8 }}
{{- include "kubernetes-event-exporter.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -30,25 +38,28 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
image: "{{ .Values.global.imageRegistry | default .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: metrics
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /metrics
port: metrics
path: /-/healthy
port: http
readinessProbe:
httpGet:
path: /metrics
port: metrics
path: /-/ready
port: http
args:
- -conf=/data/config.yaml
volumeMounts:
- mountPath: /data
name: cfg
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand All @@ -63,7 +74,14 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: cfg
configMap:
name: {{ include "kubernetes-event-exporter.fullname" . }}-cfg
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
4 changes: 1 addition & 3 deletions charts/kubernetes-event-exporter/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: {{ .Values.rbac.namespaced | ternary "Role" "ClusterRole" }}
metadata:
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
name: {{ include "kubernetes-event-exporter.fullname" . }}
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
rules:
{{ toYaml .Values.rbac.rules }}
{{- end -}}
{{- end -}}
6 changes: 3 additions & 3 deletions charts/kubernetes-event-exporter/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{- if .Values.rbac.create }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
kind: {{ .Values.rbac.namespaced | ternary "RoleBinding" "ClusterRoleBinding" }}
metadata:
name: {{ include "kubernetes-event-exporter.fullname" . }}
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
name: {{ include "kubernetes-event-exporter.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -14,4 +14,4 @@ subjects:
- kind: ServiceAccount
namespace: {{ include "kubernetes-event-exporter.namespace" . }}
name: {{ include "kubernetes-event-exporter.fullname" . }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/kubernetes-event-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ spec:
port: {{ .Values.service.port }}
protocol: TCP
selector:
{{- include "kubernetes-event-exporter.selectorLabels" . | indent 4 }}
{{- include "kubernetes-event-exporter.selectorLabels" . | indent 4 }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
name: {{ include "kubernetes-event-exporter.serviceAccountName" . }}
namespace: {{ include "kubernetes-event-exporter.namespace" . }}
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
{{- end }}
{{- end }}
46 changes: 34 additions & 12 deletions charts/kubernetes-event-exporter/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,47 @@
{{- if .Values.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "kubernetes-event-exporter.fullname" . }}
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ . }}
{{- else }}
namespace: {{ include "kubernetes-event-exporter.namespace" . }}
{{- end }}
labels:
{{- include "kubernetes-event-exporter.labels" . | nindent 4 }}
{{- if .Values.serviceMonitor.additionalLabels }}
{{ toYaml .Values.serviceMonitor.additionalLabels }}
{{- end }}
name: {{ include "kubernetes-event-exporter.fullname" . }}
namespace: {{ include "kubernetes-event-exporter.namespace" . }}
spec:
jobLabel: {{ template "kubernetes-event-exporter.fullname" . }}
endpoints:
- port: http
- port: metrics
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
{{- if .Values.serviceMonitor.scheme }}
scheme: {{ .Values.serviceMonitor.scheme }}
{{- end }}
{{- if .Values.serviceMonitor.bearerTokenFile }}
bearerTokenFile: {{ .Values.serviceMonitor.bearerTokenFile }}
{{- end }}
{{- if .Values.serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml .Values.serviceMonitor.tlsConfig | nindent 6 }}
{{- end }}
{{- if .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
{{- if .Values.serviceMonitor.honorLabels }}
honorLabels: true
{{- end }}
{{- end }}
path: /metrics
honorLabels: {{ .Values.serviceMonitor.honorLabels }}
{{- if .Values.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- tpl (toYaml .Values.serviceMonitor.metricRelabelings | nindent 4) . }}
{{- end }}
{{- if .Values.serviceMonitor.relabelings }}
relabelings:
{{ toYaml .Values.serviceMonitor.relabelings | nindent 4 }}
{{- end }}
namespaceSelector:
matchNames:
- {{ template "kubernetes-event-exporter.namespace" . }}
selector:
matchLabels:
{{- include "kubernetes-event-exporter.selectorLabels" . | nindent 6 }}
{{- end }}
{{- end -}}
34 changes: 5 additions & 29 deletions charts/kubernetes-event-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

# -- Additional labels to add to all resources
additionalLabels: {}
# app: kubernetes-events-exporter

serviceAccount:
# Specifies whether a service account should be created
create: true
Expand All @@ -33,15 +29,15 @@ podAnnotations:
prometheus.io/path: '/metrics'

podSecurityContext: {}
# fsGroup: 2000
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
# runAsUser: 1000

service:
type: ClusterIP
Expand All @@ -52,7 +48,7 @@ ingress:
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
Expand Down Expand Up @@ -80,7 +76,7 @@ resources: {}
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# memory: 128Mi

nodeSelector: {}

Expand All @@ -97,24 +93,4 @@ config: |
- receiver: "dump"
receivers:
- name: "dump"
stdout: {}
serviceMonitor:
# -- Enable this if you're using https://github.com/coreos/prometheus-operator
enabled: false
# -- Namespace to deploy the ServiceMonitor
namespace: ""

# -- Fallback to the prometheus default unless specified
interval: 30s

# -- Add custom labels to the ServiceMonitor resource
additionalLabels: {}
# prometheus: kube-prometheus

honorLabels: false

# -- Path to scrape metrics
path: /metrics
# -- Timeout for scrape metrics request
scrapeTimeout: 10s
stdout: {}

0 comments on commit 381a75a

Please sign in to comment.