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 Helm chart for DirectPV operator #821

Merged
merged 1 commit into from
Aug 16, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions helm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
# This file is part of MinIO DirectPV
# Copyright (c) 2023 MinIO, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

set -o errexit
set -o nounset
set -o pipefail

declare BUILD_VERSION KUBECTL_DIRECTPV

function init() {
if [ "$#" -ne 1 ]; then
cat <<EOF
USAGE:
helm.sh <VERSION>

EXAMPLE:
$ helm.sh 4.0.7
EOF
exit 255
fi

# assign after trimming 'v'
BUILD_VERSION="${1/v/}"

KUBECTL_DIRECTPV="./kubectl-directpv_${BUILD_VERSION}_$(go env GOOS)_$(go env GOARCH)"
if which "kubectl-directpv_${BUILD_VERSION}_$(go env GOOS)_$(go env GOARCH)" >/dev/null 2>&1; then
KUBECTL_DIRECTPV="kubectl-directpv_${BUILD_VERSION}_$(go env GOOS)_$(go env GOARCH)"
elif [ ! -f "${KUBECTL_DIRECTPV}" ]; then
echo "Downloading required kubectl-directpv"
curl --silent --location --insecure --fail --output "${KUBECTL_DIRECTPV}" "https://github.com/minio/directpv/releases/download/v${BUILD_VERSION}/${KUBECTL_DIRECTPV:2}"
chmod a+x "${KUBECTL_DIRECTPV}"
fi
}

function main() {
mkdir -p "./helm/templates/"
"${KUBECTL_DIRECTPV}" install -o yaml | sed -e 's/^---/~~~/g' | awk '{f="file" NR; print $0 > f}' RS='~~~'
for file in file*; do
name=$(awk '/^kind:/ { print $NF }' "${file}")
if [ "${name}" == "CustomResourceDefinition" ]; then
name=$(awk '/^ name:/ { print $NF }' "${file}")
fi
if [ -n "${name}" ]; then
mv "${file}" "./helm/templates/${name}.yaml"
fi
done
}

init "$@"
main "$@"
23 changes: 23 additions & 0 deletions helm/.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/
10 changes: 10 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: directpv-chart
description: A Helm chart for DirectPV
type: application
version: 0.1.0
appVersion: "4.0.6"
maintainers:
- email: dev@min.io
name: MinIO

19 changes: 19 additions & 0 deletions helm/templates/CSIDriver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

cniackz marked this conversation as resolved.
Show resolved Hide resolved
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
creationTimestamp: null
labels:
application-name: directpv.min.io
application-type: CSIDriver
directpv.min.io/created-by: kubectl-directpv
directpv.min.io/version: v1beta1
name: directpv-min-io
spec:
attachRequired: false
podInfoOnMount: true
volumeLifecycleModes:
- Persistent
- Ephemeral


172 changes: 172 additions & 0 deletions helm/templates/ClusterRole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
creationTimestamp: null
labels:
application-name: directpv.min.io
application-type: CSIDriver
directpv.min.io/created-by: kubectl-directpv
directpv.min.io/version: v1beta1
name: directpv-min-io
rules:
- apiGroups:
- ""
resources:
- persistentvolumes
verbs:
- create
- delete
- get
- list
- patch
- watch
- apiGroups:
- ""
resources:
- persistentvolumeclaims/status
verbs:
- patch
- apiGroups:
- policy
resources:
- podsecuritypolicies
verbs:
- use
- apiGroups:
- ""
resources:
- persistentvolumeclaims
verbs:
- get
- list
- update
- watch
- apiGroups:
- storage.k8s.io
resources:
- storageclasses
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- list
- patch
- update
- watch
- apiGroups:
- snapshot.storage.k8s.io
resources:
- volumesnapshots
verbs:
- get
- list
- apiGroups:
- snapshot.storage.k8s.io
resources:
- volumesnapshotcontents
verbs:
- get
- list
- apiGroups:
- storage.k8s.io
resources:
- csinodes
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- list
- watch
- apiGroups:
- storage.k8s.io
resources:
- volumeattachments
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- endpoints
verbs:
- create
- delete
- get
- list
- update
- watch
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- delete
- get
- list
- update
- watch
- apiGroups:
- apiextensions.k8s.io
- directpv.min.io
resources:
- customresourcedefinitions
- customresourcedefinition
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- directpv.min.io
resources:
- directpvdrives
- directpvvolumes
- directpvnodes
- directpvinitrequests
verbs:
- create
- delete
- get
- list
- update
- watch
- apiGroups:
- ""
resources:
- pods
- pod
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- secrets
- secret
verbs:
- get
- list
- watch


23 changes: 23 additions & 0 deletions helm/templates/ClusterRoleBinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
creationTimestamp: null
labels:
application-name: directpv.min.io
application-type: CSIDriver
directpv.min.io/created-by: kubectl-directpv
directpv.min.io/version: v1beta1
name: directpv-min-io
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: directpv-min-io
subjects:
- kind: ServiceAccount
name: directpv-min-io
namespace: directpv


Loading
Loading