Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Support chart deploy #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/kube-event-exporter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requirements.lock
3 changes: 3 additions & 0 deletions charts/kube-event-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore common backup files
*.swp
*~
4 changes: 4 additions & 0 deletions charts/kube-event-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v2
description: Kube event exporter helm chart
name: kube-event-exporter
version: 0.9
25 changes: 25 additions & 0 deletions charts/kube-event-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

## Kube Event Exporter

This tool allows exporting the often missed Kubernetes events to various outputs so that they can be used for observability or alerting purposes.

## Prerequisites

- Kubernetes 1.14+
- Helm 3.2+

## Installing the Chart

First, download the git repository.

```shell
$ helm install kubeevent -n monitoring ./charts/kube-event-exporter
```

## Configuration
The following tables lists the configurable parameters of the chart and their default values.

| Parameter | Description | Default |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------|
| imagePullSecrets | Image pull secrets. | []
| exporter.config | Config values for exporter | dump to stdout
39 changes: 39 additions & 0 deletions charts/kube-event-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "kubeevent.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "kubeevent.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "kubeevent.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Allow for the ability to override the release name used as a label in many places.
*/}}
{{- define "kubeevent.releaseLabel" -}}
{{- .Values.releaseLabelOverride | default .Release.Name | trunc 63 -}}
{{- end -}}
13 changes: 13 additions & 0 deletions charts/kube-event-exporter/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: "{{ include "kubeevent.fullname" . }}-cfg"
labels:
app: {{ template "kubeevent.name" . }}
chart: {{ template "kubeevent.chart" . }}
release: {{ template "kubeevent.releaseLabel" . }}
data:
config.yaml: |
{{- if .Values.exporter.config }}
{{- toYaml .Values.exporter.config | nindent 4 }}
{{- end }}
47 changes: 47 additions & 0 deletions charts/kube-event-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ include "kubeevent.fullname" . }}"
labels:
app: {{ template "kubeevent.name" . }}
chart: {{ template "kubeevent.chart" . }}
release: {{ template "kubeevent.releaseLabel" . }}
{{- if .Values.exporter.labels }}
{{ toYaml .Values.exporter.labels | indent 4 }}
{{- end }}
{{- if .Values.exporter.annotations }}
annotations:
{{ toYaml .Values.exporter.annotations | indent 4 }}
{{- end }}
spec:
replicas: {{ toYaml .Values.exporter.replicaCount }}
template:
metadata:
labels:
app: {{ template "kubeevent.name" . }}
release: {{ template "kubeevent.releaseLabel" . }}
version: v1
spec:
serviceAccountName: "{{ include "kubeevent.fullname" . }}"
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
containers:
- name: event-exporter
image: "{{ .Values.exporter.repository }}:{{ .Values.exporter.tag }}"
imagePullPolicy: {{ .Values.exporter.imagePullPolicy }}
args:
- -conf=/data/config.yaml
volumeMounts:
- mountPath: /data
name: cfg
volumes:
- name: cfg
configMap:
name: "{{ include "kubeevent.fullname" . }}-cfg"
selector:
matchLabels:
app: {{ template "kubeevent.name" . }}
release: {{ template "kubeevent.releaseLabel" . }}
version: v1
26 changes: 26 additions & 0 deletions charts/kube-event-exporter/templates/roles.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

apiVersion: v1
kind: ServiceAccount
metadata:
name: "{{ include "kubeevent.fullname" . }}"
labels:
app: {{ template "kubeevent.name" . }}
chart: {{ template "kubeevent.chart" . }}
release: {{ template "kubeevent.releaseLabel" . }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: "{{ include "kubeevent.fullname" . }}"
labels:
app: {{ template "kubeevent.name" . }}
chart: {{ template "kubeevent.chart" . }}
release: {{ template "kubeevent.releaseLabel" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
namespace: {{ .Release.Namespace }}
name: "{{ include "kubeevent.fullname" . }}"
22 changes: 22 additions & 0 deletions charts/kube-event-exporter/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

exporter:
annotations: {}
replicaCount: 1
repository: opsgenie/kubernetes-event-exporter
tag: 0.9
imagePullPolicy: IfNotPresent
config:
logLevel: error
logFormat: json
route:
routes:
- match:
- receiver: "dump"
receivers:
- name: "dump"
file:
path: "/dev/stdout"

## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
imagePullSecrets: []
# - name: secretName