Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Helm chart for DirectPV operator (#821)
### Objective: Add `Helm Chart` for DirectPV This will be needed for our DirectPV Helm Operator that will be used for the certification. When initializing the Operator, we have a flag where this folder goes: `--helm-chart` then Operator will use that helm chart for reconciling. * Thank you @balamurugana for providing the notes and for finding this method! * Reference: https://github.com/cniackz/public/wiki/Helm-Operator-for-DirectPV
- Loading branch information
Showing
18 changed files
with
1,435 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,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 "$@" |
This file contains 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,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/ |
This file contains 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,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 | ||
|
This file contains 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,19 @@ | ||
|
||
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 | ||
|
||
|
This file contains 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,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 | ||
|
||
|
This file contains 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,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 | ||
|
||
|
Oops, something went wrong.