Skip to content

Commit

Permalink
chore(openebs-rawfile-localpv): rawfile-csi chart (#9)
Browse files Browse the repository at this point in the history
* chore(openebs-rawfile-localpv): rawfile-csi chart

* feat(proxyd): upgrade appVersion to 3.9.1

* feat: fixed default authrpc flag

* feat(proxyd): comprehensive method mappings

* chore(openebs-rawfile-localpv): updating chart name

* chore(openebs-rawfile-localpv): updating volumes mountpoints

* chore(openebs-rawfile-localpv): added tolerations

* chore(openebs-rawfile-localpv): fixed tolerations typo

* chore(openebs-rawfile-localpv): rm-ed incorrect ref

* chore(openebs-rawfile-localpv): typos

Co-authored-by: calinah <[email protected]>
Co-authored-by: Chris Wessels <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2022
1 parent c1031ad commit bbfc9cd
Show file tree
Hide file tree
Showing 11 changed files with 578 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/openebs-rawfile-localpv/.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 charts/openebs-rawfile-localpv/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: openebs-rawfile-localpv
description: RawFile Driver Container Storage Interface
type: application
version: 0.7.0
appVersion: 0.7.0
31 changes: 31 additions & 0 deletions charts/openebs-rawfile-localpv/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Openebs-Rawfile-Localpv Helm Chart

RawFile Driver Container Storage Interface

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.7.0](https://img.shields.io/badge/Version-0.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.0](https://img.shields.io/badge/AppVersion-0.7.0-informational?style=flat-square)

## Features

- Actively maintained by [GraphOps](https://graphops.xyz) and contributors, forked from [Openebs Rawfile-localpv](https://github.com/openebs/rawfile-localpv)
- Includes RBAC
- Support for `ServiceMonitor`s to configure Prometheus to scrape metrics ([prometheus-operator](https://github.com/prometheus-operator/prometheus-operator))

## Reasons to consider using node-based (rather than network-based) storage solutions:

Performance: Almost no network-based storage solution can keep up with baremetal disk performance in terms of IOPS/latency/throughput combined. And you’d like to get the best out of the SSD you’ve got!
On-premise Environment: You might not be able to afford the cost of upgrading all your networking infrastructure, to get the best out of your network-based storage solution.
Complexity: Network-based solutions are distributed systems. And distributed systems are not easy! You might want to have a system that is easier to understand and to reason about. Also, with less complexity, you can fix unpredicted issues more easily.
Using node-based storage has come a long way since k8s was born. Right now, OpenEBS’s hostPath makes it pretty easy to automatically provision hostPath PVs and use them in your workloads. There are known limitations though:

- You can’t monitor volume usage: There are hacky workarounds to run “du” regularly, but that could prove to be a performance killer, since it could put a lot of burden on your CPU and cause your filesystem cache to fill up. Not really good for a production workload.
- You can’t enforce hard limits on your volume’s size: Again, you can hack your way around it, with the same caveats.
- You are stuck with whatever filesystem your kubelet node is offering
- You can’t customize your filesystem:
- All these issues stem from the same root cause: hostPath/LocalPVs are simple bind-mounts from the host filesystem into the pod.

The idea here is to use a single file as the block device, using Linux’s loop, and create a volume based on it. That way:

You can monitor volume usage by running df in O(1) since devices are mounted separately.
The size limit is enforced by the operating system, based on the backing file size.
Since volumes are backed by different files, each file could be formatted using different filesystems, and/or customized with different filesystem options.

31 changes: 31 additions & 0 deletions charts/openebs-rawfile-localpv/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{ template "graphops.title" . }}

{{ template "chart.description" . }}

{{ template "graphops.badges" . }}

## Features

- Actively maintained by [GraphOps](https://graphops.xyz) and contributors, forked from [Openebs Rawfile-localpv](https://github.com/openebs/rawfile-localpv)
- Includes RBAC
- Support for `ServiceMonitor`s to configure Prometheus to scrape metrics ([prometheus-operator](https://github.com/prometheus-operator/prometheus-operator))

## Reasons to consider using node-based (rather than network-based) storage solutions:

Performance: Almost no network-based storage solution can keep up with baremetal disk performance in terms of IOPS/latency/throughput combined. And you’d like to get the best out of the SSD you’ve got!
On-premise Environment: You might not be able to afford the cost of upgrading all your networking infrastructure, to get the best out of your network-based storage solution.
Complexity: Network-based solutions are distributed systems. And distributed systems are not easy! You might want to have a system that is easier to understand and to reason about. Also, with less complexity, you can fix unpredicted issues more easily.
Using node-based storage has come a long way since k8s was born. Right now, OpenEBS’s hostPath makes it pretty easy to automatically provision hostPath PVs and use them in your workloads. There are known limitations though:

- You can’t monitor volume usage: There are hacky workarounds to run “du” regularly, but that could prove to be a performance killer, since it could put a lot of burden on your CPU and cause your filesystem cache to fill up. Not really good for a production workload.
- You can’t enforce hard limits on your volume’s size: Again, you can hack your way around it, with the same caveats.
- You are stuck with whatever filesystem your kubelet node is offering
- You can’t customize your filesystem:
- All these issues stem from the same root cause: hostPath/LocalPVs are simple bind-mounts from the host filesystem into the pod.

The idea here is to use a single file as the block device, using Linux’s loop, and create a volume based on it. That way:

You can monitor volume usage by running df in O(1) since devices are mounted separately.
The size limit is enforced by the operating system, based on the backing file size.
Since volumes are backed by different files, each file could be formatted using different filesystems, and/or customized with different filesystem options.

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

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "openebs-rawfile-localpv.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "openebs-rawfile-localpv.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
76 changes: 76 additions & 0 deletions charts/openebs-rawfile-localpv/templates/controller-plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "openebs-rawfile-localpv.fullname" . }}-controller
labels:
{{- include "openebs-rawfile-localpv.labels" . | nindent 4 }}
component: controller
spec:
type: ClusterIP
selector:
{{- include "openebs-rawfile-localpv.selectorLabels" . | nindent 4 }}
component: controller
clusterIP: None
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "openebs-rawfile-localpv.fullname" . }}-controller
spec:
replicas: 1
serviceName: {{ include "openebs-rawfile-localpv.fullname" . }}
selector:
matchLabels: &selectorLabels
{{- include "openebs-rawfile-localpv.selectorLabels" . | nindent 6 }}
component: controller
template:
metadata:
labels: *selectorLabels
spec:
serviceAccount: {{ include "openebs-rawfile-localpv.fullname" . }}-driver
priorityClassName: system-cluster-critical
{{- with .Values.controller.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: socket-dir
emptyDir: {}
containers:
- name: csi-driver
image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}"
imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
args:
- csi-driver
- --disable-metrics
env:
- name: PROVISIONER_NAME
value: "{{ .Values.provisionerName }}"
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
- name: IMAGE_REPOSITORY
value: "{{ .Values.controller.image.repository }}"
{{- if regexMatch "^.*-ci$" .Values.controller.image.tag }}
- name: IMAGE_TAG
value: "{{ .Values.controller.image.tag }}"
{{- end }}
volumeMounts:
- name: socket-dir
mountPath: /csi
ports:
- name: csi-probe
containerPort: 9808
resources:
{{- toYaml .Values.controller.resources | nindent 12 }}
- name: external-resizer
image: k8s.gcr.io/sig-storage/csi-resizer:v1.2.0
imagePullPolicy: IfNotPresent
args:
- "--csi-address=$(ADDRESS)"
- "--handle-volume-inuse-error=false"
env:
- name: ADDRESS
value: /csi/csi.sock
volumeMounts:
- name: socket-dir
mountPath: /csi
11 changes: 11 additions & 0 deletions charts/openebs-rawfile-localpv/templates/driver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: {{ .Values.provisionerName }}
spec:
attachRequired: false
podInfoOnMount: true
fsGroupPolicy: File
storageCapacity: true
volumeLifecycleModes:
- Persistent
Loading

0 comments on commit bbfc9cd

Please sign in to comment.