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

Improve Helm experience #375

Merged
merged 1 commit into from Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -45,7 +45,8 @@ INFO[4804] terminating pod name=nginx-701339712-51nt8 namespace=chaosku
You can install `chaoskube` with [`Helm`](https://github.com/kubernetes/helm). Follow [Helm's Quickstart Guide](https://helm.sh/docs/intro/quickstart/) and then install the `chaoskube` chart.

```console
$ helm install stable/chaoskube
$ helm repo add chaoskube https://linki.github.io/chaoskube/
$ helm install chaoskube chaoskube/chaoskube --atomic --namespace=chaoskube --create-namespace

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old instructions got me initially too. New instructions will be helpful for new users 👍

```

Refer to [chaoskube on kubeapps.com](https://kubeapps.com/charts/stable/chaoskube) to learn how to configure it and to find other useful Helm charts.
Expand Down
4 changes: 2 additions & 2 deletions chart/chaoskube/Chart.yaml
Expand Up @@ -13,5 +13,5 @@ maintainers:
url: https://github.com/linki
- name: Thomas Gosteli
url: https://github.com/ghouscht
version: 0.1.0
appVersion: 0.21.0
version: 0.2.0
appVersion: 0.24.0
61 changes: 56 additions & 5 deletions chart/chaoskube/README.md
@@ -1,14 +1,65 @@
# chaoskube Helm Chart

chaoskube periodically kills random pods in your Kubernetes cluster.

## Installation

### Helm 3: install the chaoskube Helm Chart
```console
$ helm repo add chaoskube https://linki.github.io/chaoskube/
$ helm install chaoskube chaoskube/chaoskube --atomic --namespace=chaoskube --create-namespace
```
helm repo add chaoskube https://chaoskube.github.io/chaoskube-kubernetes
helm install ...

## Example Helm values

Basic configuration with `3` replicas and minimum resources assigned that will take out any pod it can find (including the other chaoskube pods):

```yaml
chaoskube:
args:
no-dry-run: ""
replicaCount: 3
resources:
limits:
cpu: 15m
memory: 32Mi
requests:
cpu: 15m
memory: 32Mi
```

## Example Helm values
...
More advance configuration that limits based on several factors like time, day of the week, and date:

```yaml
chaoskube:
args:
# kill a pod every 10 minutes
interval: "10m"
# only target pods in the test environment
labels: "environment=test"
# only consider pods with this annotation
annotations: "chaos.alpha.kubernetes.io/enabled=true"
# exclude all DaemonSet pods
kinds: "!DaemonSet"
# exclude all pods in the kube-system namespace
namespaces: "!kube-system"
# don't kill anything on weekends
excluded-weekdays: "Sat,Sun"
# don't kill anything during the night or at lunchtime
excluded-times-of-day: "22:00-08:00,11:00-13:00"
# don't kill anything as a joke or on christmas eve
excluded-days-of-year: "Apr1,Dec24"
# let's make sure we all agree on what the above times mean
timezone: "UTC"
# exclude all pods that haven't been running for at least one hour
#minimum-age: "1h"
# terminate pods for real: this disables dry-run mode which is on by default
no-dry-run: ""
replicaCount: 3
resources:
limits:
cpu: 15m
memory: 32Mi
requests:
cpu: 15m
memory: 32Mi
```
10 changes: 7 additions & 3 deletions chart/chaoskube/templates/deployment.yaml
Expand Up @@ -25,21 +25,25 @@ spec:
serviceAccountName: {{ include "chaoskube.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "v%s" .Chart.AppVersion) }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.chaoskube.env }}
env:
{{ toYaml .Values.chaoskube.env | indent 8 }}
{{- end }}
{{- with .Values.chaoskube.args }}
args:
{{- range $key, $value := .Values.chaoskube.args }}
{{- range $key, $value := . }}
{{- if $value }}
- --{{ $key }}={{ $value }}
{{- else }}
- --{{ $key }}
{{- end }}
{{- end }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 10 }}
{{- with .Values.resources}}
resources:
{{- toYaml .Values.resources | nindent 10 }}
{{- toYaml . | nindent 10 }}
{{- end }}
30 changes: 17 additions & 13 deletions chart/chaoskube/values.yaml
Expand Up @@ -4,37 +4,41 @@ replicaCount: 1

# image specifies image location, tag and pullPolicy
image:
repository: quay.io/linki/chaoskube
repository: ghcr.io/linki/chaoskube
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""

# chaoskube is used to configure chaoskube
chaoskube:
env: {}
args:
args: {}
######
# Example configuration, uncomment and adjust to your needs.
# Be sure to read: https://github.com/linki/chaoskube#flags
######
# kill a pod every 10 minutes
interval: "10m"
#interval: "10m"
# only target pods in the test environment
labels: "environment=test"
#labels: "environment=test"
# only consider pods with this annotation
annotations: "chaos.alpha.kubernetes.io/enabled=true"
#annotations: "chaos.alpha.kubernetes.io/enabled=true"
# exclude all DaemonSet pods
kinds: "!DaemonSet"
#kinds: "!DaemonSet"
# exclude all pods in the kube-system namespace
namespaces: "!kube-system"
#namespaces: "!kube-system"
# don't kill anything on weekends
excluded-weekdays: "Sat,Sun"
#excluded-weekdays: "Sat,Sun"
# don't kill anything during the night or at lunchtime
excluded-times-of-day: "22:00-08:00,11:00-13:00"
#excluded-times-of-day: "22:00-08:00,11:00-13:00"
# don't kill anything as a joke or on christmas eve
excluded-days-of-year: "Apr1,Dec24"
#excluded-days-of-year: "Apr1,Dec24"
# let's make sure we all agree on what the above times mean
timezone: "UTC"
#timezone: "UTC"
# exclude all pods that haven't been running for at least one hour
minimum-age: "1h"
#minimum-age: "1h"
# terminate pods for real: this disables dry-run mode which is on by default
no-dry-run: ""
#no-dry-run: ""

# serviceAccount can be used to customize the service account which will be crated and used by chaoskube
serviceAccount:
Expand Down