diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..674e83f --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.DS_Store + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/README.md b/README.md index a81cce0..9f03b80 100644 --- a/README.md +++ b/README.md @@ -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 +``` + +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 + +# values file +cat < 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` ``` diff --git a/helm/assets/fio-0.1.0.tgz b/helm/assets/fio-0.1.0.tgz new file mode 100644 index 0000000..9ef841d Binary files /dev/null and b/helm/assets/fio-0.1.0.tgz differ diff --git a/helm/charts/fio/0.1.0/.helmignore b/helm/charts/fio/0.1.0/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/helm/charts/fio/0.1.0/.helmignore @@ -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/ diff --git a/helm/charts/fio/0.1.0/Chart.yaml b/helm/charts/fio/0.1.0/Chart.yaml new file mode 100644 index 0000000..97da28e --- /dev/null +++ b/helm/charts/fio/0.1.0/Chart.yaml @@ -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 diff --git a/helm/charts/fio/0.1.0/templates/NOTES.txt b/helm/charts/fio/0.1.0/templates/NOTES.txt new file mode 100644 index 0000000..2c00363 --- /dev/null +++ b/helm/charts/fio/0.1.0/templates/NOTES.txt @@ -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" . }} diff --git a/helm/charts/fio/0.1.0/templates/_helpers.tpl b/helm/charts/fio/0.1.0/templates/_helpers.tpl new file mode 100644 index 0000000..08cd973 --- /dev/null +++ b/helm/charts/fio/0.1.0/templates/_helpers.tpl @@ -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 G, e.g. 10G, 25G, 1000G" -}} +{{- end }} +{{- if not (hasSuffix "G" .Values.benchmark.size) -}} +{{- fail "Benchmark size must be of format 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 }} diff --git a/helm/charts/fio/0.1.0/templates/job.yaml b/helm/charts/fio/0.1.0/templates/job.yaml new file mode 100644 index 0000000..402c593 --- /dev/null +++ b/helm/charts/fio/0.1.0/templates/job.yaml @@ -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 diff --git a/helm/charts/fio/0.1.0/templates/persistent-volume-claim.yaml b/helm/charts/fio/0.1.0/templates/persistent-volume-claim.yaml new file mode 100644 index 0000000..8448edc --- /dev/null +++ b/helm/charts/fio/0.1.0/templates/persistent-volume-claim.yaml @@ -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 }} diff --git a/helm/charts/fio/0.1.0/values.yaml b/helm/charts/fio/0.1.0/values.yaml new file mode 100644 index 0000000..d062e36 --- /dev/null +++ b/helm/charts/fio/0.1.0/values.yaml @@ -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: "" diff --git a/helm/index.yaml b/helm/index.yaml new file mode 100644 index 0000000..2caecc8 --- /dev/null +++ b/helm/index.yaml @@ -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"