forked from rook/rook
updating node-driver-registrar to v2.5.1 release , nfsplugin to 4.0.0 and csi-snapshotter to v6.0.1 Note:- with snapshotter v6.0.1 v1beta1 snapshot CRD is not supported. If you want betav1 snapshot support please switch to v5.x.x snapshotter. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
111 lines
2.8 KiB
Go
111 lines
2.8 KiB
Go
/*
|
|
Copyright 2021 The Rook Authors. All rights reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package installer
|
|
|
|
import (
|
|
"strconv"
|
|
)
|
|
|
|
func GetPodWithVolume(podName, claimName, namespace, mountPath string, readOnly bool) string {
|
|
return `
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
name: ` + podName + `
|
|
namespace: ` + namespace + `
|
|
spec:
|
|
containers:
|
|
- name: ` + podName + `
|
|
image: busybox
|
|
command: ["/bin/sleep", "infinity"]
|
|
imagePullPolicy: IfNotPresent
|
|
volumeMounts:
|
|
- mountPath: ` + mountPath + `
|
|
name: csivol
|
|
volumes:
|
|
- name: csivol
|
|
persistentVolumeClaim:
|
|
claimName: ` + claimName + `
|
|
readOnly: ` + strconv.FormatBool(readOnly) + `
|
|
restartPolicy: Never
|
|
`
|
|
}
|
|
|
|
func GetPVC(claimName, namespace, storageClassName, accessModes, size string) string {
|
|
return `apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: ` + claimName + `
|
|
namespace: ` + namespace + `
|
|
spec:
|
|
storageClassName: ` + storageClassName + `
|
|
accessModes:
|
|
- ` + accessModes + `
|
|
resources:
|
|
requests:
|
|
storage: ` + size
|
|
}
|
|
|
|
func GetPVCRestore(claimName, snapshotName, namespace, storageClassName, accessModes, size string) string {
|
|
return `apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: ` + claimName + `
|
|
namespace: ` + namespace + `
|
|
spec:
|
|
storageClassName: ` + storageClassName + `
|
|
dataSource:
|
|
name: ` + snapshotName + `
|
|
kind: VolumeSnapshot
|
|
apiGroup: snapshot.storage.k8s.io
|
|
accessModes:
|
|
- ` + accessModes + `
|
|
resources:
|
|
requests:
|
|
storage: ` + size
|
|
}
|
|
|
|
func GetPVCClone(cloneClaimName, parentClaimName, namespace, storageClassName, accessModes, size string) string {
|
|
return `apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: ` + cloneClaimName + `
|
|
namespace: ` + namespace + `
|
|
spec:
|
|
storageClassName: ` + storageClassName + `
|
|
dataSource:
|
|
name: ` + parentClaimName + `
|
|
kind: PersistentVolumeClaim
|
|
accessModes:
|
|
- ` + accessModes + `
|
|
resources:
|
|
requests:
|
|
storage: ` + size
|
|
}
|
|
|
|
func GetSnapshot(snapshotName, claimName, snapshotClassName, namespace string) string {
|
|
return `apiVersion: snapshot.storage.k8s.io/v1
|
|
kind: VolumeSnapshot
|
|
metadata:
|
|
name: ` + snapshotName + `
|
|
namespace: ` + namespace + `
|
|
spec:
|
|
volumeSnapshotClassName: ` + snapshotClassName + `
|
|
source:
|
|
persistentVolumeClaimName: ` + claimName
|
|
}
|