-
Notifications
You must be signed in to change notification settings - Fork 39
WIP: Do not hardcode object names to allow multiple csi-diver-lvm s per cluster #154
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
Draft
mikk150
wants to merge
4
commits into
metal-stack:master
Choose a base branch
from
mikk150:do-not-hardcode-names-to-allow-multiple-lvm-drivers-per-cluster
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| {{/* vim: set filetype=mustache: */}} | ||
|
|
||
| {{- define "csi-driver-lvm.name" -}} | ||
| {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{- define "csi-driver-lvm.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 }} | ||
|
|
||
| {{- define "csi-driver-lvm.plugin.fullname" -}} | ||
| {{- include "csi-driver-lvm.fullname" . }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
| {{- define "csi-driver-lvm.labels" -}} | ||
| release: {{ .Release.Name }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{ if .Values.labels }} | ||
| {{ .Values.labels | toYaml}} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{- define "csi-driver-lvm.csi-driver.fullname" -}} | ||
| {{- default (include "csi-driver-lvm.fullname" .) .Values.lvm.driverName | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{- define "csi-driver-lvm.csi-driver.vgname" -}} | ||
| {{- default (include "csi-driver-lvm.fullname" .) .Values.lvm.vgName | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{- define "csi-driver-lvm.serviceaccount.fullname" -}} | ||
| {{- include "csi-driver-lvm.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.clusterrole.fullname" -}} | ||
| {{- include "csi-driver-lvm.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.clusterrolebinding.fullname" -}} | ||
| {{- include "csi-driver-lvm.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.podsecuritypolicy.fullname" -}} | ||
| {{- include "csi-driver-lvm.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.role.fullname" -}} | ||
| {{- include "csi-driver-lvm.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.rolebinding.fullname" -}} | ||
| {{- include "csi-driver-lvm.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.daemonset.fullname" -}} | ||
| {{- include "csi-driver-lvm.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.daemonset.selectorlabels" -}} | ||
| app: {{ include "csi-driver-lvm.fullname" . }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| EVICTION CONTROLLER | ||
| */}} | ||
| {{- define "csi-driver-lvm.eviction.fullname" -}} | ||
| {{- printf "%s-controller" (include "csi-driver-lvm.fullname" .) | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.eviction.serviceaccount.fullname" -}} | ||
| {{- include "csi-driver-lvm.eviction.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.eviction.clusterrole.fullname" -}} | ||
| {{- include "csi-driver-lvm.eviction.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.eviction.clusterrolebinding.fullname" -}} | ||
| {{- include "csi-driver-lvm.eviction.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.eviction.deployment.fullname" -}} | ||
| {{- include "csi-driver-lvm.eviction.fullname" . }} | ||
| {{- end }} | ||
| {{- define "csi-driver-lvm.eviction.selectorlabels" -}} | ||
| app: {{ include "csi-driver-lvm.eviction.fullname" . }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| STORAGECLASS | ||
| */}} | ||
| {{- define "csi-driver-lvm.storageclass.fullname" -}} | ||
| {{- printf "%s-%s" (include "csi-driver-lvm.fullname" .global ) .storageclass.name | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{- define "csi-driver-lvm.storageclass.parameters" -}} | ||
| {{- .storageclass.parameters | toYaml }} | ||
| {{- if and .storageclass.parameters.encryption (eq .storageclass.parameters.encryption "true" ) }} | ||
| {{- if empty (index .storageclass.parameters "csi.storage.k8s.io/node-stage-secret-name") }} | ||
| csi.storage.k8s.io/node-stage-secret-name: {{ include "csi-driver-lvm.storageclass.encryption.secret.fullname" . }} | ||
| {{- end }} | ||
| {{- if empty (index .storageclass.parameters "csi.storage.k8s.io/node-stage-secret-namespace") }} | ||
| csi.storage.k8s.io/node-stage-secret-namespace: {{ include "csi-driver-lvm.storageclass.encryption.secret.namespace" . }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{- define "csi-driver-lvm.storageclass.encryption.secret.fullname" -}} | ||
| {{- if not (empty (index .storageclass.parameters "csi.storage.k8s.io/node-stage-secret-name")) }} | ||
| {{- index .storageclass.parameters "csi.storage.k8s.io/node-stage-secret-name" }} | ||
| {{- else }} | ||
| {{- printf "%s-%s" (include "csi-driver-lvm.fullname" .global ) .storageclass.name | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{- define "csi-driver-lvm.storageclass.encryption.secret.namespace" -}} | ||
| {{- if not (empty (index .storageclass.parameters "csi.storage.k8s.io/node-stage-secret-namespace")) }} | ||
| {{- index .storageclass.parameters "csi.storage.k8s.io/node-stage-secret-namespace" }} | ||
| {{- else }} | ||
| {{- .global.Release.Namespace }} | ||
| {{- end }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least here, it must be ensured the the release.Name does not contain any dangerous characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am actually planning to create helpers for them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Release.Namecannot really contain any dangerous characters, the only potentially dangerous character that can exist is a.but that needs to be in the middle of a name so.testortest.is not even allowed. Also only 1 consequent.is allowed(thereforetest..testis not allowed). So onlytest.testis allowedtherefore
{{ .Values.kubernetes.kubeletPath }}/plugins/test.testAFAIK should be totally fine and valid plugin folder