Skip to content

Commit

Permalink
Generate New chart with all configration
Browse files Browse the repository at this point in the history
  • Loading branch information
MahaGamal committed Mar 6, 2023
1 parent cdbfb2f commit bf235a4
Show file tree
Hide file tree
Showing 12 changed files with 672 additions and 0 deletions.
22 changes: 22 additions & 0 deletions deploy/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 deploy/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 deploy/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 deploy/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 deploy/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 deploy/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 }}
62 changes: 62 additions & 0 deletions deploy/kwatch/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{- if .Values.hpa.enabled }}
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
apiVersion: autoscaling/v2
{{- else }}
apiVersion: autoscaling/v2beta2
{{- end }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "kwatch.fullname" . }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "kwatch.fullname" . }}
minReplicas: {{ .Values.hpa.minpods }}
maxReplicas: {{ .Values.hpa.maxpods }}
metrics:

{{- if .Values.hpa.memoryAverageUtilization }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.hpa.memoryAverageUtilization }}
{{- end }}

{{- if .Values.hpa.cpuAverageUtilization }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.hpa.cpuAverageUtilization }}
{{- end }}

{{- if .Values.hpa.customMetrics -}}
{{- toYaml .Values.hpa.customMetrics | nindent 2 }}
{{- end }}

behavior:

scaleDown:
stabilizationWindowSeconds: {{ default 60 .Values.hpa.scaleDown.stabilizationWindowSeconds }}
policies:
- type: {{default "Pods" .Values.hpa.scaleDown.type }}
value: {{ default 1 .Values.hpa.scaleDown.value }}
periodSeconds: {{ default 15 .Values.hpa.scaleDown.periodSeconds }}

scaleUp:
stabilizationWindowSeconds: {{ default 60 .Values.hpa.scaleUp.stabilizationWindowSeconds }}
policies:
- type: {{ default "Pods" .Values.hpa.scaleUp.type }}
value: {{ default 5 .Values.hpa.scaleUp.value }}
periodSeconds: {{default 15 .Values.hpa.scaleUp.periodSeconds }}


{{- if .Values.hpa.customBehavior -}}
{{- toYaml .Values.hpa.customBehavior | nindent 2 }}
{{- end }}

{{- end }}
39 changes: 39 additions & 0 deletions deploy/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 }}
Loading

0 comments on commit bf235a4

Please sign in to comment.