Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate New chart with all configration #202

Open
wants to merge 1 commit into
base: main
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: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*.dll
*.so
*.dylib
kwatch

# Test binary, built with `go test -c`
*.test
Expand Down
22 changes: 22 additions & 0 deletions chart/kwatch/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
30 changes: 30 additions & 0 deletions chart/kwatch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v2
name: kwatch
version: "0.8.0"
appVersion: "v0.8.0"
description: monitor all changes in your Kubernetes(K8s) cluster, detects crashes
in your running apps in realtime, and publishes notifications to your channels (Slack,
Discord, etc.) instantly
type: application
home: https://kwatch.dev
icon: https://kwatch.dev/img/kwatch-logo.png
sources:
- https://github.com/abahmed/kwatch
keywords:
- kwatch
- kubernetes
- monitoring
- crash-reporting
- event-notifier
maintainers:
- email: [email protected]
name: Maha Gamal Amer
url: github.com/MahaGamal
- email: [email protected]
name: Abdelrahman Ahmed
url: github.com/abahmed
- email: [email protected]
name: yaser
url: github.com/yaskinny


65 changes: 65 additions & 0 deletions chart/kwatch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Kwatch Helm Chart
monitor all changes in your Kubernetes(K8s) cluster, detects crashes in your running apps in realtime, and publishes notifications to your channels (Slack,
Discord, etc.) instantly

## Add Repository

```console
helm repo add kwatch https://kwatch.dev/charts
helm repo update
```

## Install & Upgrade your Chart

```console
helm install [RELEASE_NAME] kwatch/kwatch
helm upgrade -i [RELEASE_NAME] --install --namespace <ns> ./ [--version CHART-VERSION] --debug

```

## Uninstall Chart

```console
helm delete --purge [RELEASE_NAME]
```

## Configuration

### Using helm starter https://github.com/MahaGamal/helm-starter/tree/main/templates


The following table lists the configurable parameters of the chart and their default values.

Parameter | Description | Default
--- | --- | ---
`image.registry` | server container image registry | ``
`image.repository` | server container image repository | ``
`image.tag` | server container image tag | `v0.8.0`
`image.pullPolicy` | server container image pull policy | `IfNotPresent`
`image.runAsUser` | User ID of the server process. Value depends on the Linux distribution used inside of the container image. | `101`
`server.replicaCount` | desired number of server pods | `1`
`server.httpPort` | The port that the server container listens on for http connections. | `80`
`server.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 10
`server.livenessProbe.periodSeconds` | How often to perform the probe | 10
`server.livenessProbe.timeoutSeconds` | When the probe times out | 5
`server.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | 1
`server.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 3
`server.livenessProbe.port` | The port number that the liveness probe will listen on. | 8080
`server.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | 10
`server.readinessProbe.periodSeconds` | How often to perform the probe | 10
`server.readinessProbe.timeoutSeconds` | When the probe times out | 1
`server.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | 1
`server.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 3
`server.readinessProbe.port` | The port number that the readiness probe will listen on. | 8080
`server.resources` | server pod resource requests & limits | `{}`
`server.envs` | any additional environment variables to set in the pods | `{}`
`server.VolumeMounts` | volumeMounts to the server main container | `{}`
`server.Volumes` | volumes to the server pod | `{}`
`server.tolerations` | node taints to tolerate (requires Kubernetes >=1.6) | `[]`
`server.affinity` | node/pod affinities (requires Kubernetes >=1.6) | `{}`
`server.nodeSelector` | node labels for pod assignment | `{}`
`serviceAccounts.enabled` | if `true`, Create service accounts | `false`
`service.ports.http` | Sets service http port | `80`
`service.type` | type of server service to create | `ClusterIP`
Service Monitoring configurations
`serviceMonitor.enabled` | if `true`, enable Prometheus metrics | `false`
5 changes: 5 additions & 0 deletions chart/kwatch/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{- $fullName := include "kwatch.fullname" . -}}
1. Get the application pod running these commands:
echo "kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "kwatch.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}"


38 changes: 38 additions & 0 deletions chart/kwatch/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "kwatch.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 "kwatch.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 "kwatch.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Release name without chart name
*/}}
{{- define "kwatch.releasePrefix" -}}
{{- printf .Release.Name | replace (printf "-%s" .Chart.Name) "" -}}
{{- end -}}
18 changes: 18 additions & 0 deletions chart/kwatch/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.server.config -}}
apiVersion: v1
kind: ConfigMap
metadata:
metadata:
name: {{ include "kwatch.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ include "kwatch.name" . }}
chart: {{ include "kwatch.chart" . }}
release: {{ .Release.Name }}
helm.sh/chart: {{ include "kwatch.chart" . }}
app.kubernetes.io/name: {{ include "kwatch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
{{{ tpl $value $ | quote}}
{{- end }}
39 changes: 39 additions & 0 deletions chart/kwatch/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ include "kwatch.name" . }}
chart: {{ include "kwatch.chart" . }}
release: {{ .Release.Name }}
helm.sh/chart: {{ include "kwatch.chart" . }}
app.kubernetes.io/name: {{ include "kwatch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
rules:
- apiGroups: [""]
resources: ["pods", "pods/log", "events"]
verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ include "kwatch.name" . }}
chart: {{ include "kwatch.chart" . }}
release: {{ .Release.Name }}
helm.sh/chart: {{ include "kwatch.chart" . }}
app.kubernetes.io/name: {{ include "kwatch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Release.Name }}
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
136 changes: 136 additions & 0 deletions chart/kwatch/templates/server-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{{- $fullName := include "kwatch.fullname" . -}}
{{- $releasePrefix := include "kwatch.releasePrefix" . -}}
{{- $_ := set $.Release "Prefix" $releasePrefix }}
{{- if .Capabilities.APIVersions.Has "apps/v1" }}
apiVersion: apps/v1
{{- else }}
apiVersion: apps/v1beta2
{{- end }}
kind: Deployment
metadata:
name: {{ include "kwatch.fullname" . }}
labels:
app: {{ include "kwatch.name" . }}
chart: {{ include "kwatch.chart" . }}
release: {{ .Release.Name }}
helm.sh/chart: {{ include "kwatch.chart" . }}
app.kubernetes.io/name: {{ include "kwatch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: server
spec:
replicas: {{ .Values.server.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "kwatch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: server
{{- with .Values.server.updateStrategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
labels:
app: {{ include "kwatch.name" . }}
chart: {{ include "kwatch.chart" . }}
release: {{ .Release.Name }}
helm.sh/chart: {{ include "kwatch.chart" . }}
app.kubernetes.io/name: {{ include "kwatch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: server
{{- with .Values.server.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.server.podAnnotations }}
annotations:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.server.command }}
command:
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.server.args }}
args:
{{- . | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.server.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.server.health.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.server.health.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
env:
{{- range $key, $value := .Values.server.env }}
- name: {{ $key }}
value: {{ tpl $value $ | quote }}
{{- end }}
{{- if .Values.server.envVarSource }}
{{- range $key, $value := .Values.server.envVarSource }}
- name: {{ $key }}
valueFrom: {{ tpl $value $ }}
{{- end }}
{{- end }}
{{- if .Values.global }}
{{- range $key, $value := .Values.global.env }}
- name: {{ $key }}
value: {{ tpl $value $ | quote }}
{{- end }}
{{- end }}
{{- with .Values.server.securityContext }}
securityContext:
{{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.server.containerVolumeMounts }}
volumeMounts:
{{- tpl (toYaml . ) $ | nindent 12 }}
{{- end }}
{{- if .Values.server.antiAffinity }}
affinity:
{{- if eq .Values.server.antiAffinity "hard" }}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
app.kubernetes.io/name: {{ include "kwatch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: server
{{- else if eq .Values.server.antiAffinity "soft" }}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app.kubernetes.io/name: {{ include "kwatch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: server
{{- end }}
{{- end }}
{{- with .Values.server.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.server.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.server.volumes }}
volumes:
{{- tpl (toYaml . ) $ | nindent 8 }}
{{- end }}
15 changes: 15 additions & 0 deletions chart/kwatch/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.serviceAccount.enabled -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "kwatch.fullname" . }}-sa
namespace: {{ .Release.Namespace }}
labels:
app: {{ include "kwatch.name" . }}
chart: {{ include "kwatch.chart" . }}
release: {{ .Release.Name }}
helm.sh/chart: {{ include "kwatch.chart" . }}
app.kubernetes.io/name: {{ include "kwatch.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }
Loading