# to simulate remote operation with local socket
#PLUGDOCKERHOST="tcp://10.0.0.1:2376"
+#
+# This is a Kubernetes Plugin configuration variables
+#
+#KUBECTL=/usr/bin/kubectl
+#KUBECONFIG=~/.kube/config
+# If you want to test feature with volume snapshots change to != 0.
+#KUBE_PROXY_BACKUP_TEST=0
+# The next parameters is to test with proxy backups.
+
+#KUBE_PROXY_POD_PLUGIN_HOST="<IP>" # Example FD ip: 192.168.0.99
+#KUBE_BACULA_IMAGE="bacula-backup:latest"
+# If you don't have a certificate, you can generate it automatically by activating the KUBE_GEN_CERT variable, otherwise you can generate it with these commands:
+# openssl req -new -newkey rsa:4096 -nodes -keyout /tmp/snakeoil.key -out /tmp/snakeoil.csr
+# openssl x509 -req -sha256 -days 365 -in /tmp/snakeoil.csr -signkey /tmp/snakeoil.key -out /tmp/snakeoil.pem
+#KUBE_GEN_CERT=1
+#KUBE_FD_CERT_DIR=/tmp/
+#KUBE_FD_CERT_NAME=snakeoil
+
+#KUBE_FD_CERT_FILE=${KUBE_FD_CERT_DIR}${KUBE_FD_CERT_NAME}.pem
+#KUBE_FD_KEY_FILE=${KUBE_FD_CERT_DIR}${KUBE_FD_CERT_NAME}.key
+
#
# This is a config variable for GPFS regression tests
# It should point to the mounted GPFS
FileSet = TestPluginKubernetesSet3
}
+FileSet {
+ Name = "TestPluginKubernetesSet4"
+ Include { Options { signature=SHA1 }
+ Plugin = "@LPLUG@ namespace=plugintest persistentvolume=@PV_CSI1@ @BACKUP_PROXY_ARGS@"
+ }
+}
+Job {
+ Name = "PluginKubernetesTest4"
+ JobDefs = Default
+ FileSet = TestPluginKubernetesSet4
+}
+
FileSet {
Name = "TestPluginKubernetesSet11"
Include { Options { signature=SHA1 }
--- /dev/null
+apiVersion: storage.k8s.io/v1
+kind: StorageClass
+metadata:
+ name: csi-hostpath-sc
+provisioner: hostpath.csi.k8s.io
+reclaimPolicy: Delete
+volumeBindingMode: Immediate
+allowVolumeExpansion: true
+---
+apiVersion: v1
+kind: PersistentVolumeClaim
+metadata:
+ name: plugintest-persistent-volume-claim-csi
+spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 1Gi
+ storageClassName: csi-hostpath-sc
\ No newline at end of file
fi
${KUBECTL} apply -f scripts/kubernetes-plugintest.yaml 2>&1 >> ${tmp}/kube.log
+if [ $KUBE_PROXY_BACKUP_TEST -ne 0 ]
+then
+ ${KUBECTL} apply -f scripts/kubernetes-plugintest-csi-driver.yaml 2>&1 >> ${tmp}/kube.log
+fi
+
i=0
SPIN=('-' '\\' '|' '/')
printf "waiting to ready ... "
${KUBECTL} get ns -o name > ${tmp}/allns.log
${KUBECTL} get pv -o name > ${tmp}/allpv.log
PV1=`${KUBECTL} -n plugintest get pvc/plugintest-persistent-volume-claim -o go-template='{{.spec.volumeName}}'`
+PV_CSI1=`${KUBECTL} -n plugintest get pvc/plugintest-persistent-volume-claim-csi -o go-template='{{.spec.volumeName}}'`
+BACKUP_PROXY_ARGS=""
+
+if [ $KUBE_PROXY_BACKUP_TEST -ne 0 ]
+then
+ if [ $KUBE_GEN_CERT -ne 0 ]
+ then
+ setup_self_signed_cert $KUBE_FD_CERT_DIR $KUBE_FD_CERT_NAME
+ if [ "x$KUBE_FD_CERT_FILE" = "x" ]
+ then
+ KUBE_FD_CERT_FILE=${KUBE_FD_CERT_DIR}${KUBE_FD_CERT_NAME}.pem
+ KUBE_FD_KEY_FILE=${KUBE_FD_CERT_DIR}${KUBE_FD_CERT_NAME}.key
+ fi
+ fi
+ BACKUP_PROXY_CERTS="fdkeyfile=$KUBE_FD_KEY_FILE fdcertfile=$KUBE_FD_CERT_FILE"
+ BACKUP_PROXY_ARGS="pvcdata baculaimage=${KUBE_BACULA_IMAGE} pluginhost=${KUBE_PROXY_POD_PLUGIN_HOST}"
+ BACKUP_PROXY_ARGS="$BACKUP_PROXY_ARGS $BACKUP_PROXY_CERTS"
+fi
+
# prepare kubernetes backend
export PLUGIN_WORKING=${cwd}/working
out_sed="${tmp}/sed_tmp"
echo "s%@LPLUG@%${LPLUG}%" > ${out_sed}
echo "s%@PV1@%${PV1}%" >> ${out_sed}
+echo "s%@PV_CSI1@%${PV_CSI1}%" >> ${out_sed}
+echo "s%@BACKUP_PROXY_ARGS@%${BACKUP_PROXY_ARGS}%" >> ${out_sed}
sed -i -f ${out_sed} ${conf}/bacula-dir.conf
regress_test_result ${F}
done
+# second, backup with proxy backup if it's activated
+if [ $KUBE_PROXY_BACKUP_TEST -ne 0 ]
+then
+ expected_string_in_log="is compatible with volume snapshot backup"
+ TEST=4
+ do_regress_backup_test ${TEST}
+ check_regress_backup_statusT ${TEST}
+ F=$?
+ echo "Check backup statusT:" $(regress_test_result ${F})
+ check_regress_string_in_log "b" "${expected_string_in_log}" ${TEST}
+ F=$?
+ echo "Check use volume snapshot tecnology: " $(regress_test_result ${F})
+fi
+
# now, backup with warnings
for TEST in `seq 11 13`
do