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

Add fio-standalone Helm chart #1

Open
wants to merge 4 commits 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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,54 @@ Note: a single benchmark for FIO will take about 6 minutes to finish.

See [./deploy/fio.yaml](https://github.com/yasker/kbench/blob/main/deploy/fio.yaml) for available options.

#### Deploy Comparison Benchmark in Kubernetes cluster
### Deploy Single Volume Benchmark via Helm

All defaults are the same as in the YAML installation method.
Use the following steps to prep for installation:
```bash
# add helm repo
helm repo add yasker-kbench https://raw.githubusercontent.com/yasker/kbench/main/helm

# create namespace for needed resources
kubectl create ns fio-benchmarks
```

To deploy with all defaults:
```bash
helm upgrade --install fio-benchmark-default \
yasker-kbench/fio-standalone \
-n fio-benchmarks \
--version v0.1.0
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I should release a v0.1.0.

```

To customize the installation, create a values.yaml or use `--set` flags:
```bash
# --set flags
helm upgrade --install fio-benchmark-a \
yasker-kbench/fio-standalone \
-n fio-benchmarks \
--version v0.1.0 \
--set pvc.size=11Gi \
--set benchmark.size=10G
Copy link
Member

Choose a reason for hiding this comment

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

Can we automatically set PVC size to benchmark size * 1.1? Not sure if the chart can do that though.

Copy link
Author

Choose a reason for hiding this comment

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

Good call, will update templates and values


# values file
cat <<EOF > fio-benchmark-b-values.yaml
pvc:
storageClassName: "local-path"
size: "22Gi"
volumeMode: "Block"
benchmark:
size: "20G"
EOF

helm upgrade --install fio-benchmark-b \
yasker-kbench/fio-standalone \
-n fio-benchmarks \
--version v0.1.0 \
-f ./fio-benchmark-b-values.yaml
```

### Deploy Comparison Benchmark in Kubernetes cluster

1. Get a local copy of `fio-cmp.yaml`
```
Expand Down
Binary file added helm/assets/fio-0.1.0.tgz
Binary file not shown.
23 changes: 23 additions & 0 deletions helm/charts/fio/0.1.0/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions helm/charts/fio/0.1.0/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: fio
description: Benchmark Kubernetes StorageClass performance with FIO.
type: application
version: 0.1.0
appVersion: v0.1.0
11 changes: 11 additions & 0 deletions helm/charts/fio/0.1.0/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ if .Values.pvc.storageClassName -}}
Benchmark against StorageClass {{ .Values.pvc.storageClassName | quote }} is running!
{{- else -}}
Benchmark against default StorageClass is running!
{{- end }}

Check the status of the Job to see when the benchmark is complete:
kubectl get jobs -n {{ .Release.Namespace }}

View logs of the completed benchmark:
kubectl logs -n {{ .Release.Namespace }} job/{{ include "fio.fullname" . }}
80 changes: 80 additions & 0 deletions helm/charts/fio/0.1.0/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "fio.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 "fio.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 "fio.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "fio.labels" -}}
helm.sh/chart: {{ include "fio.chart" . }}
{{ include "fio.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "fio.selectorLabels" -}}
app.kubernetes.io/name: {{ include "fio.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "fio.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "fio.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Pre-calculate PVC size from benchmark size
*/}}
{{- define "fio.pvcSize" -}}
{{- if not (kindIs "string" .Values.benchmark.size) }}
{{- fail "Benchmark size must be of format <size>G, e.g. 10G, 25G, 1000G" -}}
{{- end }}
{{- if not (hasSuffix "G" .Values.benchmark.size) -}}
{{- fail "Benchmark size must be of format <size>G, e.g. 10G, 25G, 1000G" -}}
{{- end}}
{{- $sizeElevenX := mul (trimSuffix "G" .Values.benchmark.size) 11 -}}
{{- if (ne (mod $sizeElevenX 10) 0) -}}
{{- add1 (div $sizeElevenX 10) }}Gi
{{- else -}}
{{- div $sizeElevenX 10 }}Gi
{{- end }}
{{- end }}
33 changes: 33 additions & 0 deletions helm/charts/fio/0.1.0/templates/job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "fio.fullname" . }}
spec:
template:
metadata:
labels:
benchmark: fio
spec:
containers:
- name: benchmark
image: {{ .Values.benchmark.image.repository }}:{{ .Values.benchmark.image.tag }}
imagePullPolicy: {{ .Values.benchmark.image.pullPolicy }}
env:
{{- if .Values.benchmark.quickMode }}
- name: QUICK_MODE # for debugging
value: "1"
{{- end }}
- name: FILE_NAME
value: "/volume/test"
- name: SIZE
value: {{ .Values.benchmark.size | quote }}
volumeMounts:
- name: vol
mountPath: /volume/
imagePullSecrets: {{ .Values.benchmark.imagePullSecrets }}
restartPolicy: Never
volumes:
- name: vol
persistentVolumeClaim:
claimName: {{ include "fio.fullname" . }}
backoffLimit: 0
14 changes: 14 additions & 0 deletions helm/charts/fio/0.1.0/templates/persistent-volume-claim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "fio.fullname" . }}
spec:
volumeMode: {{ .Values.pvc.volumeMode | quote }}
{{- if .Values.pvc.storageClassName }}
storageClassName: {{ .Values.pvc.storageClassName | quote }}
{{- end }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ include "fio.pvcSize" . | quote }}
20 changes: 20 additions & 0 deletions helm/charts/fio/0.1.0/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
pvc:
# specify storage class to test;
# "" will use the default StorageClass for the cluster
storageClassName: ""
# mode for PVC - "Filesystem" or "Block"
volumeMode: "Filesystem"

benchmark:
# size of benchmark
# NOTE required format: 10G, 30G, 40G, etc.
size: "30G"
image:
repository: "yasker/kbench"
pullPolicy: "IfNotPresent"
tag: "v0.1.0"
imagePullSecrets: []
quickMode: false

nameOverride: ""
fullnameOverride: ""
14 changes: 14 additions & 0 deletions helm/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
entries:
fio:
- apiVersion: v2
appVersion: v0.1.0
created: "2021-08-03T16:41:16.873451-04:00"
description: Benchmark Kubernetes StorageClass performance with FIO.
digest: 0c788837ccac5e80388a694bb51af34cecf5faa1e830d0c54fc2c02f78830212
name: fio
type: application
urls:
- assets/fio-0.1.0.tgz
version: 0.1.0
generated: "2021-08-03T16:41:16.872569-04:00"