Merge pull request #10902 from rook/mergify/bp/release-1.10/pr-10791
csi: use cephcsi image for nfs nodeserver + holder design (backport #10791)
This commit is contained in:
14 files changed
+204
-22
No files matched your search
@@ -1400,6 +1400,10 @@ jobs:
|
||||
- name: test ceph-csi-cephfs plugin restart
|
||||
run: tests/scripts/github-action-helper.sh test_csi_cephfs_workload
|
||||
|
||||
# uncomment once https://github.com/rook/rook/issues/10812 is resolved.
|
||||
# - name: test ceph-csi-nfs plugin restart
|
||||
# run: tests/scripts/github-action-helper.sh test_csi_nfs_workload
|
||||
|
||||
- name: collect common logs
|
||||
if: always()
|
||||
uses: ./.github/workflows/collect-logs
|
||||
@@ -1456,6 +1460,9 @@ jobs:
|
||||
- name: test ceph-csi-cephfs plugin restart
|
||||
run: tests/scripts/github-action-helper.sh test_csi_cephfs_workload
|
||||
|
||||
- name: test ceph-csi-nfs plugin restart
|
||||
run: tests/scripts/github-action-helper.sh test_csi_nfs_workload
|
||||
|
||||
- name: collect common logs
|
||||
if: always()
|
||||
uses: ./.github/workflows/collect-logs
|
||||
|
||||
@@ -129,7 +129,6 @@ The following tables lists the configurable parameters of the rook-operator char
|
||||
| `csi.csiAddons.enabled` | Enable CSIAddons | `false` |
|
||||
| `csi.csiAddons.image` | CSIAddons Sidecar image. | `quay.io/csiaddons/k8s-sidecar:v0.4.0` |
|
||||
| `csi.nfs.enabled` | Enable nfs driver. | `false` |
|
||||
| `csi.nfs.image` | NFS nodeplugin image. | `registry.k8s.io/sig-storage/nfsplugin:v4.0.0` |
|
||||
| `admissionController.tolerations` | Array of tolerations in YAML format which will be added to admission controller deployment. | `<none>` |
|
||||
| `admissionController.nodeAffinity` | The node labels for affinity of the admission controller deployment [^1] | `<none>` |
|
||||
| `monitoring.enabled` | Create necessary RBAC rules for Rook to integrate with Prometheus monitoring in the operator namespace. Requires Prometheus to be pre-installed. | `false` |
|
||||
|
||||
@@ -90,9 +90,6 @@ data:
|
||||
{{- end }}
|
||||
{{- if .Values.csi.nfs }}
|
||||
ROOK_CSI_ENABLE_NFS: {{ .Values.csi.nfs.enabled | quote }}
|
||||
{{- if .Values.csi.nfs.image }}
|
||||
ROOK_CSI_NFS_IMAGE: {{ .Values.csi.nfs.image | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.csi.cephfsPodLabels }}
|
||||
ROOK_CSI_CEPHFS_POD_LABELS: {{ .Values.csi.cephfsPodLabels | quote }}
|
||||
|
||||
@@ -390,7 +390,6 @@ csi:
|
||||
# Enable the nfs csi driver.
|
||||
nfs:
|
||||
enabled: false
|
||||
#image: "registry.k8s.io/sig-storage/nfsplugin:v4.0.0"
|
||||
enableDiscoveryDaemon: false
|
||||
cephCommandsTimeoutSeconds: "15"
|
||||
|
||||
|
||||
@@ -7,5 +7,4 @@
|
||||
registry.k8s.io/sig-storage/csi-provisioner:v3.2.1
|
||||
registry.k8s.io/sig-storage/csi-resizer:v1.5.0
|
||||
registry.k8s.io/sig-storage/csi-snapshotter:v6.0.1
|
||||
registry.k8s.io/sig-storage/nfsplugin:v4.0.0
|
||||
rook/ceph:v1.10.0
|
||||
@@ -190,7 +190,6 @@ data:
|
||||
# ROOK_CSI_PROVISIONER_IMAGE: "registry.k8s.io/sig-storage/csi-provisioner:v3.2.1"
|
||||
# ROOK_CSI_SNAPSHOTTER_IMAGE: "registry.k8s.io/sig-storage/csi-snapshotter:v6.0.1"
|
||||
# ROOK_CSI_ATTACHER_IMAGE: "registry.k8s.io/sig-storage/csi-attacher:v3.5.0"
|
||||
# ROOK_CSI_NFS_IMAGE: "registry.k8s.io/sig-storage/nfsplugin:v4.0.0"
|
||||
|
||||
# (Optional) set user created priorityclassName for csi plugin pods.
|
||||
CSI_PLUGIN_PRIORITY_CLASSNAME: "system-node-critical"
|
||||
|
||||
@@ -107,7 +107,6 @@ data:
|
||||
# ROOK_CSI_PROVISIONER_IMAGE: "registry.k8s.io/sig-storage/csi-provisioner:v3.1.0"
|
||||
# ROOK_CSI_SNAPSHOTTER_IMAGE: "registry.k8s.io/sig-storage/csi-snapshotter:v6.0.1"
|
||||
# ROOK_CSI_ATTACHER_IMAGE: "registry.k8s.io/sig-storage/csi-attacher:v3.4.0"
|
||||
# ROOK_CSI_NFS_IMAGE: "registry.k8s.io/sig-storage/nfsplugin:v4.0.0"
|
||||
|
||||
# (Optional) set user created priorityclassName for csi plugin pods.
|
||||
CSI_PLUGIN_PRIORITY_CLASSNAME: "system-node-critical"
|
||||
|
||||
@@ -42,6 +42,7 @@ type CsiClusterConfigEntry struct {
|
||||
Monitors []string `json:"monitors"`
|
||||
Namespace string `json:"namespace"`
|
||||
CephFS *CsiCephFSSpec `json:"cephFS,omitempty"`
|
||||
NFS *CsiNFSSpec `json:"nfs,omitempty"`
|
||||
RBD *CsiRBDSpec `json:"rbd,omitempty"`
|
||||
RadosNamespace string `json:"radosNamespace,omitempty"`
|
||||
}
|
||||
@@ -51,6 +52,10 @@ type CsiCephFSSpec struct {
|
||||
SubvolumeGroup string `json:"subvolumeGroup,omitempty"`
|
||||
}
|
||||
|
||||
type CsiNFSSpec struct {
|
||||
NetNamespaceFilePath string `json:"netNamespaceFilePath,omitempty"`
|
||||
}
|
||||
|
||||
type CsiRBDSpec struct {
|
||||
NetNamespaceFilePath string `json:"netNamespaceFilePath,omitempty"`
|
||||
RadosNamespace string `json:"radosNamespace,omitempty"`
|
||||
@@ -142,6 +147,9 @@ func updateCsiClusterConfig(curr, clusterKey string, newCsiClusterConfigEntry *C
|
||||
if newCsiClusterConfigEntry.CephFS != nil && (newCsiClusterConfigEntry.CephFS.SubvolumeGroup != "" || newCsiClusterConfigEntry.CephFS.NetNamespaceFilePath != "") {
|
||||
centry.CephFS = newCsiClusterConfigEntry.CephFS
|
||||
}
|
||||
if newCsiClusterConfigEntry.NFS != nil && newCsiClusterConfigEntry.NFS.NetNamespaceFilePath != "" {
|
||||
centry.NFS = newCsiClusterConfigEntry.NFS
|
||||
}
|
||||
if newCsiClusterConfigEntry.RBD != nil && (newCsiClusterConfigEntry.RBD.RadosNamespace != "" || newCsiClusterConfigEntry.RBD.NetNamespaceFilePath != "") {
|
||||
centry.RBD = newCsiClusterConfigEntry.RBD
|
||||
}
|
||||
@@ -169,6 +177,9 @@ func updateCsiClusterConfig(curr, clusterKey string, newCsiClusterConfigEntry *C
|
||||
if newCsiClusterConfigEntry.CephFS != nil && (newCsiClusterConfigEntry.CephFS.SubvolumeGroup != "" || newCsiClusterConfigEntry.CephFS.NetNamespaceFilePath != "") {
|
||||
centry.CephFS = newCsiClusterConfigEntry.CephFS
|
||||
}
|
||||
if newCsiClusterConfigEntry.NFS != nil && newCsiClusterConfigEntry.NFS.NetNamespaceFilePath != "" {
|
||||
centry.NFS = newCsiClusterConfigEntry.NFS
|
||||
}
|
||||
cc = append(cc, centry)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,6 @@ func (r *ReconcileCSI) setParams(ver *version.Info) error {
|
||||
}
|
||||
|
||||
CSIParam.CSIPluginImage = k8sutil.GetValue(r.opConfig.Parameters, "ROOK_CSI_CEPH_IMAGE", DefaultCSIPluginImage)
|
||||
CSIParam.NFSPluginImage = k8sutil.GetValue(r.opConfig.Parameters, "ROOK_CSI_NFS_IMAGE", DefaultNFSPluginImage)
|
||||
CSIParam.RegistrarImage = k8sutil.GetValue(r.opConfig.Parameters, "ROOK_CSI_REGISTRAR_IMAGE", DefaultRegistrarImage)
|
||||
CSIParam.ProvisionerImage = k8sutil.GetValue(r.opConfig.Parameters, "ROOK_CSI_PROVISIONER_IMAGE", DefaultProvisionerImage)
|
||||
CSIParam.AttacherImage = k8sutil.GetValue(r.opConfig.Parameters, "ROOK_CSI_ATTACHER_IMAGE", DefaultAttacherImage)
|
||||
|
||||
@@ -40,7 +40,6 @@ import (
|
||||
|
||||
type Param struct {
|
||||
CSIPluginImage string
|
||||
NFSPluginImage string
|
||||
RegistrarImage string
|
||||
ProvisionerImage string
|
||||
AttacherImage string
|
||||
@@ -128,7 +127,6 @@ var (
|
||||
var (
|
||||
// image names
|
||||
DefaultCSIPluginImage = "quay.io/cephcsi/cephcsi:v3.7.0"
|
||||
DefaultNFSPluginImage = "registry.k8s.io/sig-storage/nfsplugin:v4.0.0"
|
||||
DefaultRegistrarImage = "registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.5.1"
|
||||
DefaultProvisionerImage = "registry.k8s.io/sig-storage/csi-provisioner:v3.2.1"
|
||||
DefaultAttacherImage = "registry.k8s.io/sig-storage/csi-attacher:v3.5.0"
|
||||
@@ -162,6 +160,8 @@ var (
|
||||
NFSPluginTemplatePath string
|
||||
//go:embed template/nfs/csi-nfsplugin-provisioner-dep.yaml
|
||||
NFSProvisionerDepTemplatePath string
|
||||
//go:embed template/nfs/csi-nfsplugin-holder.yaml
|
||||
NFSPluginHolderTemplatePath string
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -240,6 +240,7 @@ const (
|
||||
|
||||
RBDDriverShortName = "rbd"
|
||||
CephFSDriverShortName = "cephfs"
|
||||
NFSDriverShortName = "nfs"
|
||||
rbdDriverSuffix = "rbd.csi.ceph.com"
|
||||
cephFSDriverSuffix = "cephfs.csi.ceph.com"
|
||||
)
|
||||
@@ -375,6 +376,14 @@ func (r *ReconcileCSI) startDrivers(ver *version.Info, ownerInfo *k8sutil.OwnerI
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to load nfs provisioner deployment template")
|
||||
}
|
||||
enabledDrivers = append(enabledDrivers, driverDetails{
|
||||
name: NFSDriverShortName,
|
||||
fullName: NFSDriverName,
|
||||
holderTemplate: NFSPluginHolderTemplatePath,
|
||||
nodeAffinity: nfsPluginNodeAffinityEnv,
|
||||
toleration: nfsPluginTolerationsEnv,
|
||||
resource: nfsPluginResource,
|
||||
})
|
||||
}
|
||||
|
||||
holderEnabled := !CSIParam.EnableCSIHostNetwork
|
||||
@@ -561,7 +570,10 @@ func (r *ReconcileCSI) startDrivers(ver *version.Info, ownerInfo *k8sutil.OwnerI
|
||||
}
|
||||
if holderEnabled {
|
||||
nfsPlugin.Spec.Template.Spec.HostNetwork = false
|
||||
// HostPID is used to communicate with the network namespace
|
||||
nfsPlugin.Spec.Template.Spec.HostPID = true
|
||||
}
|
||||
|
||||
err = k8sutil.CreateDaemonSet(r.opManagerContext, r.opConfig.OperatorNamespace, r.context.Clientset, nfsPlugin)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to start nfs plugin daemonset %q", nfsPlugin.Name)
|
||||
@@ -832,6 +844,7 @@ func (r *ReconcileCSI) configureHolder(driver driverDetails, c ClusterDetail, tp
|
||||
Monitors: MonEndpoints(c.clusterInfo.Monitors),
|
||||
RBD: &CsiRBDSpec{},
|
||||
CephFS: &CsiCephFSSpec{},
|
||||
NFS: &CsiNFSSpec{},
|
||||
}
|
||||
netNamespaceFilePath := generateNetNamespaceFilePath(CSIParam.KubeletDirPath, driver.fullName, c.cluster.Namespace)
|
||||
if driver.name == RBDDriverShortName {
|
||||
@@ -840,6 +853,9 @@ func (r *ReconcileCSI) configureHolder(driver driverDetails, c ClusterDetail, tp
|
||||
if driver.name == CephFSDriverShortName {
|
||||
clusterConfigEntry.CephFS.NetNamespaceFilePath = netNamespaceFilePath
|
||||
}
|
||||
if driver.name == NFSDriverShortName {
|
||||
clusterConfigEntry.NFS.NetNamespaceFilePath = netNamespaceFilePath
|
||||
}
|
||||
// Save the path of the network namespace file for ceph-csi to use
|
||||
err = SaveClusterConfig(r.context.Clientset, c.cluster.Namespace, c.clusterInfo, clusterConfigEntry)
|
||||
if err != nil {
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# This DaemonSet is only active when the cluster is deployed with Multus enabled or EnableCSIHostNetwork
|
||||
# is set to false. Hopefully in the future it will be part of every Ceph-CSI deployment. Its role is to
|
||||
# "hold" the Ceph Filesystem mounts that are created by the CSI driver. Essentially, it exposes its
|
||||
# network namespace into the Kubelet plugin directly and Ceph-CSI picks it up. When mounting, the Ceph-CSI
|
||||
# driver will use the network namespace of the DaemonSet instead of its own (the plugin pod). This pod
|
||||
# is not expected to be updated nor restarted unless the node reboots.
|
||||
kind: DaemonSet
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
name: csi-nfsplugin-holder
|
||||
namespace: {{ .Namespace }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: csi-nfsplugin-holder
|
||||
updateStrategy:
|
||||
# DO NOT CHANGE THE STRATEGY
|
||||
# The pod is not supposed to be restarted on updates, it should never receive updates too.
|
||||
# If it does then the connectivity to the Ceph cluster will be lost and the client I/O will
|
||||
# fail.
|
||||
type: OnDelete
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: csi-nfsplugin-holder
|
||||
{{ range $key, $value := .CSINFSPodLabels }}
|
||||
{{ $key }}: "{{ $value }}"
|
||||
{{ end }}
|
||||
spec:
|
||||
# HostPID is needed to expose the correct process ID network namespace and not the process namespace
|
||||
hostPID: true
|
||||
serviceAccountName: rook-csi-nfs-plugin-sa
|
||||
{{ if .PluginPriorityClassName }}
|
||||
priorityClassName: {{ .PluginPriorityClassName }}
|
||||
{{ end }}
|
||||
containers:
|
||||
- name: csi-nfsplugin-holder
|
||||
# This is necessary for the Bidirectional mount propagation
|
||||
securityContext:
|
||||
privileged: true
|
||||
image: {{ .CSIPluginImage }}
|
||||
command:
|
||||
- "/bin/sh"
|
||||
- "-c"
|
||||
# the third $ allows the "$$" to be interpreted so it can return the current bash process ID
|
||||
args:
|
||||
- "ln
|
||||
--force
|
||||
--symbolic
|
||||
--verbose
|
||||
/proc/$$$/ns/net
|
||||
{{ .KubeletDirPath }}/plugins/$ROOK_CEPH_CSI_DRIVER_NAME/$CEPH_CLUSTER_NAMESPACE.net.ns
|
||||
&&
|
||||
sleep
|
||||
infinity"
|
||||
volumeMounts:
|
||||
- name: plugin-mount-dir
|
||||
mountPath: "{{ .KubeletDirPath }}/plugins"
|
||||
mountPropagation: "Bidirectional"
|
||||
volumes:
|
||||
- name: plugin-mount-dir
|
||||
hostPath:
|
||||
path: "{{ .KubeletDirPath }}/plugins"
|
||||
type: Directory
|
||||
@@ -55,10 +55,13 @@ spec:
|
||||
- SYS_ADMIN
|
||||
privileged: true
|
||||
args:
|
||||
- "--v={{ .LogLevel }}"
|
||||
- "--drivername={{ .DriverNamePrefix }}nfs.csi.ceph.com"
|
||||
- --nodeid=$(NODE_ID)
|
||||
- --endpoint=$(CSI_ENDPOINT)
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--type=nfs"
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
- "--v={{ .LogLevel }}"
|
||||
- "--nodeserver=true"
|
||||
- "--drivername={{ .DriverNamePrefix }}nfs.csi.ceph.com"
|
||||
- "--pidlimit=-1"
|
||||
env:
|
||||
- name: NODE_ID
|
||||
valueFrom:
|
||||
@@ -67,19 +70,49 @@ spec:
|
||||
fieldPath: spec.nodeName
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix:///csi/csi.sock
|
||||
image: {{ .NFSPluginImage }}
|
||||
image: {{ .CSIPluginImage }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
volumeMounts:
|
||||
- name: plugin-dir
|
||||
mountPath: /csi
|
||||
- name: csi-plugins-dir
|
||||
mountPath: "{{ .KubeletDirPath }}/plugins"
|
||||
mountPropagation: "Bidirectional"
|
||||
- name: pods-mount-dir
|
||||
mountPath: "{{ .KubeletDirPath }}/pods"
|
||||
mountPropagation: "Bidirectional"
|
||||
- name: host-sys
|
||||
mountPath: /sys
|
||||
- name: lib-modules
|
||||
mountPath: /lib/modules
|
||||
readOnly: true
|
||||
- name: host-dev
|
||||
mountPath: /dev
|
||||
- name: ceph-csi-config
|
||||
mountPath: /etc/ceph-csi-config/
|
||||
- name: keys-tmp-dir
|
||||
mountPath: /tmp/csi/keys
|
||||
- name: host-run-mount
|
||||
mountPath: /run/mount
|
||||
{{ if .EnablePluginSelinuxHostMount }}
|
||||
- name: etc-selinux
|
||||
mountPath: /etc/selinux
|
||||
readOnly: true
|
||||
{{ end }}
|
||||
{{ if .MountCustomCephConf }}
|
||||
- name: ceph-config
|
||||
mountPath: /etc/ceph/ceph.conf
|
||||
subPath: ceph.conf
|
||||
{{ end }}
|
||||
volumes:
|
||||
- name: plugin-dir
|
||||
hostPath:
|
||||
path: "{{ .KubeletDirPath }}/plugins/{{ .DriverNamePrefix }}nfs.csi.ceph.com/"
|
||||
type: DirectoryOrCreate
|
||||
- name: csi-plugins-dir
|
||||
hostPath:
|
||||
path: "{{ .KubeletDirPath }}/plugins"
|
||||
type: Directory
|
||||
- name: registration-dir
|
||||
hostPath:
|
||||
path: "{{ .KubeletDirPath }}/plugins_registry/"
|
||||
@@ -88,3 +121,38 @@ spec:
|
||||
hostPath:
|
||||
path: "{{ .KubeletDirPath }}/pods"
|
||||
type: Directory
|
||||
- name: host-sys
|
||||
hostPath:
|
||||
path: /sys
|
||||
- name: lib-modules
|
||||
hostPath:
|
||||
path: /lib/modules
|
||||
- name: host-dev
|
||||
hostPath:
|
||||
path: /dev
|
||||
- name: ceph-csi-config
|
||||
configMap:
|
||||
name: rook-ceph-csi-config
|
||||
items:
|
||||
- key: csi-cluster-config-json
|
||||
path: config.json
|
||||
- name: keys-tmp-dir
|
||||
emptyDir: {
|
||||
medium: "Memory"
|
||||
}
|
||||
- name: host-run-mount
|
||||
hostPath:
|
||||
path: /run/mount
|
||||
{{ if .EnablePluginSelinuxHostMount }}
|
||||
- name: etc-selinux
|
||||
hostPath:
|
||||
path: /etc/selinux
|
||||
{{ end }}
|
||||
{{ if .MountCustomCephConf }}
|
||||
- name: ceph-config
|
||||
configMap:
|
||||
name: csi-ceph-conf-override
|
||||
items:
|
||||
- key: ceph.conf
|
||||
path: ceph.conf
|
||||
{{ end }}
|
||||
@@ -164,7 +164,7 @@ function build_rook_all() {
|
||||
|
||||
function validate_yaml() {
|
||||
cd deploy/examples
|
||||
kubectl create -f crds.yaml -f common.yaml
|
||||
kubectl create -f crds.yaml -f common.yaml -f csi/nfs/rbac.yaml
|
||||
|
||||
# create and use PSPs on k8s versions older than 1.21
|
||||
kube_minor_ver="$(kubectl version -o json | jq -r '.serverVersion.minor')"
|
||||
@@ -192,10 +192,11 @@ function validate_yaml() {
|
||||
|
||||
function create_cluster_prerequisites() {
|
||||
# this might be called from another function that has already done a cd
|
||||
(cd deploy/examples && kubectl create -f crds.yaml -f common.yaml)
|
||||
( cd deploy/examples && kubectl create -f crds.yaml -f common.yaml -f csi/nfs/rbac.yaml )
|
||||
}
|
||||
|
||||
function deploy_manifest_with_local_build() {
|
||||
sed -i 's/.*ROOK_CSI_ENABLE_NFS:.*/ ROOK_CSI_ENABLE_NFS: \"true\"/g' $1
|
||||
if [[ "$USE_LOCAL_BUILD" != "false" ]]; then
|
||||
sed -i "s|image: rook/ceph:.*|image: rook/ceph:local-build|g" $1
|
||||
fi
|
||||
@@ -254,6 +255,7 @@ function deploy_csi_hostnetwork_disabled_cluster() {
|
||||
elif [ "$1" = "osd_with_metadata_device" ]; then
|
||||
sed -i "s|#deviceFilter:|deviceFilter: ${BLOCK/\/dev\//}\n config:\n metadataDevice: /dev/test-rook-vg/test-rook-lv|g" cluster-test.yaml
|
||||
fi
|
||||
kubectl create -f nfs-test.yaml
|
||||
kubectl create -f cluster-test.yaml
|
||||
kubectl create -f filesystem-test.yaml
|
||||
deploy_manifest_with_local_build toolbox.yaml
|
||||
@@ -467,11 +469,14 @@ EOF
|
||||
|
||||
function deploy_multus_cluster() {
|
||||
cd deploy/examples
|
||||
sed -i 's/.*ROOK_CSI_ENABLE_NFS:.*/ ROOK_CSI_ENABLE_NFS: \"true\"/g' operator.yaml
|
||||
deploy_manifest_with_local_build operator.yaml
|
||||
deploy_manifest_with_local_build toolbox.yaml
|
||||
sed -i "s|#deviceFilter:|deviceFilter: ${BLOCK/\/dev\//}|g" cluster-multus-test.yaml
|
||||
kubectl create -f cluster-multus-test.yaml
|
||||
kubectl create -f filesystem-test.yaml
|
||||
# uncomment once https://github.com/rook/rook/issues/10812 is resolved.
|
||||
# kubectl create -f nfs-test.yaml
|
||||
}
|
||||
|
||||
function wait_for_ceph_csi_configmap_to_be_updated {
|
||||
@@ -487,6 +492,12 @@ until [[ $(kubectl -n rook-ceph get configmap rook-ceph-csi-config -o jsonpath="
|
||||
sleep 5
|
||||
done
|
||||
EOF
|
||||
timeout 60 bash <<EOF
|
||||
until [[ $(kubectl -n rook-ceph get configmap rook-ceph-csi-config -o jsonpath="{.data.csi-cluster-config-json}" | jq .[0].nfs.netNamespaceFilePath) != "null" ]]; do
|
||||
echo "waiting for ceph csi configmap to be updated with nfs.netNamespaceFilePath"
|
||||
sleep 5
|
||||
done
|
||||
EOF
|
||||
}
|
||||
|
||||
function test_csi_rbd_workload {
|
||||
@@ -496,7 +507,7 @@ function test_csi_rbd_workload {
|
||||
kubectl create -f storageclass.yaml
|
||||
kubectl create -f pvc.yaml
|
||||
kubectl create -f pod.yaml
|
||||
timeout 45 sh -c 'until kubectl exec -t pod/csirbd-demo-pod -- dd if=/dev/random of=/var/lib/www/html/test bs=1M count=1; do echo "waiting for test pod to be ready" && sleep 1; done'
|
||||
timeout 90 sh -c 'until kubectl exec -t pod/csirbd-demo-pod -- dd if=/dev/random of=/var/lib/www/html/test bs=1M count=1; do echo "waiting for test pod to be ready" && sleep 1; done'
|
||||
kubectl exec -t pod/csirbd-demo-pod -- dd if=/dev/random of=/var/lib/www/html/test oflag=direct bs=1M count=1
|
||||
kubectl -n rook-ceph logs ds/csi-rbdplugin -c csi-rbdplugin
|
||||
kubectl -n rook-ceph delete "$(kubectl -n rook-ceph get pod --selector=app=csi-rbdplugin --field-selector=status.phase=Running -o name)"
|
||||
@@ -509,7 +520,7 @@ function test_csi_cephfs_workload {
|
||||
kubectl create -f storageclass.yaml
|
||||
kubectl create -f pvc.yaml
|
||||
kubectl create -f pod.yaml
|
||||
timeout 45 sh -c 'until kubectl exec -t pod/csicephfs-demo-pod -- dd if=/dev/random of=/var/lib/www/html/test bs=1M count=1; do echo "waiting for test pod to be ready" && sleep 1; done'
|
||||
timeout 90 sh -c 'until kubectl exec -t pod/csicephfs-demo-pod -- dd if=/dev/random of=/var/lib/www/html/test bs=1M count=1; do echo "waiting for test pod to be ready" && sleep 1; done'
|
||||
kubectl exec -t pod/csicephfs-demo-pod -- dd if=/dev/random of=/var/lib/www/html/test oflag=direct bs=1M count=1
|
||||
kubectl -n rook-ceph logs ds/csi-cephfsplugin -c csi-cephfsplugin
|
||||
kubectl -n rook-ceph delete "$(kubectl -n rook-ceph get pod --selector=app=csi-cephfsplugin --field-selector=status.phase=Running -o name)"
|
||||
@@ -517,6 +528,19 @@ function test_csi_cephfs_workload {
|
||||
kubectl exec -t pod/csicephfs-demo-pod -- ls -alh /var/lib/www/html/
|
||||
}
|
||||
|
||||
function test_csi_nfs_workload {
|
||||
cd deploy/examples/csi/nfs
|
||||
sed -i "s|#- debug|- nolock|" storageclass.yaml
|
||||
kubectl create -f storageclass.yaml
|
||||
kubectl create -f pvc.yaml
|
||||
kubectl create -f pod.yaml
|
||||
timeout 90 sh -c 'until kubectl exec -t pod/csinfs-demo-pod -- dd if=/dev/random of=/var/lib/www/html/test bs=1M count=1; do echo "waiting for test pod to be ready" && sleep 1; done'
|
||||
kubectl exec -t pod/csinfs-demo-pod -- dd if=/dev/random of=/var/lib/www/html/test oflag=direct bs=1M count=1
|
||||
kubectl -n rook-ceph delete "$(kubectl -n rook-ceph get pod --selector=app=csi-nfsplugin --field-selector=status.phase=Running -o name)"
|
||||
kubectl exec -t pod/csinfs-demo-pod -- dd if=/dev/random of=/var/lib/www/html/test1 oflag=direct bs=1M count=1
|
||||
kubectl exec -t pod/csinfs-demo-pod -- ls -alh /var/lib/www/html/
|
||||
}
|
||||
|
||||
FUNCTION="$1"
|
||||
shift # remove function arg now that we've recorded it
|
||||
# call the function with the remainder of the user-provided args
|
||||
|
||||
@@ -92,12 +92,12 @@ function test_csi {
|
||||
echo $IS_POD_NETWORK
|
||||
echo $IS_MULTUS
|
||||
if [ -z "$IS_POD_NETWORK" ]; then
|
||||
until [[ "$(kubectl -n rook-ceph get pods --field-selector=status.phase=Running|grep -c ^csi-)" -eq 4 ]]; do
|
||||
until [[ "$(kubectl -n rook-ceph get pods --field-selector=status.phase=Running|grep -c ^csi-)" -eq 6 ]]; do
|
||||
echo "waiting for csi pods to be ready"
|
||||
sleep 5
|
||||
done
|
||||
else
|
||||
until [[ "$(kubectl -n rook-ceph get pods --field-selector=status.phase=Running|grep -c ^csi-)" -eq 6 ]]; do
|
||||
until [[ "$(kubectl -n rook-ceph get pods --field-selector=status.phase=Running|grep -c ^csi-)" -eq 9 ]]; do
|
||||
echo "waiting for csi pods to be ready with multus or pod networking"
|
||||
sleep 5
|
||||
done
|
||||
@@ -106,6 +106,7 @@ function test_csi {
|
||||
echo "verifying csi holder interfaces (multus ones must be present)"
|
||||
kubectl -n rook-ceph exec -t ds/csi-rbdplugin-holder-my-cluster -- grep net /proc/net/dev
|
||||
kubectl -n rook-ceph exec -t ds/csi-cephfsplugin-holder-my-cluster -- grep net /proc/net/dev
|
||||
kubectl -n rook-ceph exec -t ds/csi-nfsplugin-holder-my-cluster -- grep net /proc/net/dev
|
||||
fi
|
||||
EOF
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user