├── .DS_Store ├── .github ├── auto_assign.yaml └── workflows │ ├── auto_assign_prs.yml │ ├── build.yml │ ├── chart-lint-test.yml │ ├── pull_request.yml │ ├── release-charts.yml │ └── release.yml ├── .gitignore ├── .gitpod.yml ├── .muse └── config.toml ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── Makefile.buildx.mk ├── README.md ├── build ├── build.sh ├── cspc-operator │ ├── Dockerfile │ └── cspc-operator.Dockerfile ├── cstor-webhook │ ├── Dockerfile │ └── cstor-webhook.Dockerfile ├── cvc-operator │ ├── Dockerfile │ └── cvc-operator.Dockerfile ├── generate-manifest.sh ├── pool-manager │ ├── Dockerfile │ ├── entrypoint.sh │ └── pool-manager.Dockerfile ├── push └── volume-manager │ ├── Dockerfile │ ├── Dockerfile.arm64 │ ├── entrypoint.sh │ └── volume-manager.Dockerfile ├── changelogs ├── released │ ├── v2.3.0-RC1 │ │ ├── 155-shubham14bajpai │ │ ├── 187-prateekpandey14 │ │ ├── 197-prateekpandey14 │ │ ├── 198-zlymeda │ │ └── 205-daximillian │ ├── v2.7.0-RC1 │ │ └── 257-prateekpandey14 │ └── v2.8.0-RC1 │ │ ├── 263-niladrih │ │ ├── 267-prateekpandey14 │ │ ├── 270-shubham14bajpai │ │ ├── 273-prateekpandey14 │ │ └── 275-prateekpandey14 └── unreleased │ └── 349-prateekpandey14 ├── ci ├── artifacts │ ├── busybox-csi-cstor-sparse.yaml │ ├── csi-storageclass.yaml │ └── cspc-template.yaml └── sanity │ ├── install.sh │ └── sanity.sh ├── cmd ├── cspc-operator │ ├── app │ │ └── start.go │ └── main.go ├── cvc-operator │ └── main.go ├── pool-manager │ ├── app │ │ └── start.go │ └── main.go ├── volume-manager │ ├── app │ │ ├── commands.go │ │ ├── commands_test.go │ │ └── start.go │ └── main.go └── webhook │ └── main.go ├── ct.yaml ├── deploy ├── crds │ └── all_cstor_crds.yaml ├── cstor-operator.yaml ├── helm │ └── charts │ │ ├── .helmignore │ │ ├── Chart.yaml │ │ ├── README.md │ │ ├── crds │ │ ├── cstorbackup.yaml │ │ ├── cstorcompletedbackup.yaml │ │ ├── cstorpoolcluster.yaml │ │ ├── cstorpoolinstance.yaml │ │ ├── cstorrestore.yaml │ │ ├── cstorvolume.yaml │ │ ├── cstorvolumeattachment.yaml │ │ ├── cstorvolumeconfig.yaml │ │ ├── cstorvolumepolicy.yaml │ │ ├── cstorvolumereplica.yaml │ │ ├── migrationtask.yaml │ │ └── upgradetask.yaml │ │ ├── templates │ │ ├── NOTES.txt │ │ ├── _helpers.tpl │ │ ├── admission-server.yaml │ │ ├── cleanup-webhook.yaml │ │ ├── csi-controller-rbac.yaml │ │ ├── csi-controller.yaml │ │ ├── csi-driver.yaml │ │ ├── csi-iscsiadm-config.yaml │ │ ├── csi-node-rbac.yaml │ │ ├── csi-node.yaml │ │ ├── cspc-operator.yaml │ │ ├── cvc-operator-service.yaml │ │ ├── cvc-operator.yaml │ │ ├── priority-class.yaml │ │ ├── psp.yaml │ │ ├── rbac.yaml │ │ ├── snapshot-class.yaml │ │ ├── volumesnapshot.yaml │ │ ├── volumesnapshotclass.yaml │ │ └── volumesnapshotcontent.yaml │ │ └── values.yaml ├── snapshot_class.yaml └── yamls │ ├── csi-operator.yaml │ ├── cspc-operator.yaml │ ├── ndm-operator.yaml │ └── rbac.yaml ├── docs ├── .DS_Store ├── api-references │ └── apis.md ├── developer-guide │ ├── cstor-pool.md │ ├── cstor-volume.md │ ├── devel.md │ └── start.md ├── quick.md ├── troubleshooting │ ├── application_node_reboot.md │ ├── migrate_cstor_volume.md │ ├── migrate_pool_by_migrating_disks.md │ ├── pool_operations_hung.md │ ├── rancher_prerequisite.md │ └── troubleshooting.md ├── tutorial │ ├── airgap.md │ ├── cspc │ │ ├── allow-tagged-bds │ │ │ └── allowed-bds.md │ │ ├── mirror │ │ │ └── mirror.md │ │ ├── stripe │ │ │ └── stripe.md │ │ └── tuning │ │ │ └── tune.md │ ├── intro.md │ └── volumes │ │ ├── block_volume.md │ │ ├── migration.md │ │ ├── policy.md │ │ ├── prometheus-monitoring.md │ │ ├── resize.md │ │ ├── rwx-with-nfs.md │ │ ├── snapshot.md │ │ ├── storageclass.md │ │ └── volume.md └── workload │ ├── elasticsearch │ ├── elasticsearch-deployment.svg │ ├── elasticsearch.md │ └── o-elastic.png │ ├── prometheus-operator │ ├── o-prometheus.png │ ├── prometheus-deployment.svg │ └── prometheus.md │ └── wordpress │ ├── RWX-WordPress.svg │ └── wordpress-rwx.md ├── e2e-tests ├── Dockerfile ├── README.md ├── apps │ ├── busybox │ │ ├── deployers │ │ │ ├── busybox_deployment.yml │ │ │ ├── busybox_statefulset.yml │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ └── liveness │ │ │ ├── busybox_liveness.yml │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── vars.yml │ ├── minio │ │ └── deployers │ │ │ ├── minio-pvc.yml │ │ │ ├── minio.yml │ │ │ ├── minio_prerequisites.yml │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ ├── nfs-provisioner │ │ ├── nfs-deployment.yml │ │ ├── run_e2e_test.yml │ │ ├── test.yml │ │ └── test_vars.yml │ ├── percona │ │ ├── deployers │ │ │ ├── percona.yml │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ └── workload │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ ├── test_vars.yml │ │ │ ├── tpcc.conf │ │ │ └── tpcc_bench.yml │ └── wordpress │ │ └── deployers │ │ ├── README.md │ │ ├── mysql.yml │ │ ├── run_e2e_test.yml │ │ ├── test.yml │ │ ├── test_vars.yml │ │ └── wordpress.yml ├── chaoslib │ ├── containerd_chaos │ │ ├── containerd-chaos-ds.yml │ │ ├── crictl-chaos.yml │ │ └── openebs-pool-failure.yml │ ├── crio_chaos │ │ ├── crio-chaos-ds.yml │ │ ├── crio-crictl-chaos.yml │ │ └── openebs-pool-failure.yml │ ├── kubectl │ │ ├── app_pod_failure.yaml │ │ ├── app_pod_random_delete.yaml │ │ ├── cordon_drain_node.yaml │ │ └── pod_evict_by_taint.yaml │ ├── openebs │ │ ├── cstor_cspc_pool_kill.yml │ │ ├── cstor_target_container_kill.yml │ │ ├── cstor_target_failure.yaml │ │ ├── cstor_target_network_delay.yaml │ │ ├── inject_network_delay_tc.yml │ │ └── inject_packet_loss_tc.yml │ ├── pumba │ │ ├── pod_failure_by_sigkill.yaml │ │ └── pumba_kube.yaml │ ├── service_failure │ │ └── service_chaos.yml │ └── vmware_chaos │ │ └── vm_power_operations.yml ├── experiments │ ├── chaos │ │ ├── app_pod_failure │ │ │ ├── README.md │ │ │ ├── data_persistence.j2 │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ ├── cspc_pool_failure │ │ │ ├── container_failure │ │ │ │ ├── README.md │ │ │ │ ├── data_persistence.j2 │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ ├── disk_replacement_inprogress │ │ │ │ ├── README.md │ │ │ │ ├── data_persistence.j2 │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ └── pool_expansion_inprogress │ │ │ │ ├── README.md │ │ │ │ ├── add_blockdevice.yml │ │ │ │ ├── node_index_count │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ ├── openebs_target_failure │ │ │ ├── README.md │ │ │ ├── chaosutil.j2 │ │ │ ├── data_persistence.j2 │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ ├── openebs_target_network_delay │ │ │ ├── README.md │ │ │ ├── chaosutil.j2 │ │ │ ├── data_persistence.j2 │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ └── openebs_target_network_loss │ │ │ ├── README.md │ │ │ ├── data_persistence.j2 │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ ├── cstor-operator │ │ ├── cspc-pool-provision │ │ │ ├── add_blockdevice.yml │ │ │ ├── blockdevice.j2 │ │ │ ├── cspc.yml │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ ├── cstor-operator-provisioner │ │ │ ├── README.md │ │ │ ├── run_e2e_test.yml │ │ │ ├── snapshot-class.j2 │ │ │ ├── test.yml │ │ │ ├── test_vars.yml │ │ │ └── update_env.yaml │ │ └── cstor-storage-policies │ │ │ ├── csi-cstor-sc.j2 │ │ │ ├── csi-cstor-xfs-sc.j2 │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ ├── functional │ │ ├── app-target-affinity │ │ │ ├── README.md │ │ │ ├── app-target-affinity-policy.yml │ │ │ ├── app-target-affinity-sc.yaml │ │ │ ├── percona.yml │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ ├── backup_and_restore │ │ │ ├── additional_verification.yml │ │ │ ├── backup-restore.yml │ │ │ ├── credentials-velero │ │ │ ├── gcp-volume-snapshot-location.yml │ │ │ ├── local-volume-snapshot-location.yml │ │ │ ├── minio-volume-snapshot-location.yml │ │ │ ├── run_e2e_test.yml │ │ │ ├── setup_dependency.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ ├── csi-clone │ │ │ ├── busybox.j2 │ │ │ ├── clone.j2 │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ ├── csi-snapshot │ │ │ ├── run_e2e_test.yml │ │ │ ├── snapshot.j2 │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ ├── csi-volume-resize │ │ │ ├── README.md │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ ├── cspc-pool │ │ │ ├── block-pool-creation-bd-with-filesystem │ │ │ │ ├── README.md │ │ │ │ ├── create_filesystem.yml │ │ │ │ ├── cspc.yml │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ ├── block-pool-creation-with-claimed-bd │ │ │ │ ├── README.md │ │ │ │ ├── add_blockdevice.yml │ │ │ │ ├── blockdevice.j2 │ │ │ │ ├── cspc.yml │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ ├── block-pool-deletion-with-volume │ │ │ │ ├── README.md │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ ├── block-pool-scaledown-with-volume │ │ │ │ ├── README.md │ │ │ │ ├── node_index_count │ │ │ │ ├── pool_scaledown.yml │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ ├── blockdevice-reusability │ │ │ │ ├── README.md │ │ │ │ ├── add_blockdevice.yml │ │ │ │ ├── blockdevice.j2 │ │ │ │ ├── cspc.yml │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ ├── disk-replacement │ │ │ │ ├── README.md │ │ │ │ ├── add_blockdevice.yml │ │ │ │ ├── data_persistence.j2 │ │ │ │ ├── node_index_count │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ ├── fail_bd_replacement_with_claimed_bd │ │ │ │ ├── README.md │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ ├── fail_pool_expansion_with_claimed_bd │ │ │ │ ├── README.md │ │ │ │ ├── add_blockdevice.yml │ │ │ │ ├── node_index_count │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ ├── pool_expansion │ │ │ │ ├── add_blockdevice.yml │ │ │ │ ├── node_index_count │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ │ └── pool_scaleup │ │ │ │ ├── add_blockdevice.yml │ │ │ │ ├── run_e2e_test.yml │ │ │ │ ├── test.yml │ │ │ │ └── test_vars.yml │ │ ├── cstor-csi-volume-scaledown │ │ │ ├── README.md │ │ │ ├── data_persistence.j2 │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ └── cstor-csi-volume-scaleup │ │ │ ├── README.md │ │ │ ├── data_persistence.j2 │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ └── infra-chaos │ │ ├── drain_node │ │ ├── README.md │ │ ├── run_e2e_test.yml │ │ ├── test.yml │ │ └── test_vars.yml │ │ ├── kubernetes │ │ └── service_failure │ │ │ ├── data_persistence.j2 │ │ │ ├── run_e2e_test.yml │ │ │ ├── test.yml │ │ │ └── test_vars.yml │ │ ├── multiple_application_on_single_volume │ │ ├── README.md │ │ ├── chaosutil.j2 │ │ ├── data_availability_check.yml │ │ ├── data_persistence.j2 │ │ ├── run_e2e_test.yml │ │ ├── test.yml │ │ └── test_vars.yml │ │ ├── node_failure │ │ ├── README.md │ │ ├── chaosutil.j2 │ │ ├── data_persistence.j2 │ │ ├── run_e2e_test.yml │ │ ├── test.yml │ │ └── test_vars.yml │ │ └── taint_node │ │ ├── README.md │ │ ├── run_e2e_test.yml │ │ ├── test.yml │ │ └── test_vars.yml ├── hack │ ├── crds.yaml │ ├── e2e-result.j2 │ ├── push │ └── rbac.yaml └── utils │ ├── fcm │ ├── create_testname.yml │ └── update_e2e_result_resource.yml │ ├── k8s │ ├── application_liveness_check.yml │ ├── check_deployment_status.yml │ ├── check_no_of_nodes.yml │ ├── check_statefulset_status.yml │ ├── create_ns.yml │ ├── deploy_app_svc.yml │ ├── deploy_application.yml │ ├── deploy_single_app.yml │ ├── deprovision_deployment.yml │ ├── deprovision_statefulset.yml │ ├── fetch_app_pod.yml │ ├── pre_create_app_deploy.yml │ ├── scale_statefulset_replicas.yml │ ├── status_app_pod.yml │ └── status_testns.yml │ └── scm │ ├── applications │ ├── busybox │ │ └── busybox_data_persistence.yml │ └── mysql │ │ ├── check_db_connection.yml │ │ └── mysql_data_persistence.yml │ └── openebs │ ├── check_replica_count.yml │ ├── csi-app-target-affinity-policy.yml │ ├── csi_target_affinity_check.yml │ ├── cstor_pool_deploy_check.yml │ ├── delete_cstor_csi_clone.yml │ ├── delete_cstor_csi_snapshot.yml │ ├── disable_compression_on_pools.yml │ ├── fetch_cstor_pool_pods.yml │ ├── fetch_replica_values.yml │ └── target_affinity_check.yml ├── examples ├── cspc │ ├── cspc-single.yaml │ ├── cspc.yaml │ └── cspi.yaml └── doc.md ├── go.mod ├── go.sum ├── hack └── api-docs │ ├── config.json │ └── template │ ├── members.tpl │ ├── pkg.tpl │ └── type.tpl ├── pkg ├── controllers │ ├── backup-controller │ │ ├── controller.go │ │ ├── controller_test.go │ │ ├── handler.go │ │ └── runner.go │ ├── common │ │ ├── common.go │ │ └── common_test.go │ ├── cspc-controller │ │ ├── cleanup.go │ │ ├── cleanup_test.go │ │ ├── controller.go │ │ ├── handler.go │ │ ├── handler_test.go │ │ ├── operations.go │ │ ├── runner.go │ │ ├── scale.go │ │ ├── status.go │ │ ├── sync.go │ │ └── util │ │ │ ├── cspc_util.go │ │ │ └── cspc_util_test.go │ ├── cspi-controller │ │ ├── controller.go │ │ ├── handler.go │ │ ├── handler_test.go │ │ ├── runner.go │ │ ├── status.go │ │ ├── status_test.go │ │ ├── util │ │ │ └── cspi_utils.go │ │ └── utils.go │ ├── cstorvolumeconfig │ │ ├── controller.go │ │ ├── controller_base.go │ │ ├── controller_test.go │ │ ├── deployment.go │ │ ├── pdb.go │ │ ├── policy.go │ │ ├── start.go │ │ ├── volume_operations.go │ │ └── volume_operations_test.go │ ├── replica-controller │ │ ├── controller.go │ │ ├── controller_test.go │ │ ├── handler.go │ │ ├── handler_test.go │ │ ├── runner.go │ │ └── runner_test.go │ ├── restore-controller │ │ ├── handler.go │ │ ├── handler_test.go │ │ ├── new_restore_controller.go │ │ ├── new_restore_controller_test.go │ │ ├── run_restore_controller.go │ │ └── run_restore_controller_test.go │ ├── testutil │ │ ├── test_utils.go │ │ └── zcmd │ │ │ ├── executor │ │ │ └── executor.go │ │ │ ├── zfs │ │ │ ├── fake.go │ │ │ ├── get.go │ │ │ ├── list.go │ │ │ └── stats.go │ │ │ └── zpool │ │ │ ├── add.go │ │ │ ├── create.go │ │ │ ├── delete.go │ │ │ ├── dump.go │ │ │ ├── fake.go │ │ │ ├── get.go │ │ │ ├── import.go │ │ │ ├── labelclear.go │ │ │ ├── pool_utils.go │ │ │ ├── replace.go │ │ │ └── set.go │ └── volume-mgmt │ │ ├── controller.go │ │ ├── controller_test.go │ │ ├── handler.go │ │ ├── handler_test.go │ │ ├── runner.go │ │ ├── runner_test.go │ │ ├── start.go │ │ ├── start_test.go │ │ └── volume │ │ ├── volume.go │ │ └── volume_test.go ├── cspc │ └── algorithm │ │ ├── build_csp.go │ │ ├── build_deploy.go │ │ ├── config.go │ │ ├── doc.go │ │ ├── select_node.go │ │ └── select_node_test.go ├── debug │ ├── debug.go │ ├── inject_client.go │ ├── release.go │ └── types.go ├── log │ ├── alertlog │ │ └── log.go │ └── log.go ├── pool │ ├── operations │ │ ├── config.go │ │ ├── create.go │ │ ├── delete.go │ │ ├── disk_operation.go │ │ ├── import.go │ │ ├── modify.go │ │ ├── pool_utils.go │ │ ├── pool_utils_test.go │ │ ├── property.go │ │ ├── status.go │ │ └── utils.go │ ├── pool.go │ └── pool_test.go ├── server │ ├── config.go │ └── cstorvolumeconfig │ │ ├── backup_endpoint.go │ │ ├── backup_restore_helper.go │ │ ├── https.go │ │ ├── https_test.go │ │ ├── interface.go │ │ ├── restore_endpoint.go │ │ ├── server.go │ │ ├── v1_backup.go │ │ ├── v1alpha1_backup.go │ │ └── v1alpha1_restore.go ├── signals │ ├── signal.go │ ├── signal_posix.go │ └── signal_windows.go ├── snapshot │ ├── client.go │ ├── snapshot.go │ └── snapshottest │ │ └── snapshot.go ├── util │ └── hash │ │ ├── hash.go │ │ └── hash_test.go ├── version │ ├── util.go │ ├── util_test.go │ └── version.go ├── volume-rpc │ ├── client │ │ ├── api.go │ │ ├── api_test.go │ │ └── server.go │ └── targetserver │ │ ├── config.go │ │ └── server.go ├── volumereplica │ ├── volumereplica.go │ └── volumereplica_test.go ├── webhook │ ├── admission_response.go │ ├── configuration.go │ ├── cspc.go │ ├── cspc_operations.go │ ├── cspc_operations_test.go │ ├── cspc_test.go │ ├── cvc.go │ ├── cvc_test.go │ ├── doc.go │ ├── namespace.go │ ├── pvc.go │ ├── triple.go │ ├── util.go │ ├── util_test.go │ ├── webhook.go │ └── webhook_test.go └── zcmd │ ├── bin │ └── cmd.go │ ├── cmd.go │ ├── zfs │ ├── clone │ │ ├── builder.go │ │ ├── predicate.go │ │ └── utils.go │ ├── create │ │ ├── builder.go │ │ ├── predicate.go │ │ └── utils.go │ ├── destroy │ │ ├── builder.go │ │ ├── predicate.go │ │ └── utils.go │ ├── get │ │ ├── builder.go │ │ ├── predicate.go │ │ └── utils.go │ ├── list │ │ ├── builder.go │ │ └── predicate.go │ ├── listsnap │ │ ├── builder.go │ │ └── predicate.go │ ├── receive │ │ ├── builder.go │ │ ├── predicate.go │ │ └── utils.go │ ├── rename │ │ ├── builder.go │ │ ├── predicate.go │ │ └── utils.go │ ├── rollback │ │ ├── builder.go │ │ ├── predicate.go │ │ └── utils.go │ ├── send │ │ ├── builder.go │ │ ├── predicate.go │ │ └── utils.go │ ├── set │ │ ├── builder.go │ │ ├── predicate.go │ │ └── utils.go │ ├── snapshot │ │ ├── builder.go │ │ ├── predicate.go │ │ └── utils.go │ └── stats │ │ ├── builder.go │ │ ├── predicate.go │ │ └── stats.go │ └── zpool │ ├── add │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── attach │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── clear │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── create │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── destroy │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── detach │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── dump │ ├── builder.go │ ├── predicate.go │ ├── utils.go │ └── utils_test.go │ ├── export │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── get │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── import │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── labelclear │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── offline │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── online │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── remove │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── replace │ ├── builder.go │ ├── predicate.go │ └── utils.go │ ├── set │ ├── builder.go │ ├── predicate.go │ └── utils.go │ └── status │ ├── builder.go │ ├── predicate.go │ └── utils.go └── tests ├── cspc └── provisioning │ ├── pool_properties_test.go │ ├── provisioning_test.go │ └── suite_test.go ├── cstorvolume └── provisioing │ ├── provisioning_test.go │ ├── provisioning_utils.go │ └── suite_test.go └── pkg ├── cache └── cspccache │ └── cache.go ├── cspc └── cspcspecbuilder │ └── specbuilder.go ├── cstorvolumeconfig └── cvcspecbuilder │ └── specbuilder.go ├── infra └── infra.go └── k8sclient ├── client.go ├── cspc_util.go ├── cspi_util.go ├── cv_util.go ├── cvc_util.go ├── cvr_util.go ├── pod_exec_util.go └── pvc_util.go /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openebs-archive/cstor-operators/3eeb6add4b146a4c2feeaa951c339a112e723e6f/.DS_Store -------------------------------------------------------------------------------- /.github/auto_assign.yaml: -------------------------------------------------------------------------------- 1 | addReviewers: true 2 | 3 | addAssignees: false 4 | 5 | # Set this to the length of the reviewers list 6 | # because the default was not including everyone 7 | numberOfReviewers: 2 8 | 9 | reviewers: 10 | - prateekpandey14 11 | - shubham14bajpai 12 | - mittachaitu 13 | - sonasingh46 14 | - kmova 15 | 16 | skipKeywords: 17 | - wip 18 | -------------------------------------------------------------------------------- /.github/workflows/auto_assign_prs.yml: -------------------------------------------------------------------------------- 1 | name: 'Auto Assign PRs' 2 | 3 | # pull_request_target means that this will run on pull requests, but in the context of the base repo. 4 | # This should mean PRs from forks are supported. 5 | on: 6 | pull_request_target: 7 | types: [opened, reopened, synchronize, ready_for_review] 8 | 9 | jobs: 10 | add-reviewers: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: kentaro-m/auto-assign-action@v1.1.2 14 | with: 15 | configuration-path: ".github/auto_assign.yaml" 16 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 17 | -------------------------------------------------------------------------------- /.github/workflows/chart-lint-test.yml: -------------------------------------------------------------------------------- 1 | name: Chart Lint and Test 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'deploy/helm/**' 7 | branches: 8 | - develop 9 | pull_request: 10 | paths: 11 | - 'deploy/helm/**' 12 | branches: 13 | - develop 14 | 15 | jobs: 16 | lint-test: 17 | runs-on: ubuntu-latest 18 | timeout-minutes: 10 19 | steps: 20 | - name: Checkout 21 | uses: actions/checkout@v2 22 | with: 23 | fetch-depth: 0 24 | 25 | - name: Set up Helm 26 | uses: azure/setup-helm@v1 27 | with: 28 | version: v3.4.0 29 | 30 | - uses: actions/setup-python@v2 31 | with: 32 | python-version: 3.7 33 | 34 | - name: Set up chart-testing 35 | uses: helm/chart-testing-action@v2.0.1 36 | 37 | - name: Run chart-testing (list-changed) 38 | id: list-changed 39 | run: | 40 | changed=$(ct list-changed --config ct.yaml) 41 | if [[ -n "$changed" ]]; then 42 | echo "::set-output name=changed::true" 43 | fi 44 | 45 | - name: Run chart-testing (lint) 46 | run: ct lint --config ct.yaml 47 | 48 | - name: Create kind cluster 49 | uses: helm/kind-action@v1.2.0 50 | if: steps.list-changed.outputs.changed == 'true' 51 | 52 | - name: Add dependency chart repos 53 | run: | 54 | helm repo add openebs-ndm https://openebs-archive.github.io/node-disk-manager 55 | helm repo update 56 | 57 | - name: Run chart-testing (install) 58 | run: ct install --config ct.yaml 59 | -------------------------------------------------------------------------------- /.github/workflows/release-charts.yml: -------------------------------------------------------------------------------- 1 | name: Release Charts 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'deploy/helm/**' 7 | branches: 8 | - develop 9 | 10 | jobs: 11 | release: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v2 16 | with: 17 | fetch-depth: 0 18 | 19 | - name: Configure Git 20 | run: | 21 | git config user.name "$GITHUB_ACTOR" 22 | git config user.email "$GITHUB_ACTOR@users.noreply.github.com" 23 | 24 | - name: Install Helm 25 | uses: azure/setup-helm@v1 26 | with: 27 | version: v3.4.0 28 | 29 | - name: Run chart-releaser 30 | uses: helm/chart-releaser-action@v1.1.0 31 | env: 32 | CR_TOKEN: "${{ secrets.CR_TOKEN }}" 33 | with: 34 | charts_dir: deploy/helm 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled binaries and deployment files 2 | /bin/ 3 | 4 | # Output of the go coverage tool, specifically when used with LiteIDE 5 | *.out 6 | 7 | # cspc file is created during sanity test 8 | ./ci/sanity/cspc.yaml 9 | 10 | # IDE files 11 | **/.idea/ 12 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | 2 | tasks: 3 | - init: make all 4 | github: 5 | prebuilds: 6 | master: true 7 | branches: true 8 | pullRequests: true 9 | pullRequestsFromForks: true 10 | addCheck: true 11 | 12 | vscode: 13 | extensions: 14 | - golang.go 15 | - ms-azuretools.vscode-docker 16 | -------------------------------------------------------------------------------- /.muse/config.toml: -------------------------------------------------------------------------------- 1 | ignoreRules = [ "G101", 2 | "S1039", 3 | "ST1005" 4 | ] 5 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Community Code of Conduct 2 | 3 | This project follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). 4 | -------------------------------------------------------------------------------- /build/cspc-operator/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | #/* 3 | #Copyright 2020 The OpenEBS Authors 4 | #Licensed under the Apache License, Version 2.0 (the "License"); 5 | #you may not use this file except in compliance with the License. 6 | #You may obtain a copy of the License at 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #Unless required by applicable law or agreed to in writing, software 9 | #distributed under the License is distributed on an "AS IS" BASIS, 10 | #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | #See the License for the specific language governing permissions and 12 | #limitations under the License. 13 | #*/ 14 | # This Dockerfile builds a recent cspc-operator using the latest binary from 15 | # cspc-operator releases. 16 | # 17 | FROM alpine:3.11.5 18 | 19 | RUN apk add --no-cache \ 20 | iproute2 \ 21 | bash \ 22 | curl \ 23 | net-tools \ 24 | mii-tool \ 25 | procps \ 26 | libc6-compat \ 27 | ca-certificates 28 | 29 | COPY cspc-operator /usr/local/bin/cspc-operator 30 | 31 | ARG ARCH 32 | ARG DBUILD_DATE 33 | ARG DBUILD_REPO_URL 34 | ARG DBUILD_SITE_URL 35 | 36 | LABEL org.label-schema.name="cspc-operator" 37 | LABEL org.label-schema.description="CSPC Operator for OpenEBS cStor engine" 38 | LABEL org.label-schema.schema-version="1.0" 39 | LABEL org.label-schema.build-date=$DBUILD_DATE 40 | LABEL org.label-schema.vcs-url=$DBUILD_REPO_URL 41 | LABEL org.label-schema.url=$DBUILD_SITE_URL 42 | 43 | ENTRYPOINT ["/usr/local/bin/cspc-operator"] 44 | -------------------------------------------------------------------------------- /build/cstor-webhook/Dockerfile: -------------------------------------------------------------------------------- 1 | #/* 2 | #Copyright 2020 The OpenEBS Authors 3 | #Licensed under the Apache License, Version 2.0 (the "License"); 4 | #you may not use this file except in compliance with the License. 5 | #You may obtain a copy of the License at 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | #Unless required by applicable law or agreed to in writing, software 8 | #distributed under the License is distributed on an "AS IS" BASIS, 9 | #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | #See the License for the specific language governing permissions and 11 | #limitations under the License. 12 | #*/ 13 | FROM ubuntu:18.04 14 | 15 | RUN apt-get update && apt-get install -y \ 16 | iproute2 17 | 18 | ADD webhook /usr/local/bin/webhook 19 | 20 | 21 | 22 | ARG ARCH 23 | ARG DBUILD_DATE 24 | ARG DBUILD_REPO_URL 25 | ARG DBUILD_SITE_URL 26 | 27 | LABEL org.label-schema.name="cstor-webhook" 28 | LABEL org.label-schema.description="Webhook admission server for cStor" 29 | LABEL org.label-schema.schema-version="1.0" 30 | LABEL org.label-schema.build-date=$DBUILD_DATE 31 | LABEL org.label-schema.vcs-url=$DBUILD_REPO_URL 32 | LABEL org.label-schema.url=$DBUILD_SITE_URL 33 | 34 | ENTRYPOINT ["/usr/local/bin/webhook"] 35 | 36 | -------------------------------------------------------------------------------- /build/cvc-operator/Dockerfile: -------------------------------------------------------------------------------- 1 | #/* 2 | #Copyright 2020 The OpenEBS Authors 3 | #Licensed under the Apache License, Version 2.0 (the "License"); 4 | #you may not use this file except in compliance with the License. 5 | #You may obtain a copy of the License at 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | #Unless required by applicable law or agreed to in writing, software 8 | #distributed under the License is distributed on an "AS IS" BASIS, 9 | #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | #See the License for the specific language governing permissions and 11 | #limitations under the License. 12 | #*/ 13 | FROM alpine:3.11.5 14 | 15 | RUN apk add --no-cache \ 16 | iproute2 \ 17 | bash \ 18 | curl \ 19 | net-tools \ 20 | mii-tool \ 21 | procps \ 22 | libc6-compat \ 23 | ca-certificates 24 | 25 | COPY cvc-operator /usr/local/bin/cvc-operator 26 | 27 | ARG ARCH 28 | ARG DBUILD_DATE 29 | ARG DBUILD_REPO_URL 30 | ARG DBUILD_SITE_URL 31 | 32 | LABEL org.label-schema.name="cvc-operator" 33 | LABEL org.label-schema.description="Operator for OpenEBS cStor csi volumes" 34 | LABEL org.label-schema.schema-version="1.0" 35 | LABEL org.label-schema.build-date=$DBUILD_DATE 36 | LABEL org.label-schema.vcs-url=$DBUILD_REPO_URL 37 | LABEL org.label-schema.url=$DBUILD_SITE_URL 38 | 39 | ENTRYPOINT ["/usr/local/bin/cvc-operator"] 40 | EXPOSE 5757 41 | -------------------------------------------------------------------------------- /build/pool-manager/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #/* 3 | #Copyright 2020 The OpenEBS Authors 4 | #Licensed under the Apache License, Version 2.0 (the "License"); 5 | #you may not use this file except in compliance with the License. 6 | #You may obtain a copy of the License at 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #Unless required by applicable law or agreed to in writing, software 9 | #distributed under the License is distributed on an "AS IS" BASIS, 10 | #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | #See the License for the specific language governing permissions and 12 | #limitations under the License. 13 | #*/ 14 | 15 | set -ex 16 | 17 | #sigterm caught SIGTERM signal and forward it to pool_manager process 18 | _sigterm() { 19 | echo "[entrypoint.sh] caught SIGTERM signal forwarding to pid [$pool_manager_pid]." 20 | kill -TERM "$pool_manager_pid" 2> /dev/null 21 | waitForChildProcessToFinish 22 | } 23 | 24 | #sigint caught SIGINT signal and forward it to pool_manager process 25 | _sigint() { 26 | echo "[entrypoint.sh] caught SIGINT signal forwarding to pid [$pool_manager_pid]." 27 | kill -INT "$pool_manager_pid" 2> /dev/null 28 | waitForChildProcessToFinish 29 | } 30 | 31 | #waitForChildProcessToFinish waits for pool_manager process to finish 32 | waitForChildProcessToFinish(){ 33 | while ps -p "$pool_manager_pid" > /dev/null; do sleep 1; done; 34 | } 35 | 36 | rm /usr/local/bin/zrepl 37 | /usr/local/bin/pool-manager start & 38 | pool_manager_pid=$! 39 | 40 | #exec service ssh start 41 | #exec service rsyslog start 42 | 43 | trap '_sigint' INT 44 | trap '_sigterm' SIGTERM 45 | 46 | wait $pool_manager_pid 47 | -------------------------------------------------------------------------------- /build/volume-manager/Dockerfile: -------------------------------------------------------------------------------- 1 | #/* 2 | #Copyright 2020 The OpenEBS Authors 3 | #Licensed under the Apache License, Version 2.0 (the "License"); 4 | #you may not use this file except in compliance with the License. 5 | #You may obtain a copy of the License at 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | #Unless required by applicable law or agreed to in writing, software 8 | #distributed under the License is distributed on an "AS IS" BASIS, 9 | #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | #See the License for the specific language governing permissions and 11 | #limitations under the License. 12 | #*/# 13 | # This Dockerfile builds a recent cstor-volume-mgmt using the latest binary from 14 | # cstor-volume-mgmt releases. 15 | # 16 | 17 | FROM ubuntu:18.04 18 | RUN apt-get update; exit 0 19 | RUN apt-get -y install rsyslog bash 20 | 21 | RUN mkdir -p /usr/local/etc/istgt 22 | 23 | COPY volume-manager /usr/local/bin/ 24 | COPY entrypoint.sh /usr/local/bin/ 25 | 26 | RUN chmod +x /usr/local/bin/entrypoint.sh 27 | 28 | ARG ARCH 29 | ARG DBUILD_DATE 30 | ARG DBUILD_REPO_URL 31 | ARG DBUILD_SITE_URL 32 | 33 | LABEL org.label-schema.name="cstor-volume-manager" 34 | LABEL org.label-schema.description="Volume manager for cStor volumes" 35 | LABEL org.label-schema.schema-version="1.0" 36 | LABEL org.label-schema.build-date=$BUILD_DATE 37 | LABEL org.label-schema.build-date=$DBUILD_DATE 38 | LABEL org.label-schema.vcs-url=$DBUILD_REPO_URL 39 | LABEL org.label-schema.url=$DBUILD_SITE_URL 40 | 41 | ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] 42 | EXPOSE 7676 7777 43 | -------------------------------------------------------------------------------- /build/volume-manager/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #/* 3 | #Copyright 2020 The OpenEBS Authors 4 | #Licensed under the Apache License, Version 2.0 (the "License"); 5 | #you may not use this file except in compliance with the License. 6 | #You may obtain a copy of the License at 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | #Unless required by applicable law or agreed to in writing, software 9 | #distributed under the License is distributed on an "AS IS" BASIS, 10 | #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | #See the License for the specific language governing permissions and 12 | #limitations under the License. 13 | #*/ 14 | 15 | set -ex 16 | 17 | #sigterm caught SIGTERM signal and forward it to volume_manager process 18 | _sigterm() { 19 | echo "[entrypoint.sh] caught SIGTERM signal forwarding to pid [$volume_manager_pid]." 20 | kill -TERM "$volume_manager_pid" 2> /dev/null 21 | waitForChildProcessToFinish 22 | } 23 | 24 | #sigint caught SIGINT signal and forward it to volume_manager process 25 | _sigint() { 26 | echo "[entrypoint.sh] caught SIGINT signal forwarding to pid [$volume_manager_pid]." 27 | kill -INT "$volume_manager_pid" 2> /dev/null 28 | waitForChildProcessToFinish 29 | } 30 | 31 | #waitForChildProcessToFinish waits for volume_manager process to finish 32 | waitForChildProcessToFinish(){ 33 | while ps -p "$volume_manager_pid" > /dev/null; do sleep 1; done; 34 | } 35 | 36 | /usr/local/bin/volume-manager start & 37 | volume_manager_pid=$! 38 | 39 | trap '_sigint' INT 40 | trap '_sigterm' SIGTERM 41 | 42 | wait $volume_manager_pid 43 | -------------------------------------------------------------------------------- /changelogs/released/v2.3.0-RC1/155-shubham14bajpai: -------------------------------------------------------------------------------- 1 | chore(build): add support for multiarch build 2 | -------------------------------------------------------------------------------- /changelogs/released/v2.3.0-RC1/187-prateekpandey14: -------------------------------------------------------------------------------- 1 | refact(deps): use openebs/api v2 release modules 2 | -------------------------------------------------------------------------------- /changelogs/released/v2.3.0-RC1/197-prateekpandey14: -------------------------------------------------------------------------------- 1 | refact(crds): update crds to use apiextensions.k8s.io/v1 apis 2 | -------------------------------------------------------------------------------- /changelogs/released/v2.3.0-RC1/198-zlymeda: -------------------------------------------------------------------------------- 1 | fix(restore): set targetip on CVRs after restore is completed 2 | -------------------------------------------------------------------------------- /changelogs/released/v2.3.0-RC1/205-daximillian: -------------------------------------------------------------------------------- 1 | add air gapped documentation 2 | -------------------------------------------------------------------------------- /changelogs/released/v2.7.0-RC1/257-prateekpandey14: -------------------------------------------------------------------------------- 1 | refact(deps): bump k8s and client-go deps to version v0.20.2 2 | -------------------------------------------------------------------------------- /changelogs/released/v2.8.0-RC1/263-niladrih: -------------------------------------------------------------------------------- 1 | chore(docs): Update cStor quickstart with multi-pool example 2 | -------------------------------------------------------------------------------- /changelogs/released/v2.8.0-RC1/267-prateekpandey14: -------------------------------------------------------------------------------- 1 | refact(webhook): use v1 admission apis for webhook specific configs 2 | -------------------------------------------------------------------------------- /changelogs/released/v2.8.0-RC1/270-shubham14bajpai: -------------------------------------------------------------------------------- 1 | chore(operators): updated csi driver version to v1 2 | -------------------------------------------------------------------------------- /changelogs/released/v2.8.0-RC1/273-prateekpandey14: -------------------------------------------------------------------------------- 1 | fix(webhook): populate admissionReviewVersions as a required value 2 | -------------------------------------------------------------------------------- /changelogs/released/v2.8.0-RC1/275-prateekpandey14: -------------------------------------------------------------------------------- 1 | fix(webhook): fix admission review response apis 2 | -------------------------------------------------------------------------------- /changelogs/unreleased/349-prateekpandey14: -------------------------------------------------------------------------------- 1 | fix(status): update cvr status on graceful corresponding pool-manager termination 2 | -------------------------------------------------------------------------------- /ci/artifacts/busybox-csi-cstor-sparse.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: busybox 5 | namespace: default 6 | labels: 7 | app: busybox 8 | spec: 9 | containers: 10 | - command: 11 | - sh 12 | - -c 13 | - 'date >> /mnt/openebs-csi/date.txt; hostname >> /mnt/openebs-csi/hostname.txt; sync; sleep 5; sync; tail -f /dev/null;' 14 | image: busybox 15 | imagePullPolicy: Always 16 | name: busybox 17 | volumeMounts: 18 | - mountPath: /mnt/openebs-csi 19 | name: demo-vol 20 | volumes: 21 | - name: demo-vol 22 | persistentVolumeClaim: 23 | claimName: csi-claim 24 | --- 25 | kind: PersistentVolumeClaim 26 | apiVersion: v1 27 | metadata: 28 | name: csi-claim 29 | spec: 30 | storageClassName: csi-cstor-stripe 31 | accessModes: 32 | - ReadWriteOnce 33 | resources: 34 | requests: 35 | storage: 5Gi 36 | -------------------------------------------------------------------------------- /ci/artifacts/csi-storageclass.yaml: -------------------------------------------------------------------------------- 1 | kind: StorageClass 2 | apiVersion: storage.k8s.io/v1 3 | metadata: 4 | name: csi-cstor-stripe 5 | provisioner: cstor.csi.openebs.io 6 | allowVolumeExpansion: true 7 | parameters: 8 | cas-type: cstor 9 | replicaCount: "1" 10 | cstorPoolCluster: cspc-stripe 11 | -------------------------------------------------------------------------------- /ci/artifacts/cspc-template.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cstor.openebs.io/v1 2 | kind: CStorPoolCluster 3 | metadata: 4 | name: cspc-stripe 5 | namespace: openebs 6 | spec: 7 | pools: 8 | - nodeSelector: 9 | kubernetes.io/hostname: "NODE_NAME" 10 | dataRaidGroups: 11 | - blockDevices: 12 | - blockDeviceName: "BD_NAME" 13 | poolConfig: 14 | dataRaidGroupType: "stripe" 15 | -------------------------------------------------------------------------------- /ci/sanity/install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright © 2020 The OpenEBS Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -ex 18 | 19 | echo "Install cstor-operator artifacts" 20 | 21 | # Set SPARSE_FILE_COUNT env to 15, to have enough blockdevices 22 | # for running cStor pool integration test 23 | sed -i '/SPARSE_FILE_COUNT/!b;n;c\ value: "15"' ./deploy/cstor-operator.yaml 24 | 25 | kubectl apply -f ./deploy/cstor-operator.yaml 26 | 27 | sleep 5 28 | 29 | echo "Verify CSI installation" 30 | 31 | kubectl get pods -n openebs -l role=openebs-cstor-csi 32 | 33 | echo "Verify cstor-operators installation" 34 | 35 | kubectl get pod -n openebs 36 | 37 | # Roll back changes made to deployment 38 | sed -i '/SPARSE_FILE_COUNT/!b;n;c\ value: "1"' ./deploy/cstor-operator.yaml 39 | -------------------------------------------------------------------------------- /cmd/cspc-operator/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "os" 21 | 22 | "github.com/openebs/cstor-operators/cmd/cspc-operator/app" 23 | "k8s.io/klog/v2" 24 | ) 25 | 26 | func main() { 27 | if err := app.Start(); err != nil { 28 | klog.Errorf("Failed to start cspc controller:{%s}", err.Error()) 29 | os.Exit(1) 30 | } 31 | os.Exit(0) 32 | } 33 | -------------------------------------------------------------------------------- /cmd/cvc-operator/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "os" 21 | 22 | cvc "github.com/openebs/cstor-operators/pkg/controllers/cstorvolumeconfig" 23 | "k8s.io/klog/v2" 24 | ) 25 | 26 | func main() { 27 | if err := cvc.Start(); err != nil { 28 | klog.Errorf("Failed to start cstorvolumeconfig controller:{%s}", err.Error()) 29 | os.Exit(1) 30 | } 31 | os.Exit(0) 32 | } 33 | -------------------------------------------------------------------------------- /cmd/pool-manager/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "os" 21 | 22 | "github.com/openebs/cstor-operators/cmd/pool-manager/app" 23 | "k8s.io/klog/v2" 24 | ) 25 | 26 | func main() { 27 | if err := app.Start(); err != nil { 28 | klog.Errorf("Failed to start the controller:{%s}", err.Error()) 29 | os.Exit(1) 30 | } 31 | os.Exit(0) 32 | } 33 | -------------------------------------------------------------------------------- /cmd/volume-manager/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package main 18 | 19 | import ( 20 | "os" 21 | 22 | "github.com/openebs/cstor-operators/cmd/volume-manager/app" 23 | cstorlogger "github.com/openebs/cstor-operators/pkg/log" 24 | ) 25 | 26 | func main() { 27 | if err := run(); err != nil { 28 | os.Exit(1) 29 | } 30 | os.Exit(0) 31 | } 32 | 33 | // Run cstor-volume-mgmt 34 | func run() error { 35 | // Init logging 36 | cstorlogger.InitLogs() 37 | defer cstorlogger.FlushLogs() 38 | 39 | // Create & execute new command 40 | cmd, err := app.NewCStorVolumeMgmt() 41 | if err != nil { 42 | return err 43 | } 44 | 45 | return cmd.Execute() 46 | } 47 | -------------------------------------------------------------------------------- /ct.yaml: -------------------------------------------------------------------------------- 1 | # See https://github.com/helm/chart-testing#configuration 2 | remote: origin 3 | target-branch: develop 4 | chart-dirs: 5 | - deploy/helm 6 | helm-extra-args: --timeout 500s 7 | -------------------------------------------------------------------------------- /deploy/helm/charts/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /deploy/helm/charts/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: cstor 3 | description: CStor-Operator helm chart for Kubernetes 4 | type: application 5 | # This is the chart version. This version number should be incremented each time you make changes 6 | # to the chart and its templates, including the app version. 7 | version: 3.6.0 8 | # This is the version number of the application being deployed. This version number should be 9 | # incremented each time you make changes to the application. 10 | appVersion: 3.6.0 11 | icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/openebs/icon/color/openebs-icon-color.png 12 | home: http://www.openebs.io/ 13 | keywords: 14 | - cloud-native-storage 15 | - block-storage 16 | - iSCSI 17 | - storage 18 | - cstor 19 | - cstor-operators 20 | sources: 21 | - https://github.com/openebs/cstor-operators 22 | 23 | dependencies: 24 | - name: openebs-ndm 25 | version: "2.1.0" 26 | repository: "https://openebs.github.io/node-disk-manager" 27 | condition: openebsNDM.enabled 28 | 29 | maintainers: 30 | - name: kiranmova 31 | email: kiran.mova@mayadata.io 32 | - name: prateekpandey14 33 | email: prateek.pandey@mayadata.io 34 | - name: sonasingh46 35 | email: sonasingh46@gmail.com 36 | -------------------------------------------------------------------------------- /deploy/helm/charts/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | The OpenEBS cstor has been installed check its status by running: 2 | $ kubectl get pods -n {{ .Release.Namespace }} 3 | 4 | Use `kubectl get bd -n {{ .Release.Namespace }} ` to see the list of 5 | blockdevices attached to the Kubernetes cluster nodes. 6 | 7 | For more information, visit our Slack at https://openebs.io/community or view 8 | the documentation online at http://docs.openebs.io/. 9 | 10 | For more information related to cstor pool and volume provisioning, visit 11 | https://github.com/openebs/cstor-operators/tree/master/docs . 12 | -------------------------------------------------------------------------------- /deploy/helm/charts/templates/csi-driver.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.csiDriver.create -}} 2 | apiVersion: storage.k8s.io/v1 3 | kind: CSIDriver 4 | metadata: 5 | name: cstor.csi.openebs.io 6 | spec: 7 | # Supports persistent inline volumes. 8 | volumeLifecycleModes: 9 | - Persistent 10 | # Not yet supported but added just to support upgrade control plane seamlessly 11 | - Ephemeral 12 | # To determine at runtime which mode a volume uses, pod info and its 13 | # "csi.storage.k8s.io/ephemeral" entry are needed. 14 | podInfoOnMount: {{ .Values.csiDriver.podInfoOnMount }} 15 | attachRequired: {{ .Values.csiDriver.attachRequired }} 16 | {{- end }} -------------------------------------------------------------------------------- /deploy/helm/charts/templates/csi-iscsiadm-config.yaml: -------------------------------------------------------------------------------- 1 | kind: ConfigMap 2 | apiVersion: v1 3 | metadata: 4 | name: openebs-cstor-csi-iscsiadm 5 | data: 6 | iscsiadm: | 7 | #!/bin/sh 8 | if [ -x /host/sbin/iscsiadm ]; then 9 | chroot /host /sbin/iscsiadm "$@" 10 | elif [ -x /host/usr/local/sbin/iscsiadm ]; then 11 | chroot /host /usr/local/sbin/iscsiadm "$@" 12 | elif [ -x /host/bin/iscsiadm ]; then 13 | chroot /host /bin/iscsiadm "$@" 14 | elif [ -x /host/usr/local/bin/iscsiadm ]; then 15 | chroot /host /usr/local/bin/iscsiadm "$@" 16 | else 17 | chroot /host iscsiadm "$@" 18 | fi 19 | -------------------------------------------------------------------------------- /deploy/helm/charts/templates/cvc-operator-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ template "cstor.fullname" . }}-cvc-operator-svc 5 | labels: 6 | {{- include "cstor.cvcOperatorService.labels" . | nindent 4 }} 7 | spec: 8 | ports: 9 | - name: api 10 | port: 5757 11 | protocol: TCP 12 | targetPort: 5757 13 | selector: 14 | name: cvc-operator 15 | sessionAffinity: None 16 | -------------------------------------------------------------------------------- /deploy/helm/charts/templates/priority-class.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.csiController.priorityClass.create }} 2 | apiVersion: scheduling.k8s.io/v1 3 | kind: PriorityClass 4 | metadata: 5 | name: {{ template "cstor.csiController.priorityClassName" . }} 6 | value: {{ .Values.csiController.priorityClass.value }} 7 | globalDefault: false 8 | description: "This priority class should be used for the CStor CSI driver controller deployment only." 9 | {{- end }} 10 | --- 11 | {{- if .Values.csiNode.priorityClass.create }} 12 | apiVersion: scheduling.k8s.io/v1 13 | kind: PriorityClass 14 | metadata: 15 | name: {{ template "cstor.csiNode.priorityClassName" . }} 16 | value: {{ .Values.csiNode.priorityClass.value }} 17 | globalDefault: false 18 | description: "This priority class should be used for the CStor CSI driver node deployment only." 19 | {{- end }} -------------------------------------------------------------------------------- /deploy/helm/charts/templates/psp.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.rbac.pspEnabled }} 2 | apiVersion: policy/v1beta1 3 | kind: PodSecurityPolicy 4 | metadata: 5 | name: openebs-cstor-csi-node-psp 6 | labels: 7 | {{- include "cstor.csiNode.labels" . | nindent 4 }} 8 | spec: 9 | privileged: true 10 | allowPrivilegeEscalation: true 11 | allowedCapabilities: ['*'] 12 | volumes: ['*'] 13 | hostNetwork: true 14 | hostIPC: true 15 | hostPID: true 16 | runAsUser: 17 | rule: 'RunAsAny' 18 | seLinux: 19 | rule: 'RunAsAny' 20 | supplementalGroups: 21 | rule: 'RunAsAny' 22 | fsGroup: 23 | rule: 'RunAsAny' 24 | {{- end }} 25 | -------------------------------------------------------------------------------- /deploy/helm/charts/templates/snapshot-class.yaml: -------------------------------------------------------------------------------- 1 | {{ if or (.Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1beta1/VolumeSnapshotClass") (.Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1/VolumeSnapshotClass") }} 2 | kind: VolumeSnapshotClass 3 | apiVersion: {{ if .Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1beta1/VolumeSnapshotClass" -}} 4 | snapshot.storage.k8s.io/v1beta1 5 | {{- else -}} 6 | snapshot.storage.k8s.io/v1 7 | {{- end }} 8 | metadata: 9 | name: csi-cstor-snapshotclass 10 | annotations: 11 | snapshot.storage.kubernetes.io/is-default-class: "true" 12 | driver: cstor.csi.openebs.io 13 | deletionPolicy: Delete 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /deploy/snapshot_class.yaml: -------------------------------------------------------------------------------- 1 | kind: VolumeSnapshotClass 2 | apiVersion: snapshot.storage.k8s.io/v1 3 | metadata: 4 | name: csi-cstor-snapshotclass 5 | annotations: 6 | snapshot.storage.kubernetes.io/is-default-class: "true" 7 | driver: cstor.csi.openebs.io 8 | deletionPolicy: Delete 9 | --- 10 | -------------------------------------------------------------------------------- /docs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openebs-archive/cstor-operators/3eeb6add4b146a4c2feeaa951c339a112e723e6f/docs/.DS_Store -------------------------------------------------------------------------------- /docs/troubleshooting/troubleshooting.md: -------------------------------------------------------------------------------- 1 | ## FAQ and Troubleshooting 2 | 3 | 1. My nodes in Kubernetes cluster were replaced and the cStor pools are pending. How can I fix this? See [Node Replacement](migrate_pool_by_migrating_disks.md). 4 | 2. Pool manager pods are running but it is not reconciling the CSPC state. See [Bad Disk](pool_operations_hung.md) 5 | 3. Node and underlying disk in a Kubernetes cluster were lost and the cStor pools are pending. How can I fix this? see [Migrate cStor volume from lost pool](migrate_cstor_volume.md) 6 | 4. How to run cStor-CSI on rancher based clusters? See [Rancher Prerequisites](rancher_prerequisite.md) 7 | -------------------------------------------------------------------------------- /docs/tutorial/intro.md: -------------------------------------------------------------------------------- 1 | # cStor Tutorial 2 | 3 | This tutorial will help you to understand the usage of cstor-operators. 4 | On a high level, this tutorial covers the following: 5 | 6 | 1. How to use CSPC APIs to do pool operations and their tuning. 7 | 2. How to do volume operation and their tuning. 8 | 9 | ## cStor Pools 10 | 11 | 1. This [link](./cspc/stripe/stripe.md) explains the pool related operations for stripe configuration. 12 | 2. This [link](./cspc/mirror/mirror.md) explains the pool related operations for mirror configuration. 13 | 3. This [link](./cspc/tuning/tune.md) explains the tuning of cStor pools via CSPC. 14 | 4. This [link](./cspc/allow-tagged-bds/allowed-bds.md) explains to use the BD tag feature. 15 | 16 | 17 | ## cStor Volumes 18 | 19 | 1. This [link](./volumes/volume.md) explains the volume related operations. 20 | 2. This [link](./volumes/snapshot.md) explains the volume snapshot related operations. 21 | 3. This [link](./volumes/resize.md) explains the volume resize related operations. 22 | 4. This [link](./volumes/policy.md) explains the volume policy related operations. 23 | 5. This [link](./volumes/migration.md) explains the volume migration related operations across k8s nodes. 24 | 6. This [link](./volumes/block_volume.md) explains how to use cstor raw block volume. 25 | 7. This [link](./volumes/prometheus-monitoring.md) explains how to configure and monitor cstor volumes. 26 | 8. This [link](./volumes/storageclass.md) explains how to configure topology aware StorageClass -------------------------------------------------------------------------------- /docs/workload/elasticsearch/o-elastic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openebs-archive/cstor-operators/3eeb6add4b146a4c2feeaa951c339a112e723e6f/docs/workload/elasticsearch/o-elastic.png -------------------------------------------------------------------------------- /docs/workload/prometheus-operator/o-prometheus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openebs-archive/cstor-operators/3eeb6add4b146a4c2feeaa951c339a112e723e6f/docs/workload/prometheus-operator/o-prometheus.png -------------------------------------------------------------------------------- /e2e-tests/apps/busybox/deployers/busybox_deployment.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | lkey: lvalue 6 | name: busybox 7 | spec: 8 | clusterIP: None 9 | selector: 10 | lkey: lvalue 11 | --- 12 | apiVersion: apps/v1 13 | kind: Deployment 14 | metadata: 15 | name: app-busybox 16 | labels: 17 | lkey: lvalue 18 | spec: 19 | serviceName: busybox 20 | selector: 21 | matchLabels: 22 | lkey: lvalue 23 | template: 24 | metadata: 25 | labels: 26 | lkey: lvalue 27 | spec: 28 | containers: 29 | - name: app-busybox 30 | imagePullPolicy: IfNotPresent 31 | image: gcr.io/google-containers/busybox 32 | command: ["/bin/sh"] 33 | args: ["-c", "while true; do sleep 10;done"] 34 | env: 35 | volumeMounts: 36 | - name: data-vol 37 | mountPath: /busybox 38 | volumes: 39 | - name: data-vol 40 | persistentVolumeClaim: 41 | claimName: testclaim 42 | --- 43 | kind: PersistentVolumeClaim 44 | apiVersion: v1 45 | metadata: 46 | name: testclaim 47 | spec: 48 | storageClassName: testclass 49 | accessModes: 50 | - ReadWriteOnce 51 | resources: 52 | requests: 53 | storage: teststorage 54 | -------------------------------------------------------------------------------- /e2e-tests/apps/busybox/deployers/busybox_statefulset.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | lkey: lvalue 6 | name: busybox 7 | spec: 8 | clusterIP: None 9 | selector: 10 | lkey: lvalue 11 | --- 12 | apiVersion: apps/v1 13 | kind: StatefulSet 14 | metadata: 15 | name: busybox 16 | labels: 17 | lkey: lvalue 18 | spec: 19 | serviceName: busybox 20 | rkey: rvalue 21 | selector: 22 | matchLabels: 23 | lkey: lvalue 24 | template: 25 | metadata: 26 | labels: 27 | lkey: lvalue 28 | spec: 29 | containers: 30 | - name: busybox 31 | image: gcr.io/google-containers/busybox 32 | imagePullPolicy: IfNotPresent 33 | command: 34 | - sh 35 | - -c 36 | - 'date > /busybox/date.txt; sync; sleep 5; sync; tail -f /dev/null;' 37 | volumeMounts: 38 | - name: testclaim 39 | mountPath: /busybox 40 | volumeClaimTemplates: 41 | - metadata: 42 | name: testclaim 43 | spec: 44 | accessModes: [ "ReadWriteOnce" ] 45 | storageClassName: testclass 46 | resources: 47 | requests: 48 | storage: teststorage 49 | -------------------------------------------------------------------------------- /e2e-tests/apps/busybox/deployers/test_vars.yml: -------------------------------------------------------------------------------- 1 | application_statefulset: busybox_statefulset.yml 2 | application_deployment: busybox_deployment.yml 3 | app_ns: "{{ lookup('env','APP_NAMESPACE') }}" 4 | app_label: "{{ lookup('env','APP_LABEL') }}" 5 | test_name: "busybox-{{ action }}-{{ app_ns }}" 6 | deploy_type: "{{ lookup('env','DEPLOY_TYPE') }}" 7 | app_replica: "{{ lookup('env','APP_REPLICA') }}" 8 | affinity_label: "{{ lookup('env','AFFINITY_LABEL') }}" 9 | application_name: "busybox" 10 | action: "{{ lookup('env','ACTION') }}" 11 | app_pvc: "{{ lookup('env','APP_PVC') }}" 12 | storage_class: "{{ lookup('env','PROVIDER_STORAGE_CLASS') }}" 13 | operator_ns: openebs 14 | -------------------------------------------------------------------------------- /e2e-tests/apps/busybox/liveness/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: e2e-busybox-liveness- 6 | namespace: e2e 7 | spec: 8 | activeDeadlineSeconds: 5400 9 | template: 10 | metadata: 11 | name: e2e-busybox-liveness 12 | namespace: e2e 13 | labels: 14 | liveness: e2e-busybox-liveness 15 | 16 | # label used for mass-liveness check upon infra-chaos 17 | infra-aid: liveness 18 | 19 | spec: 20 | serviceAccountName: e2e 21 | restartPolicy: Never 22 | 23 | containers: 24 | - name: ansibletest 25 | image: openebs/cstor-csi-e2e:ci 26 | imagePullPolicy: IfNotPresent 27 | env: 28 | - name: ANSIBLE_STDOUT_CALLBACK 29 | value: default 30 | 31 | - name: MY_POD_NAME 32 | valueFrom: 33 | fieldRef: 34 | fieldPath: metadata.name 35 | 36 | - name: LIVENESS_TIMEOUT_SECONDS 37 | value: "10" 38 | 39 | # number of retries when livenss-fails 40 | - name: LIVENESS_RETRY_COUNT 41 | value: "5" 42 | 43 | # Namespace in which busybox is running 44 | - name: NAMESPACE 45 | value: app-busybox-ns 46 | 47 | - name: APPLICATION_LABEL 48 | value: 'app=busybox' 49 | 50 | - name: ACTION 51 | value: provision 52 | 53 | command: ["/bin/bash"] 54 | args: ["-c", "ansible-playbook ./e2e-tests/apps/busybox/liveness/test.yml -i /etc/ansible/hosts -v; exit 0"] 55 | -------------------------------------------------------------------------------- /e2e-tests/apps/busybox/liveness/vars.yml: -------------------------------------------------------------------------------- 1 | test_name: busybox-liveness 2 | namespace: "{{ lookup('env','NAMESPACE') }}" 3 | app_label: "{{ lookup('env','APPLICATION_LABEL') }}" 4 | busybox_liveness: busybox_liveness.yml 5 | liveness_retry: "{{ lookup('env','LIVENESS_RETRY_COUNT') }}" 6 | liveness_timeout: "{{ lookup('env','LIVENESS_TIMEOUT_SECONDS') }}" 7 | liveness_log: "liveness-running" 8 | action: "{{ lookup('env','ACTION') }}" -------------------------------------------------------------------------------- /e2e-tests/apps/minio/deployers/minio-pvc.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: minio-service 6 | labels: 7 | lkey: lvalue 8 | spec: 9 | ports: 10 | - port: 9000 11 | # nodePort: 32703 12 | protocol: TCP 13 | selector: 14 | app: minio 15 | sessionAffinity: None 16 | type: NodePort 17 | 18 | --- 19 | apiVersion: v1 20 | kind: PersistentVolumeClaim 21 | metadata: 22 | name: testclaim 23 | labels: 24 | lkey: lvalue 25 | spec: 26 | storageClassName: testclass 27 | accessModes: 28 | - ReadWriteOnce 29 | resources: 30 | requests: 31 | storage: volume-capacity -------------------------------------------------------------------------------- /e2e-tests/apps/minio/deployers/minio.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: minio-deployment 6 | spec: 7 | selector: 8 | matchLabels: 9 | lkey: lvalue 10 | strategy: 11 | type: Recreate 12 | template: 13 | metadata: 14 | labels: 15 | # Label is used as selector in the service. 16 | lkey: lvalue 17 | app: minio 18 | spec: 19 | # Refer to the PVC created earlier 20 | volumes: 21 | - name: data-vol 22 | persistentVolumeClaim: 23 | # Name of the PVC created earlier 24 | claimName: testclaim 25 | containers: 26 | - name: minio 27 | # Pulls the default Minio image from Docker Hub 28 | image: minio/minio 29 | imagePullPolicy: "IfNotPresent" 30 | args: 31 | - server 32 | - /storage1 33 | livenessProbe: 34 | exec: 35 | command: 36 | - /bin/sh 37 | - -c 38 | - touch /storage1/healthy; sleep 2; rm -rf /storage1/healthy; 39 | initialDelaySeconds: 5 40 | periodSeconds: 5 41 | env: 42 | # Minio access key and secret key 43 | - name: MINIO_ACCESS_KEY 44 | value: "minio" 45 | - name: MINIO_SECRET_KEY 46 | value: "minio123" 47 | ports: 48 | - containerPort: 9000 49 | # Mount the volume into the pod 50 | volumeMounts: 51 | - name: data-vol # must match the volume name, above 52 | mountPath: "/storage1" 53 | -------------------------------------------------------------------------------- /e2e-tests/apps/minio/deployers/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | application_deployment: minio.yml 3 | pvc_deployment: minio-pvc.yml 4 | app_ns: "{{ lookup('env','APP_NAMESPACE') }}" 5 | app_label: "{{ lookup('env','APP_LABEL') }}" 6 | test_name: minio-deployment 7 | action: "{{ lookup('env','ACTION') }}" 8 | app_pvc: "{{ lookup('env','APP_PVC') }}" 9 | storage_class: "{{ lookup('env','PROVIDER_STORAGE_CLASS') }}" 10 | capacity: "{{ lookup('env','CAPACITY') }}" 11 | deploy_count: "{{ lookup('env','DEPLOY_COUNT') }}" 12 | access_mode: "{{ lookup('env','ACCESS_MODE') }}" 13 | -------------------------------------------------------------------------------- /e2e-tests/apps/nfs-provisioner/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: e2e-nfs-provision- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: nfs-e2e 13 | spec: 14 | serviceAccountName: e2e 15 | restartPolicy: Never 16 | containers: 17 | - name: ansibletest 18 | image: openebs/cstor-csi-e2e:ci 19 | imagePullPolicy: IfNotPresent 20 | env: 21 | - name: ANSIBLE_STDOUT_CALLBACK 22 | #value: log_plays 23 | value: default 24 | 25 | - name: PROVIDER_STORAGE_CLASS 26 | value: openebs-cstor-disk 27 | 28 | - name: APP_PVC 29 | value: nfs-pvc-claim 30 | 31 | - name: APP_LABEL 32 | value: app=nfs 33 | 34 | - name: APP_NAMESPACE 35 | value: app-nfs-ns 36 | 37 | #Persistent Volume storage capacity 38 | - name: PV_CAPACITY 39 | value: 50G 40 | 41 | - name: NFS_STORAGE_CLASS_NAME 42 | value: openebs-nfs 43 | 44 | # NFS storage class Mount options 45 | # Supported values 3.x and 4.x 46 | - name: NFS_VERSION 47 | value: vers=4.1 48 | 49 | # Use 'deprovision' for clean up 50 | - name: ACTION 51 | value: provision 52 | 53 | command: ["/bin/bash"] 54 | args: ["-c", "ansible-playbook ./e2e-tests/apps/nfs-provisioner/test.yml -i /etc/ansible/hosts -v; exit 0"] 55 | -------------------------------------------------------------------------------- /e2e-tests/apps/nfs-provisioner/test_vars.yml: -------------------------------------------------------------------------------- 1 | application_deployment: nfs-deployment.yml 2 | app_ns: "{{ lookup('env','APP_NAMESPACE') }}" 3 | app_label: "{{ lookup('env','APP_LABEL') }}" 4 | test_name: "nfs-provision" 5 | affinity_label: "{{ lookup('env','AFFINITY_LABEL') }}" 6 | application_name: "nfs" 7 | action: "{{ lookup('env','ACTION') }}" 8 | app_pvc: "{{ lookup('env','APP_PVC') }}" 9 | storage_class: "{{ lookup('env','PROVIDER_STORAGE_CLASS') }}" 10 | nfs_storage_class: "{{ lookup('env','NFS_STORAGE_CLASS_NAME') }}" 11 | nfs_type: "{{ lookup('env','NFS_VERSION') }}" 12 | operator_ns: openebs 13 | -------------------------------------------------------------------------------- /e2e-tests/apps/percona/deployers/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: e2e-percona- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: percona-deployment 13 | 14 | spec: 15 | serviceAccountName: e2e 16 | restartPolicy: Never 17 | containers: 18 | - name: ansibletest 19 | image: openebs/cstor-csi-e2e:ci 20 | imagePullPolicy: IfNotPresent 21 | 22 | env: 23 | - name: ANSIBLE_STDOUT_CALLBACK 24 | #value: log_plays, actionable, default 25 | value: default 26 | 27 | - name: PROVIDER_STORAGE_CLASS 28 | value: openebs-cstor-csi 29 | 30 | - name: APP_PVC 31 | value: percona-mysql-claim 32 | 33 | # Application label 34 | - name: APP_LABEL 35 | value: 'name=percona' 36 | 37 | # Application namespace 38 | - name: APP_NAMESPACE 39 | value: app-percona-ns 40 | 41 | # Use 'deprovision' for app-clean up 42 | - name: ACTION 43 | value: provision 44 | 45 | - name: CAPACITY 46 | value: 5Gi 47 | 48 | # Enable storage i/o based liveness probe 49 | - name: IO_PROBE 50 | value: enabled 51 | 52 | - name: TARGET_AFFINITY_CHECK 53 | value: enable 54 | 55 | command: ["/bin/bash"] 56 | args: ["-c", "ansible-playbook ./e2e-tests/apps/percona/deployers/test.yml -i /etc/ansible/hosts -v; exit 0"] 57 | -------------------------------------------------------------------------------- /e2e-tests/apps/percona/deployers/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parametres 2 | 3 | app_ns: "{{ lookup('env','APP_NAMESPACE') }}" 4 | operator_ns: 'openebs' 5 | app_label: "{{ lookup('env','APP_LABEL') }}" 6 | test_name: percona-deployment 7 | application_name: "percona" 8 | action: "{{ lookup('env','ACTION') }}" 9 | app_pvc: "{{ lookup('env','APP_PVC') }}" 10 | storage_class: "{{ lookup('env','PROVIDER_STORAGE_CLASS') }}" 11 | capacity: "{{ lookup('env','CAPACITY') }}" 12 | application_deployment: percona.yml 13 | -------------------------------------------------------------------------------- /e2e-tests/apps/percona/workload/test_vars.yml: -------------------------------------------------------------------------------- 1 | percona_loadgen: tpcc_bench.yml 2 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 3 | test_name: percona-loadgen 4 | app_service_label: "{{ lookup('env','APP_SERVICE_LABEL') }}" 5 | loadgen_label: "{{ lookup('env','LOADGEN_LABEL') }}" 6 | db_user: "{{ lookup('env','DB_USER') }}" 7 | db_password: "{{ lookup('env','DB_PASSWORD') }}" 8 | app_label: "{{ lookup('env','APP_LABEL') }}" 9 | load_duration: "{{ lookup('env','LOAD_DURATION') }}" 10 | test_warehouse: "{{ lookup('env','TPCC_WAREHOUSES') }}" 11 | test_connections: "{{ lookup('env','TPCC_CONNECTIONS') }}" 12 | test_warmup_period: "{{ lookup('env','TPCC_WARMUP_PERIOD') }}" 13 | test_interval: "{{ lookup('env','LOAD_INTERVAL') }}" 14 | tpcc_conf: tpcc.conf 15 | -------------------------------------------------------------------------------- /e2e-tests/apps/percona/workload/tpcc.conf: -------------------------------------------------------------------------------- 1 | { 2 | "db_user": "test_user", 3 | "db_password": "test_password", 4 | "warehouses": "test_warehouse", 5 | "connections": "test_connections", 6 | "warmup_period": "test_warmup_period", 7 | "run_duration": "test_duration", 8 | "interval": "test_interval" 9 | } 10 | -------------------------------------------------------------------------------- /e2e-tests/apps/percona/workload/tpcc_bench.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | name: tpcc-bench 6 | spec: 7 | template: 8 | metadata: 9 | name: tpcc-bench 10 | labels: 11 | loadgen_lkey: loadgen_lvalue 12 | spec: 13 | restartPolicy: Never 14 | containers: 15 | - name: tpcc-bench 16 | image: openebs/tests-tpcc-client 17 | command: ["/bin/bash"] 18 | args: ["-c", "./tpcc-runner.sh service_ip tpcc.conf; exit 0"] 19 | volumeMounts: 20 | - name: tpcc-configmap 21 | mountPath: /tpcc-mysql/tpcc.conf 22 | subPath: tpcc.conf 23 | tty: true 24 | volumes: 25 | - name: tpcc-configmap 26 | configMap: 27 | name: tpcc-config 28 | -------------------------------------------------------------------------------- /e2e-tests/apps/wordpress/deployers/test_vars.yml: -------------------------------------------------------------------------------- 1 | wordpress_application_deployment: wordpress.yml 2 | mysql_application_deployment: mysql.yml 3 | app_ns: "{{ lookup('env','APP_NAMESPACE') }}" 4 | app_label: "{{ lookup('env','APP_LABEL') }}" 5 | test_name: wordpress-deployment 6 | app_replica: "{{ lookup('env','APP_REPLICA') }}" 7 | application_name: "wordpress" 8 | action: "{{ lookup('env','ACTION') }}" 9 | mysql_pass: "{{ lookup('env','MYSQL_PASS') }}" 10 | mysql_pvc_claim: "{{ lookup('env','MYSQL_APP_PVC') }}" 11 | wordpress_pvc_claim: "{{ lookup('env','WORDPRESS_APP_PVC') }}" 12 | mysql_storage_class: "{{ lookup('env','PROVIDER_STORAGE_CLASS') }}" 13 | wordpress_storage_class: "{{ lookup('env','STORAGE_CLASS') }}" 14 | operator_ns: openebs 15 | access_mode: "{{ lookup('env','PVC_ACCESS_MODE') }}" 16 | mysql_capacity: "{{ lookup('env','MYSQL_PV_CAPACITY') }}" 17 | wordpress_capacity: "{{ lookup('env','WORDPRESS_PV_CAPACITY') }}" 18 | -------------------------------------------------------------------------------- /e2e-tests/chaoslib/containerd_chaos/containerd-chaos-ds.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: DaemonSet 3 | metadata: 4 | name: containerd-chaos 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: crictl 9 | template: 10 | metadata: 11 | labels: 12 | app: crictl 13 | name: containerd-chaos 14 | spec: 15 | containers: 16 | - image: quay.io/nsathyaseelan/crictl:latest 17 | imagePullPolicy: IfNotPresent 18 | name: containerd-chaos 19 | command: ['sh', '-c', 'echo Hello! && sleep 1800'] 20 | volumeMounts: 21 | - name: cri-socket 22 | mountPath: /run/containerd/containerd.sock 23 | - name: cri-config 24 | mountPath: /etc/crictl.yaml 25 | volumes: 26 | - hostPath: 27 | path: /run/containerd/containerd.sock 28 | name: cri-socket 29 | - hostPath: 30 | path: /etc/crictl.yaml 31 | name: cri-config 32 | 33 | -------------------------------------------------------------------------------- /e2e-tests/chaoslib/crio_chaos/crio-chaos-ds.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: DaemonSet 3 | metadata: 4 | name: crio-chaos 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: crio 9 | template: 10 | metadata: 11 | labels: 12 | app: crio 13 | name: crio-chaos 14 | spec: 15 | containers: 16 | - image: quay.io/nsathyaseelan/crictl:latest 17 | imagePullPolicy: IfNotPresent 18 | name: crio-chaos 19 | command: ['sh', '-c', 'echo Hello! && sleep 1800'] 20 | volumeMounts: 21 | - name: cri-socket 22 | mountPath: /run/crio/crio.sock 23 | - name: cri-config 24 | mountPath: /etc/crictl.yaml 25 | securityContext: 26 | privileged: true 27 | volumes: 28 | - hostPath: 29 | path: /run/crio/crio.sock 30 | name: cri-socket 31 | - hostPath: 32 | path: /etc/crictl.yaml 33 | name: cri-config 34 | -------------------------------------------------------------------------------- /e2e-tests/chaoslib/kubectl/app_pod_failure.yaml: -------------------------------------------------------------------------------- 1 | - name: Get the application pod name 2 | shell: kubectl get pod -l {{ label }} -n {{ namespace }} -o=custom-columns=NAME:".metadata.name" --no-headers 3 | args: 4 | executable: /bin/bash 5 | register: app_pod 6 | 7 | - name: Kill the application pod 8 | shell: > 9 | kubectl delete pod {{ app_pod.stdout }} -n {{ app_ns }} 10 | args: 11 | executable: /bin/bash 12 | 13 | -------------------------------------------------------------------------------- /e2e-tests/chaoslib/kubectl/app_pod_random_delete.yaml: -------------------------------------------------------------------------------- 1 | - name: Derive chaos iterations 2 | set_fact: 3 | chaos_iterations: "{{ (chaos_duration|int / chaos_interval|int)|int }}" 4 | 5 | - name: Set min chaos count to 1 if interval > duration 6 | set_fact: 7 | chaos_iterations: 1 8 | when: "chaos_iterations == '0'" 9 | 10 | - name: Kill application pods randomly for the specified duration 11 | shell: | 12 | kubectl get pods -l {{ label }} -n {{ namespace }} --no-headers -o custom-columns=:metadata.name | shuf -n 1 | xargs kubectl delete pod --force --grace-period=0 --wait=false 13 | sleep {{ chaos_interval }} 14 | args: 15 | executable: /bin/bash 16 | register: result 17 | with_sequence: start=1 end={{ chaos_iterations }} 18 | when: "c_force == 'true'" 19 | 20 | - name: Kill application pods randomly for the specified duration 21 | shell: | 22 | kubectl get pods -l {{ label }} -n {{ namespace }} --no-headers -o custom-columns=:metadata.name | shuf -n 1 | xargs kubectl delete pod 23 | sleep {{ chaos_interval }} 24 | args: 25 | executable: /bin/bash 26 | register: result 27 | with_sequence: start=1 end={{ chaos_iterations }} 28 | when: "c_force == 'false' or c_force == ''" 29 | -------------------------------------------------------------------------------- /e2e-tests/chaoslib/kubectl/cordon_drain_node.yaml: -------------------------------------------------------------------------------- 1 | - block: 2 | 3 | - name: Identify the application node 4 | shell: > 5 | kubectl get pod {{ app }} -n {{ app_ns }} 6 | --no-headers -o custom-columns=:spec.nodeName 7 | args: 8 | executable: /bin/bash 9 | register: result 10 | 11 | - name: Record the application node name 12 | set_fact: 13 | app_node: "{{ result.stdout }}" 14 | 15 | - name: Drain the application node 16 | shell: > 17 | kubectl drain {{ app_node }} 18 | --ignore-daemonsets --delete-local-data --force 19 | args: 20 | executable: /bin/bash 21 | register: result 22 | until: "'cordoned' in result.stdout" 23 | delay: 20 24 | retries: 12 25 | 26 | - name: Wait for application pod reschedule (evict) 27 | # Do not untaint until evict occurs 28 | wait_for: 29 | timeout: 30 30 | 31 | when: action == "drain" 32 | 33 | - block: 34 | 35 | - name: Uncordon the application node 36 | shell: > 37 | kubectl uncordon {{ app_node }} 38 | args: 39 | executable: /bin/bash 40 | register: result 41 | until: "'uncordoned' in result.stdout" 42 | delay: 20 43 | retries: 12 44 | 45 | when: action == "uncordon" 46 | 47 | -------------------------------------------------------------------------------- /e2e-tests/chaoslib/kubectl/pod_evict_by_taint.yaml: -------------------------------------------------------------------------------- 1 | - block: 2 | 3 | - name: Identify the application node 4 | shell: > 5 | kubectl get pod {{ app }} -n {{ app_ns }} 6 | --no-headers -o custom-columns=:spec.nodeName 7 | args: 8 | executable: /bin/bash 9 | register: result 10 | 11 | - name: Record the application node name 12 | set_fact: 13 | app_node: "{{ result.stdout }}" 14 | 15 | - name: Force eviction of pods by tainting the app node 16 | shell: > 17 | kubectl taint node {{ app_node }} 18 | {{ taint }}=:NoExecute 19 | args: 20 | executable: /bin/bash 21 | register: result 22 | until: "'tainted' in result.stdout" 23 | delay: 20 24 | retries: 12 25 | 26 | - name: Wait for application pod reschedule (evict) 27 | # Do not untaint until evict occurs 28 | wait_for: 29 | timeout: 30 30 | 31 | when: action == "taint" 32 | 33 | - block: 34 | 35 | - name: Untaint the application node 36 | shell: > 37 | kubectl taint node {{ app_node }} 38 | {{ taint }}:NoExecute- 39 | args: 40 | executable: /bin/bash 41 | register: result 42 | failed_when: "'untainted' not in result.stdout" 43 | 44 | when: action == "untaint" 45 | 46 | -------------------------------------------------------------------------------- /e2e-tests/chaoslib/vmware_chaos/vm_power_operations.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This util can handle 'power on' and 'power off' operations on VMware based virtual machines. 3 | # The parameters required by this util are 4 | # - ESX IP 5 | # - ESX root Password 6 | # - The target virtual machine name 7 | # - Operation, either 'on' or 'off' 8 | 9 | 10 | - name: Obtain the VM ID 11 | shell: sshpass -p {{ esx_pwd }} ssh -o StrictHostKeyChecking=no root@{{ esx_ip }} vim-cmd vmsvc/getallvms | awk '{print $1 " " $2}' | grep {{ target_node }} | awk '{print $1}' 12 | args: 13 | executable: /bin/bash 14 | register: id 15 | 16 | - name: Perform operation on the target vm 17 | shell: sshpass -p {{ esx_pwd }} ssh -o StrictHostKeyChecking=no root@{{ esx_ip }} vim-cmd vmsvc/power.{{operation}} {{ id.stdout }} 18 | args: 19 | executable: /bin/bash 20 | register: result 21 | failed_when: "result.rc != 0" 22 | 23 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/app_pod_failure/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/app_pod_failure/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: application-pod-failure 2 | 3 | app_ns: "{{ lookup('env','APP_NAMESPACE') }}" 4 | 5 | app_label: "{{ lookup('env','APP_LABEL') }}" 6 | 7 | liveness_label: "{{ lookup('env','LIVENESS_APP_LABEL') }}" 8 | 9 | liveness_namespace: "{{ lookup('env','LIVENESS_APP_NAMESPACE') }}" 10 | 11 | cri: "{{ lookup('env','CONTAINER_RUNTIME') }}" 12 | 13 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 14 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/cspc_pool_failure/container_failure/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/cspc_pool_failure/container_failure/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: cspc-pool-container-failure 2 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 3 | label: "{{ lookup('env','APP_LABEL') }}" 4 | pvc: "{{ lookup('env','APP_PVC') }}" 5 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 6 | operator_ns: "{{ lookup('env','OPENEBS_NAMESPACE') }}" 7 | chaos_duration: 240 8 | cri: "{{ lookup('env','CONTAINER_RUNTIME') }}" 9 | container_name: "{{ lookup('env','CONTAINER_NAME') }}" 10 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/cspc_pool_failure/disk_replacement_inprogress/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/cspc_pool_failure/disk_replacement_inprogress/test_vars.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ## TEST-SPECIFIC PARAMS 3 | test_name: pool-failure-when-blockdevice-replacement 4 | app_namespace: "{{ lookup('env','APP_NAMESPACE') }}" 5 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 6 | label: "{{ lookup('env','APP_LABEL') }}" 7 | app_pvc: "{{ lookup('env','APP_PVC') }}" 8 | pool_name: "{{ lookup('env','POOL_NAME') }}" 9 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 10 | 11 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/cspc_pool_failure/pool_expansion_inprogress/README.md: -------------------------------------------------------------------------------- 1 | ## Experiment Metadata 2 | 3 | | Type | Description | Storage | Applications | K8s Platform | 4 | | ---------- | ----------------------------------------------------- | ------------ | ------------ | ------------ | 5 | | CHAOS | Restart the pool pod while CSPC pool expansion is in progress | OpenBS cStor | Any | Any | 6 | 7 | ## Entry-Criteria 8 | 9 | - K8s nodes should be ready. 10 | - cStor CSPC should be created. 11 | - Application should be deployed using volume provisioned through CSI provisioner. 12 | - Unclaimed BlockDevices should be available to expand the pool. 13 | 14 | ## Exit-Criteria 15 | 16 | - Pool should be expanded successfully and the application should be still up and running without any disruption. 17 | 18 | ## Procedure 19 | 20 | - This chaos test checks if the cspc pool can be expanded successfully even if the respective pool pod is restarted. 21 | - This e2e-test accepts the parameters in form of job environmental variables. 22 | - This job patches the respective CSPC pool to expand the cspc pool and verifying the status of cspi. 23 | 24 | ## E2E-test Environment Variables 25 | 26 | | Parameters | Description | 27 | | ------------- | ------------------------------------------------------ | 28 | | CSPC_NAME | CSPC Pool name to expand | 29 | | POOL_TYPE | CSPC pool raid type [stripe,mirror,raidz,raidz2] | 30 | | OPERATOR_NS | Nmaespace where the openebs is deployed | 31 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/cspc_pool_failure/pool_expansion_inprogress/node_index_count: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | declare -i index=-1 4 | nodeName=$1 5 | while read i; do 6 | index=$(( index + 1 )) 7 | if [[ $i == *"$nodeName"* ]]; then 8 | break 9 | fi 10 | done <<<$(jq -c '.spec.pools[]' $2) 11 | echo $index 12 | 13 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/cspc_pool_failure/pool_expansion_inprogress/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: cspc-pool-failure-expansion-inprogress- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: cspc-failure-pool-expansion 13 | spec: 14 | serviceAccountName: e2e 15 | restartPolicy: Never 16 | containers: 17 | - name: ansibletest 18 | image: openebs/cstor-csi-e2e:ci 19 | imagePullPolicy: IfNotPresent 20 | 21 | env: 22 | - name: ANSIBLE_STDOUT_CALLBACK 23 | value: default 24 | 25 | # Provide CSPC_NAME to expand 26 | - name: CSPC_NAME 27 | value: '' 28 | 29 | # Provide the value for POOL_TYPE to expand 30 | # stripe,mirror,raidz1,raidz2 31 | - name: POOL_TYPE 32 | value: '' 33 | 34 | # Namespace where the OpenEBS components are deployed 35 | - name: OPERATOR_NS 36 | value: '' 37 | 38 | command: ["/bin/bash"] 39 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/chaos/cspc_pool_failure/pool_expansion_inprogress/test.yml -i /etc/ansible/hosts -v; exit 0"] 40 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/cspc_pool_failure/pool_expansion_inprogress/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 3 | test_name: cspc-pool-failure-expansion-in-progress 4 | pool_name: "{{ lookup('env','CSPC_NAME') }}" 5 | pool_type: "{{ lookup('env','POOL_TYPE') }}" 6 | 7 | bd_count: 8 | stripe: 9 | count: 1 10 | mirror: 11 | count: 2 12 | raidz1: 13 | count: 3 14 | raidz2: 15 | count: 6 16 | 17 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/openebs_target_failure/chaosutil.j2: -------------------------------------------------------------------------------- 1 | {% if target_container is defined and target_container == 'cstor-istgt' or target_container == 'cstor-volume-mgmt' %} 2 | chaosutil: openebs/cstor_target_container_kill.yml 3 | {% else %} 4 | chaosutil: openebs/cstor_target_failure.yaml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/openebs_target_failure/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/openebs_target_failure/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: openebs-target-failure 2 | 3 | ## TODO: Remove target namespace ENV in future (should be derived) 4 | ## Retaining now for backward compatibility w/ target chaoslib 5 | target_namespace: "{{ lookup('env','TARGET_NAMESPACE') }}" 6 | 7 | operator_ns: 'openebs' 8 | 9 | ## TODO: The var names for app labels, pvc, namespace etc., change across tests 10 | ## Need to make this consistent 11 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 12 | 13 | label: "{{ lookup('env','APP_LABEL') }}" 14 | 15 | pvc: "{{ lookup('env','APP_PVC') }}" 16 | 17 | liveness_label: "{{ lookup('env','LIVENESS_APP_LABEL') }}" 18 | 19 | liveness_namespace: "{{ lookup('env','LIVENESS_APP_NAMESPACE') }}" 20 | 21 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 22 | 23 | target_container: "{{ lookup('env','TARGET_CONTAINER') }}" 24 | 25 | chaos_duration: 120 26 | 27 | cri: "{{ lookup('env','CONTAINER_RUNTIME') }}" 28 | 29 | target_affinity_check: "{{ lookup('env','TARGET_AFFINITY_CHECK') }}" 30 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/openebs_target_network_delay/chaosutil.j2: -------------------------------------------------------------------------------- 1 | {% if cri is defined and cri == 'docker' %} 2 | chaosutil: openebs/cstor_target_network_delay.yaml 3 | {% elif cri is defined and (cri == 'containerd' or cri == 'cri-o') %} 4 | chaosutil: openebs/inject_network_delay_tc.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/openebs_target_network_delay/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/openebs_target_network_delay/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: openebs-target-network-delay 2 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 3 | label: "{{ lookup('env','APP_LABEL') }}" 4 | pvc: "{{ lookup('env','APP_PVC') }}" 5 | n_delay: "{{ lookup('env','NETWORK_DELAY') }}" 6 | c_duration: "{{ lookup('env','CHAOS_DURATION') }}" 7 | operator_ns: "{{ lookup('env','OPERATOR_NAMESPACE') }}" 8 | liveness_label: "{{ lookup('env','LIVENESS_APP_LABEL') }}" 9 | liveness_namespace: "{{ lookup('env','LIVENESS_APP_NAMESPACE') }}" 10 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 11 | cri: "{{ lookup('env','CONTAINER_RUNTIME') }}" 12 | 13 | 14 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/openebs_target_network_loss/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/openebs_target_network_loss/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: target-network-loss 6 | namespace: e2e 7 | data: 8 | parameters.yml: | 9 | 10 | --- 11 | apiVersion: batch/v1 12 | kind: Job 13 | metadata: 14 | generateName: openebs-target-network-loss- 15 | namespace: e2e 16 | spec: 17 | template: 18 | metadata: 19 | labels: 20 | name: openebs-target-network-loss 21 | spec: 22 | serviceAccountName: e2e 23 | restartPolicy: Never 24 | containers: 25 | - name: ansibletest 26 | image: openebs/cstor-csi-e2e:ci 27 | env: 28 | - name: ANSIBLE_STDOUT_CALLBACK 29 | value: default 30 | 31 | - name: OPERATOR_NAMESPACE 32 | value: openebs 33 | 34 | - name: APP_NAMESPACE 35 | value: "" 36 | 37 | - name: APP_LABEL 38 | value: "" 39 | 40 | - name: APP_PVC 41 | value: "" 42 | 43 | - name: LIVENESS_APP_LABEL 44 | value: "" 45 | 46 | - name: LIVENESS_APP_NAMESPACE 47 | value: "" 48 | 49 | - name: DATA_PERSISTENCE 50 | value: "" 51 | 52 | command: ["/bin/bash"] 53 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/chaos/openebs_target_network_loss/test.yml -i /etc/ansible/hosts -vv; exit 0"] 54 | 55 | volumeMounts: 56 | - name: parameters 57 | mountPath: /mnt/ 58 | volumes: 59 | - name: parameters 60 | configMap: 61 | name: target-network-loss 62 | -------------------------------------------------------------------------------- /e2e-tests/experiments/chaos/openebs_target_network_loss/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: openebs-target-network-loss 2 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 3 | label: "{{ lookup('env','APP_LABEL') }}" 4 | pvc: "{{ lookup('env','APP_PVC') }}" 5 | operator_ns: "{{ lookup('env','OPERATOR_NAMESPACE') }}" 6 | liveness_label: "{{ lookup('env','LIVENESS_APP_LABEL') }}" 7 | liveness_namespace: "{{ lookup('env','LIVENESS_APP_NAMESPACE') }}" 8 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cspc-pool-provision/add_blockdevice.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Getting the Unclaimed block-device from each node 3 | shell: kubectl get blockdevice -n {{ operator_ns }} -l kubernetes.io/hostname={{ outer_item }} -o json | jq '.items[] | select(.status.claimState=="Unclaimed") | select(.status.state=="Active") | .metadata.name' | tr "\"" " " | grep -v sparse | head -n "{{ disk_count }}" 4 | register: blockDevice 5 | 6 | - name: Add the block devices 7 | lineinfile: 8 | path: ./blockdevice-{{ outer_item }}.yml 9 | insertafter: ' blockDevices:' 10 | line: ' - blockDeviceName: {{ item }}' 11 | with_items: 12 | - "{{ blockDevice.stdout_lines }}" 13 | -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cspc-pool-provision/blockdevice.j2: -------------------------------------------------------------------------------- 1 | - nodeSelector: 2 | kubernetes.io/hostname: {{ item[0] }} 3 | dataRaidGroups: 4 | - blockDevices: 5 | poolConfig: 6 | dataRaidGroupType: pool-type 7 | -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cspc-pool-provision/cspc.yml: -------------------------------------------------------------------------------- 1 | apiVersion: cstor.openebs.io/v1 2 | kind: CStorPoolCluster 3 | metadata: 4 | name: pool-name 5 | namespace: operator_ns 6 | spec: 7 | pools: 8 | 9 | 10 | --- 11 | kind: StorageClass 12 | apiVersion: storage.k8s.io/v1 13 | metadata: 14 | name: sc-name 15 | annotations: 16 | openebs.io/cas-type: cstor 17 | provisioner: cstor.csi.openebs.io 18 | allowVolumeExpansion: true 19 | parameters: 20 | replicaCount: "3" 21 | cas-type: cstor 22 | cstorPoolCluster: pool-name 23 | -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cspc-pool-provision/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 3 | test_name: cstor-pool-provision 4 | pool_name: "{{ lookup('env','POOL_NAME') }}" 5 | pool_type: "{{ lookup('env','POOL_TYPE') }}" 6 | node_label: "{{ lookup('env','NODE_LABEL') }}" 7 | deploy_mode: "{{ lookup('env','DEPLOY_MODE') }}" 8 | pool_count: "{{ lookup('env','POOL_COUNT') }}" 9 | sc_name: "{{ lookup('env', 'STORAGE_CLASS') }}" 10 | 11 | bd_count: 12 | stripe: 13 | count: 1 14 | mirror: 15 | count: 2 16 | raidz: 17 | count: 3 18 | raidz2: 19 | count: 6 20 | 21 | -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cstor-operator-provisioner/README.md: -------------------------------------------------------------------------------- 1 | ## About this experiment 2 | 3 | This experiment deploys the cstor-operator provisioner in openebs namespace which includes csi controller cspc and cvc operator, cstor-csi-node,openebs-ndm deamonset. 4 | 5 | ## Entry-Criteria 6 | 7 | - K8s cluster should be in healthy state including all the nodes in ready state. 8 | - If we don't want to use this experiment to deploy cstor operator, we can directly apply the cstor operator file as mentioned below. 9 | 10 | ``` 11 | kubectl apply -f https://raw.githubusercontent.com/openebs/charts/gh-pages//cstor-operator.yaml 12 | ``` 13 | 14 | ## Exit-Criteria 15 | 16 | - cstor csi driver components should be deployed successfully and all the pods including csi-controller, cspc and cvc operator, openebs-ndm and csi node-agent daemonset are in running state. 17 | 18 | ## How to run 19 | 20 | - This experiment accepts the parameters in form of kubernetes job environmental variables. 21 | - For running this experiment of deploying cstor operator, clone openens/cstor-operators[https://github.com/openebs/cstor-operators] repo and then first apply rbac and crds for e2e-framework. 22 | ``` 23 | kubectl apply -f cstor-operators/e2e-tests/hack/rbac.yaml 24 | kubectl apply -f cstor-operators/e2e-tests/hack/crds.yaml 25 | ``` 26 | then update the needed test specific values in run_e2e_test.yml file and create the kubernetes job. 27 | ``` 28 | kubectl create -f run_e2e_test.yml 29 | ``` 30 | All the env variables description is provided with the comments in the same file. 31 | 32 | -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cstor-operator-provisioner/snapshot-class.j2: -------------------------------------------------------------------------------- 1 | kind: VolumeSnapshotClass 2 | apiVersion: snapshot.storage.k8s.io/v1 3 | metadata: 4 | name: csi-cstor 5 | namespace: kube-system 6 | annotations: 7 | snapshot.storage.kubernetes.io/is-default-class: "true" 8 | driver: cstor.csi.openebs.io 9 | deletionPolicy: Delete 10 | -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cstor-operator-provisioner/test_vars.yml: -------------------------------------------------------------------------------- 1 | cspc_operator_link: https://raw.githubusercontent.com/openebs/cstor-operators/HEAD/deploy/yamls/cspc-operator.yaml 2 | cspc_rbac_link: https://raw.githubusercontent.com/openebs/cstor-operators/HEAD/deploy/yamls/rbac.yaml 3 | all_crd_link: https://raw.githubusercontent.com/openebs/cstor-operators/HEAD/deploy/crds/all_cstor_crds.yaml 4 | csi_operator_link: https://raw.githubusercontent.com/openebs/cstor-operators/HEAD/deploy/yamls/csi-operator.yaml 5 | ndm_operator_link: https://raw.githubusercontent.com/openebs/cstor-operators/HEAD/deploy/yamls/ndm-operator.yaml 6 | cstor_operator_link: https://raw.githubusercontent.com/openebs/charts/gh-pages/versioned/{{ openebs_version }}/cstor-operator.yaml 7 | release_operator_link: "https://raw.githubusercontent.com/openebs/charts/{{ commit_id }}/versioned/{{ openebs_version }}/cstor-operator.yaml" 8 | rc_operator_link: "https://raw.githubusercontent.com/openebs/charts/{{ commit_id }}/versioned/{{ openebs_version }}/cstor-operator-{{ rc_tag }}.yaml" 9 | cspc_operator: cspc-operator.yaml 10 | csi_operator: csi-operator.yaml 11 | cstor_operator: cstor-operator.yaml 12 | cspc_rbac: rbac.yaml 13 | cspc_crd: all_cstor_crds.yaml 14 | ndm_operator: ndm-operator.yaml 15 | release_tag: "{{ lookup('env','IMAGE_TYPE') }}" 16 | openebs_version: "{{ lookup('env','OPENEBS_VERSION') }}" 17 | webhook_policy: "{{ lookup('env','WEBHOOK_FAILURE_POLICY') }}" 18 | test_name: "openebs-cstor-operator-{{ lookup('env','ACTION') }}" 19 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 20 | commit_id: "{{ lookup('env','COMMIT_ID') }}" 21 | rc_tag: "{{ lookup('env','RC_TAG') }}" 22 | -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cstor-storage-policies/csi-cstor-sc.j2: -------------------------------------------------------------------------------- 1 | --- 2 | kind: StorageClass 3 | apiVersion: storage.k8s.io/v1 4 | metadata: 5 | name: openebs-cstor-csi 6 | annotations: 7 | openebs.io/cas-type: cstor 8 | provisioner: cstor.csi.openebs.io 9 | allowVolumeExpansion: true 10 | parameters: 11 | replicaCount: "3" 12 | cas-type: cstor 13 | cstorPoolCluster: "{{ pool_name }}" 14 | 15 | --- 16 | kind: StorageClass 17 | apiVersion: storage.k8s.io/v1 18 | metadata: 19 | name: openebs-cstor-csi-single-replica 20 | annotations: 21 | openebs.io/cas-type: cstor 22 | provisioner: cstor.csi.openebs.io 23 | allowVolumeExpansion: true 24 | parameters: 25 | replicaCount: "1" 26 | cas-type: cstor 27 | cstorPoolCluster: "{{ pool_name }}" 28 | -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cstor-storage-policies/csi-cstor-xfs-sc.j2: -------------------------------------------------------------------------------- 1 | --- 2 | kind: StorageClass 3 | apiVersion: storage.k8s.io/v1 4 | metadata: 5 | name: openebs-cstor-csi-xfs 6 | provisioner: cstor.csi.openebs.io 7 | allowVolumeExpansion: true 8 | parameters: 9 | cas-type: cstor 10 | replicaCount: "3" 11 | cstorPoolCluster: "{{ pool_name }}" 12 | fsType: xfs 13 | 14 | --- 15 | kind: StorageClass 16 | apiVersion: storage.k8s.io/v1 17 | metadata: 18 | name: openebs-cstor-csi-xfs-single-replica 19 | provisioner: cstor.csi.openebs.io 20 | allowVolumeExpansion: true 21 | parameters: 22 | cas-type: cstor 23 | replicaCount: "1" 24 | cstorPoolCluster: "{{ pool_name }}" 25 | fsType: xfs 26 | 27 | -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cstor-storage-policies/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: cstor-storage-policies- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: cstor-storage-policy 13 | 14 | spec: 15 | serviceAccountName: e2e 16 | restartPolicy: Never 17 | containers: 18 | - name: ansibletest 19 | image: openebs/cstor-csi-e2e:ci 20 | imagePullPolicy: IfNotPresent 21 | 22 | env: 23 | - name: ANSIBLE_STDOUT_CALLBACK 24 | value: default 25 | 26 | # Provide name POOL_NAME for the cstor-pool 27 | - name: POOL_NAME 28 | value: cstor-cspc-disk-pool 29 | 30 | ## Two values: create and delete 31 | - name: ACTION 32 | value: create 33 | 34 | command: ["/bin/bash"] 35 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/cstor-operator/cstor-storage-policies/test.yml -i /etc/ansible/hosts -v; exit 0"] 36 | -------------------------------------------------------------------------------- /e2e-tests/experiments/cstor-operator/cstor-storage-policies/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | test_name: cstor-storage-policies 3 | pool_name: "{{ lookup('env','POOL_NAME') }}" 4 | csi_storage_policies: 5 | - csi-cstor-xfs-sc.yml 6 | - csi-cstor-sc.yml 7 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/app-target-affinity/app-target-affinity-policy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: cstor.openebs.io/v1 3 | kind: CStorVolumePolicy 4 | metadata: 5 | name: app-target-affinity-policy 6 | namespace: openebs 7 | spec: 8 | target: 9 | affinity: 10 | requiredDuringSchedulingIgnoredDuringExecution: 11 | - labelSelector: 12 | matchExpressions: 13 | - key: openebs.io/target-affinity 14 | operator: In 15 | values: 16 | - app-label 17 | topologyKey: kubernetes.io/hostname 18 | namespaces: ["app-namespace"] 19 | 20 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/app-target-affinity/app-target-affinity-sc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: storage.k8s.io/v1 2 | kind: StorageClass 3 | metadata: 4 | name: testclass 5 | provisioner: cstor.csi.openebs.io 6 | allowVolumeExpansion: true 7 | volumeBindingMode: WaitForFirstConsumer 8 | parameters: 9 | replicaCount: "3" 10 | cstorPoolCluster: "pool-name" 11 | cas-type: "cstor" 12 | cstorVolumePolicy: "app-target-affinity-policy" 13 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/app-target-affinity/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parametres 2 | 3 | application_deployment: percona.yml 4 | affinity_policy: app-target-affinity-policy.yml 5 | affinity_sc: app-target-affinity-sc.yaml 6 | app_ns: "{{ lookup('env','APP_NAMESPACE') }}" 7 | operator_ns: "{{ lookup('env','OPENEBS_NAMESPACE') }}" 8 | app_label: "{{ lookup('env','APP_LABEL') }}" 9 | test_name: csi-app-target-affinity 10 | action: "{{ lookup('env','ACTION') }}" 11 | app_pvc: "{{ lookup('env','APP_PVC') }}" 12 | pool_name: "{{ lookup('env','POOL_NAME') }}" 13 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/backup_and_restore/credentials-velero: -------------------------------------------------------------------------------- 1 | [default] 2 | aws_access_key_id = minio 3 | aws_secret_access_key = minio123 4 | [add-profile] 5 | aws_access_key_id = minio 6 | aws_secret_access_key = minio123 -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/backup_and_restore/gcp-volume-snapshot-location.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: velero.io/v1 3 | kind: VolumeSnapshotLocation 4 | metadata: 5 | name: gcp-bucket 6 | namespace: velero 7 | spec: 8 | provider: openebs.io/cstor-blockstore 9 | config: 10 | bucket: e2e-gcp-bucket 11 | provider: gcp 12 | autoSetTargetIP: "true" 13 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/backup_and_restore/local-volume-snapshot-location.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: velero.io/v1 3 | kind: VolumeSnapshotLocation 4 | metadata: 5 | # name -- volumeSnapshotLocation Name (local-default...) 6 | name: local 7 | namespace: velero 8 | spec: 9 | provider: openebs.io/cstor-blockstore 10 | config: 11 | # namespace -- namespace in which openebs is installed (default: openebs) 12 | namespace: openebs 13 | local: "true" 14 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/backup_and_restore/minio-volume-snapshot-location.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: velero.io/v1 3 | kind: VolumeSnapshotLocation 4 | metadata: 5 | name: minio 6 | namespace: velero 7 | spec: 8 | provider: openebs.io/cstor-blockstore 9 | config: 10 | bucket: velero 11 | provider: aws 12 | region: minio 13 | #profile: new-profile 14 | s3ForcePathStyle: "true" 15 | s3Url: http://minio.velero.svc:9000 16 | autoSetTargetIP: "true" 17 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/backup_and_restore/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: "velero-backup-restore" 2 | app_ns: "{{ lookup('env','APP_NAMESPACE') }}" 3 | app_ns_new: "{{ lookup('env','APP_NAMESPACE') }}-local" 4 | app_label: "{{ lookup('env','APP_LABEL') }}" 5 | app_pvc: "{{ lookup('env','APP_PVC') }}" 6 | operator_ns: "{{ lookup('env','OPERATOR_NAMESPACE') }}" 7 | backup_name: "{{ lookup('env','BACKUP_NAME') }}" 8 | failure_type: "{{ lookup('env','COMPONENT_FAILURE') }}" 9 | velero_plugin_name: "{{ lookup('env','VELERO_PLUGIN_NAME') }}" 10 | velero_version: "{{ lookup('env','VELERO_VERSION') }}" 11 | storage_engine: "{{ lookup('env','STORAGE_ENGINE') }}" 12 | profile_name: "{{ lookup('env','PROFILE') }}" 13 | bucket_type: "{{ lookup('env','STORAGE_BUCKET') }}" 14 | gcp_project_id: "{{ lookup('env','GCP_PROJECT_ID') }}" 15 | velero_binary_url: "https://github.com/vmware-tanzu/velero/releases/download/{{ lookup('env','VELERO_VERSION') }}/velero-{{ lookup('env','VELERO_VERSION') }}-linux-amd64.tar.gz" 16 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/csi-clone/busybox.j2: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: "{{ app_name }}" 5 | namespace: "{{ namespace }}" 6 | labels: 7 | app: "{{ app_label }}" 8 | spec: 9 | selector: 10 | matchLabels: 11 | app: "{{ app_label }}" 12 | template: 13 | metadata: 14 | labels: 15 | app: "{{ app_label }}" 16 | spec: 17 | containers: 18 | - name: app-busybox 19 | imagePullPolicy: IfNotPresent 20 | image: gcr.io/google-containers/busybox 21 | command: ["/bin/sh"] 22 | args: ["-c", "while true; do sleep 10;done"] 23 | env: 24 | volumeMounts: 25 | - name: data-vol 26 | mountPath: /busybox 27 | volumes: 28 | - name: data-vol 29 | persistentVolumeClaim: 30 | claimName: "{{ cloned_pvc }}" 31 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/csi-clone/clone.j2: -------------------------------------------------------------------------------- 1 | kind: PersistentVolumeClaim 2 | apiVersion: v1 3 | metadata: 4 | name: "{{ cloned_pvc }}" 5 | spec: 6 | storageClassName: "{{ storage_class_name }}" 7 | dataSource: 8 | name: "{{ snapshot_name }}" 9 | kind: VolumeSnapshot 10 | apiGroup: snapshot.storage.k8s.io 11 | accessModes: 12 | - ReadWriteOnce 13 | resources: 14 | requests: 15 | storage: "{{ storage_capacity }}" -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/csi-clone/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: cstor-csi-clone 2 | 3 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 4 | 5 | pvc_name: "{{ lookup('env','APP_PVC') }}" 6 | 7 | app_name: "{{ lookup('env','APP_NAME') }}" 8 | 9 | app_label: "{{ lookup('env','APP_LABEL') }}" 10 | 11 | snapshot_class: "{{ lookup('env','SNAPSHOT_CLASS') }}" 12 | 13 | snapshot_name: "{{ lookup('env','SNAPSHOT_NAME') }}" 14 | 15 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 16 | 17 | storage_class_name: "{{ lookup('env','STORAGE_CLASS_NAME') }}" 18 | 19 | storage_capacity: "{{ lookup('env','STORAGE_CAPACITY') }}" 20 | 21 | cloned_pvc: "{{ lookup('env','CLONED_PVC') }}" 22 | 23 | operator_ns: "{{ lookup('env','OPENEBS_NAMESPACE') }}" 24 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/csi-snapshot/snapshot.j2: -------------------------------------------------------------------------------- 1 | apiVersion: snapshot.storage.k8s.io/v1beta1 2 | kind: VolumeSnapshot 3 | metadata: 4 | name: "{{ snapshot_name }}" 5 | spec: 6 | volumeSnapshotClassName: "{{ snapshot_class }}" 7 | source: 8 | persistentVolumeClaimName: "{{ pvc_name }}" -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/csi-snapshot/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: cstor-csi-snapshot 2 | 3 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 4 | 5 | pvc_name: "{{ lookup('env','APP_PVC') }}" 6 | 7 | snapshot_class: "{{ lookup('env','SNAPSHOT_CLASS') }}" 8 | 9 | snapshot_name: "{{ lookup('env','SNAPSHOT_NAME') }}" 10 | 11 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 12 | 13 | operator_ns: "{{ lookup('env','OPENEBS_NAMESPACE') }}" 14 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/csi-volume-resize/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: csi-vol-resize- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: csi-vol-resize 13 | 14 | spec: 15 | serviceAccountName: e2e 16 | restartPolicy: Never 17 | containers: 18 | - name: ansibletest 19 | image: openebs/cstor-csi-e2e:ci 20 | imagePullPolicy: IfNotPresent 21 | 22 | env: 23 | - name: ANSIBLE_STDOUT_CALLBACK 24 | value: default 25 | 26 | # Application namespace 27 | - name: APP_NAMESPACE 28 | value: '' 29 | 30 | # Application pvc 31 | - name: APP_PVC 32 | value: '' 33 | 34 | # Application pod label in `key=value` format 35 | - name: APP_LABEL 36 | value: '' 37 | 38 | # storage class used to provision the application 39 | - name: STORAGE_CLASS 40 | value: '' 41 | 42 | # Existing volume capacity 43 | - name: PV_CAPACITY 44 | value: '' 45 | 46 | #Resized PVC size (for eg. 10Gi) 47 | - name: NEW_CAPACITY 48 | value: '' 49 | 50 | command: ["/bin/bash"] 51 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/csi-volume-resize/test.yml -i /etc/ansible/hosts -vv; exit 0"] 52 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/csi-volume-resize/test_vars.yml: -------------------------------------------------------------------------------- 1 | --- 2 | test_name: csi-volume-resize 3 | 4 | app_ns: "{{ lookup('env','APP_NAMESPACE') }}" 5 | 6 | app_label: "{{ lookup('env','APP_LABEL') }}" 7 | 8 | app_pvc: "{{ lookup('env','APP_PVC') }}" 9 | 10 | vol_size: "{{ lookup('env','PV_CAPACITY') }}" 11 | 12 | desired_vol_size: "{{ lookup('env','NEW_CAPACITY') }}" 13 | 14 | storage_class: "{{ lookup('env','STORAGE_CLASS') }}" 15 | 16 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-creation-bd-with-filesystem/cspc.yml: -------------------------------------------------------------------------------- 1 | apiVersion: cstor.openebs.io/v1 2 | kind: CStorPoolCluster 3 | metadata: 4 | name: pool-name 5 | namespace: operator_ns 6 | spec: 7 | pools: 8 | - nodeSelector: 9 | kubernetes.io/hostname: node-name 10 | dataRaidGroups: 11 | - blockDevices: 12 | poolConfig: 13 | dataRaidGroupType: pool-type 14 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-creation-bd-with-filesystem/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: cstor-pool-creation-bd-with-filesystem- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: cstor-pool-creation-bd-with-filesystem 13 | spec: 14 | serviceAccountName: e2e 15 | restartPolicy: Never 16 | containers: 17 | - name: ansibletest 18 | image: openebs/cstor-csi-e2e:ci 19 | imagePullPolicy: IfNotPresent 20 | 21 | env: 22 | - name: ANSIBLE_STDOUT_CALLBACK 23 | value: default 24 | 25 | # Provide name POOL_NAME for the cstor-pool 26 | - name: POOL_NAME 27 | value: cspc-pool-bd-filesystem 28 | 29 | # Provide the value for POOL_TYPE 30 | # stripe, mirror, raidz, raidz2 31 | - name: POOL_TYPE 32 | value: stripe 33 | 34 | # Namespace where the OpenEBS components are deployed 35 | - name: OPERATOR_NS 36 | value: openebs 37 | 38 | #Password for the node to ssh and create the filesystem on the disk 39 | - name: NODE_PASSWORD 40 | value: "" 41 | 42 | #Username for the node to ssh and create the filesystem on the disk 43 | - name: USER_NAME 44 | value: "" 45 | 46 | command: ["/bin/bash"] 47 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cspc-pool/block-pool-creation-bd-with-filesystem/test.yml -i /etc/ansible/hosts -v; exit 0"] 48 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-creation-bd-with-filesystem/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 3 | test_name: block-pool-creation-bd-with-filesystem 4 | pool_name: "{{ lookup('env','POOL_NAME') }}" 5 | pool_type: "{{ lookup('env','POOL_TYPE') }}" 6 | password: "{{ lookup('env','NODE_PASSWORD') }}" 7 | 8 | bd_count: 9 | stripe: 10 | count: 1 11 | mirror: 12 | count: 2 13 | raidz: 14 | count: 3 15 | raidz2: 16 | count: 6 17 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-creation-with-claimed-bd/add_blockdevice.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ##{{ outer_item }} is name of the list of nodes, the values will passed as a loop variable in test.yml 3 | 4 | - name: Getting the Claimed block-device from each node 5 | shell: kubectl get blockdevice -n {{ operator_ns }} -l kubernetes.io/hostname={{ outer_item }} -o json | jq '.items[] | select(.status.claimState=="Claimed") | select(.status.state=="Active") | .metadata.name' | tr "\"" " " | grep -v sparse | head -n "{{ disk_count }}" 6 | register: blockDevice 7 | 8 | - name: Add the block devices 9 | lineinfile: 10 | path: ./blockdevice-{{ outer_item }}.yml 11 | insertafter: ' blockDevices:' 12 | line: ' - blockDeviceName: {{ item }}' 13 | with_items: 14 | - "{{ blockDevice.stdout_lines }}" 15 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-creation-with-claimed-bd/blockdevice.j2: -------------------------------------------------------------------------------- 1 | - nodeSelector: 2 | kubernetes.io/hostname: {{ item[0] }} 3 | dataRaidGroups: 4 | - blockDevices: 5 | poolConfig: 6 | dataRaidGroupType: pool-type 7 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-creation-with-claimed-bd/cspc.yml: -------------------------------------------------------------------------------- 1 | apiVersion: cstor.openebs.io/v1 2 | kind: CStorPoolCluster 3 | metadata: 4 | name: pool-name 5 | namespace: operator_ns 6 | spec: 7 | pools: 8 | 9 | 10 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-creation-with-claimed-bd/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: cstor-pool-creation-with-claimed-bd- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: cstor-pool-creation-with-claimed-bd 13 | spec: 14 | serviceAccountName: e2e 15 | restartPolicy: Never 16 | containers: 17 | - name: ansibletest 18 | image: openebs/cstor-csi-e2e:ci 19 | imagePullPolicy: IfNotPresent 20 | 21 | env: 22 | - name: ANSIBLE_STDOUT_CALLBACK 23 | value: default 24 | 25 | # Provide name POOL_NAME for the cstor-pool 26 | - name: POOL_NAME 27 | value: cstor-cspc-disk-pool 28 | 29 | # Provide the value for POOL_TYPE 30 | # stripe, mirror, raidz, raidz2 31 | - name: POOL_TYPE 32 | value: stripe 33 | 34 | # Namespace where the OpenEBS components are deployed 35 | - name: OPERATOR_NS 36 | value: openebs 37 | 38 | # Pool count to create the required number of pools 39 | - name: POOL_COUNT 40 | value: '3' 41 | 42 | command: ["/bin/bash"] 43 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cspc-pool/block-pool-creation-with-claimed-bd/test.yml -i /etc/ansible/hosts -v; exit 0"] 44 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-creation-with-claimed-bd/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 3 | test_name: block-pool-creation-with-claimed-bd 4 | pool_name: "{{ lookup('env','POOL_NAME') }}" 5 | pool_type: "{{ lookup('env','POOL_TYPE') }}" 6 | pool_count: "{{ lookup('env','POOL_COUNT') }}" 7 | 8 | bd_count: 9 | stripe: 10 | count: 1 11 | mirror: 12 | count: 2 13 | raidz: 14 | count: 3 15 | raidz2: 16 | count: 6 17 | 18 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-deletion-with-volume/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: validate-pool-deletion-with-volume- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: pool-deletion-with-volume 13 | spec: 14 | serviceAccountName: e2e 15 | restartPolicy: Never 16 | containers: 17 | - name: ansibletest 18 | image: openebs/cstor-csi-e2e:ci 19 | imagePullPolicy: IfNotPresent 20 | 21 | env: 22 | - name: ANSIBLE_STDOUT_CALLBACK 23 | value: default 24 | 25 | # Namespace where the OpenEBS components are deployed 26 | - name: OPERATOR_NS 27 | value: openebs 28 | 29 | - name: APP_NAMESPACE 30 | value: "" 31 | 32 | - name: APP_LABEL 33 | value: "" 34 | 35 | command: ["/bin/bash"] 36 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cspc-pool/block-pool-deletion-with-volume/test.yml -i /etc/ansible/hosts -v; exit 0"] 37 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-deletion-with-volume/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 3 | test_name: block-cspc-pool-deletion-if-pool-with-volume 4 | app_ns: "{{ lookup('env','APP_NAMESPACE') }}" 5 | app_label: "{{ lookup('env','APP_LABEL') }}" 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-scaledown-with-volume/node_index_count: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | declare -i index=-1 4 | nodeName=$1 5 | while read i; do 6 | index=$(( index + 1 )) 7 | if [[ $i == *"$nodeName"* ]]; then 8 | break 9 | fi 10 | done <<<$(jq -c '.spec.pools[]' $2) 11 | echo $index 12 | 13 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-scaledown-with-volume/pool_scaledown.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Getting the node name for the targeted cspi 4 | shell: > 5 | kubectl get cspi -n {{ operator_ns }} {{ targeted_cspi }} -o custom-columns=:.spec.hostName --no-headers 6 | args: 7 | executable: /bin/bash 8 | register: node_name 9 | 10 | - name: Getting the used block-device by CSPI 11 | shell: > 12 | kubectl get cspi -n {{ operator_ns }} {{ targeted_cspi }} 13 | -o custom-columns=:.spec.dataRaidGroup[*].blockDevices[*].blockDeviceName --no-headers 14 | register: blockDevice 15 | 16 | - name: Obtain the cspc pool spec in json format 17 | shell: kubectl get cspc -n {{ operator_ns }} {{ pool_name }} -o json > ./cspc-pool-scaledown.json 18 | args: 19 | executable: /bin/bash 20 | 21 | - name: Obtain the index position of the nodes from cspc json spec 22 | shell: ./node_index_count {{ node_name.stdout }} ./cspc-pool-scaledown.json 23 | register: index_count 24 | 25 | - name: Patch the CSPC to scaledown the pool 26 | shell: > 27 | kubectl patch cspc -n {{ operator_ns }} {{ pool_name }} --type='json' 28 | -p='[{"op": "remove", "path": "/spec/pools/{{ index_count.stdout }}"}]' 29 | args: 30 | executable: /bin/bash 31 | register: patch_cspc 32 | failed_when: "'volume still exists on pool' not in patch_cspc.stderr" 33 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-scaledown-with-volume/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: block-cspc-pool-scaledown- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: block-cspc-pool-scaledown 13 | spec: 14 | serviceAccountName: e2e 15 | restartPolicy: Never 16 | containers: 17 | - name: ansibletest 18 | image: openebs/cstor-csi-e2e:ci 19 | imagePullPolicy: IfNotPresent 20 | 21 | env: 22 | - name: ANSIBLE_STDOUT_CALLBACK 23 | value: default 24 | 25 | # Provide POOL_NAME to scaledown 26 | - name: POOL_NAME 27 | value: "" 28 | 29 | # Namespace where the OpenEBS components are deployed 30 | - name: OPERATOR_NS 31 | value: "" 32 | 33 | command: ["/bin/bash"] 34 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cspc-pool/block-pool-scaledown-with-volume/test.yml -i /etc/ansible/hosts -v; exit 0"] 35 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/block-pool-scaledown-with-volume/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 3 | test_name: cstor-cspc-pool-scaledown 4 | pool_name: "{{ lookup('env','POOL_NAME') }}" 5 | 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/blockdevice-reusability/add_blockdevice.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ##{{ outer_item }} is name of the node, the values will passed as a loop variable in test.yml 3 | 4 | - name: Getting the Block-device from each node of existing spc pool 5 | shell: > 6 | kubectl get bdc -n {{ operator_ns }} -l openebs.io/cstor-pool-cluster={{ old_cspc_pool }} -o json | jq '.items[] | select(.spec.blockDeviceNodeAttributes.hostName=="{{ outer_item }}") | .spec.blockDeviceName' | tr "\"" " " 7 | register: blockDevice 8 | 9 | - name: Add the block devices 10 | lineinfile: 11 | path: ./blockdevice-{{ outer_item }}.yml 12 | insertafter: ' blockDevices:' 13 | line: ' - blockDeviceName: {{ item }}' 14 | with_items: 15 | - "{{ blockDevice.stdout_lines }}" 16 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/blockdevice-reusability/blockdevice.j2: -------------------------------------------------------------------------------- 1 | - nodeSelector: 2 | kubernetes.io/hostname: {{ item[0] }} 3 | dataRaidGroups: 4 | - blockDevices: 5 | poolConfig: 6 | dataRaidGroupType: pool-type 7 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/blockdevice-reusability/cspc.yml: -------------------------------------------------------------------------------- 1 | apiVersion: cstor.openebs.io/v1 2 | kind: CStorPoolCluster 3 | metadata: 4 | name: cspc-pool-name 5 | namespace: operator_ns 6 | spec: 7 | pools: 8 | 9 | 10 | --- 11 | kind: StorageClass 12 | apiVersion: storage.k8s.io/v1 13 | metadata: 14 | name: sc-name 15 | annotations: 16 | openebs.io/cas-type: cstor 17 | provisioner: cstor.csi.openebs.io 18 | allowVolumeExpansion: true 19 | parameters: 20 | replicaCount: "3" 21 | cas-type: cstor 22 | cstorPoolCluster: cspc-pool-name 23 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/blockdevice-reusability/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: verify-blockdevice-reusability- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: verify-blockdevice-reusability 13 | spec: 14 | serviceAccountName: e2e 15 | restartPolicy: Never 16 | containers: 17 | - name: ansibletest 18 | image: openebs/cstor-csi-e2e:ci 19 | imagePullPolicy: IfNotPresent 20 | 21 | env: 22 | - name: ANSIBLE_STDOUT_CALLBACK 23 | value: default 24 | 25 | # Existing cspc pool name 26 | - name: OLD_CSPC_POOL_NAME 27 | value: "" 28 | 29 | # Provide the cStor CSPC pool name to create 30 | - name: NEW_CSPC_POOL_NAME 31 | value: "" 32 | 33 | # Provide the value for POOL_TYPE 34 | # stripe, mirror, raidz, raidz2 35 | - name: POOL_TYPE 36 | value: "" 37 | 38 | #Provide the name of STORAGE_CLASS 39 | - name: STORAGE_CLASS 40 | value: openebs-bd-reusability-sc 41 | 42 | # Namespace where the OpenEBS components are deployed 43 | - name: OPERATOR_NS 44 | value: openebs 45 | 46 | - name: ACTION 47 | value: provision 48 | 49 | command: ["/bin/bash"] 50 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cspc-pool/blockdevice-reusability/test.yml -i /etc/ansible/hosts -v; exit 0"] 51 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/blockdevice-reusability/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 3 | test_name: verify-blockdevice-reusability 4 | old_cspc_pool: "{{ lookup('env','OLD_CSPC_POOL_NAME') }}" 5 | new_cspc_pool: "{{ lookup('env','NEW_CSPC_POOL_NAME') }}" 6 | pool_type: "{{ lookup('env','POOL_TYPE') }}" 7 | sc_name: "{{ lookup('env', 'STORAGE_CLASS') }}" 8 | action: "{{ lookup('env', 'ACTION') }}" 9 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/disk-replacement/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/disk-replacement/node_index_count: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | declare -i index=-1 4 | nodeName=$1 5 | while read i; do 6 | index=$(( index + 1 )) 7 | if [[ $i == *"$nodeName"* ]]; then 8 | break 9 | fi 10 | done <<<$(jq -c '.spec.pools[]' $2) 11 | echo $index 12 | 13 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/disk-replacement/test_vars.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ## TEST-SPECIFIC PARAMS 3 | test_name: blockdevice-replacement 4 | app_namespace: "{{ lookup('env','APP_NAMESPACE') }}" 5 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 6 | label: "{{ lookup('env','APP_LABEL') }}" 7 | app_pvc: "{{ lookup('env','APP_PVC') }}" 8 | pool_name: "{{ lookup('env','POOL_NAME') }}" 9 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 10 | 11 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/fail_bd_replacement_with_claimed_bd/README.md: -------------------------------------------------------------------------------- 1 | ## Experiment Metadata 2 | 3 | Type | Description | Storage | K8s Platform | 4 | ------|---------------------------------------------------------------|------------|--------------| 5 | Functional | Verify the BlockDevice replacement is blocked by the admission server if the Bd is in claimed state | OpenEBS | Any | 6 | 7 | ## Entry-Criteria 8 | 9 | - cStor pool instances are in healthy state. 10 | - Claimed BlockDevice should be available in the node to perform the disk replacement is blocked. 11 | 12 | ## Exit-Criteria 13 | 14 | - cStor pool pods are should be Healthy. 15 | 16 | ### Application 17 | 18 | Parameter | Description 19 | --------------|------------ 20 | POOL_NAME | Name of the CSPC to perform the disk replacement. 21 | OPERATOR_NS | Namespace in Which OpenEBS components are deployed 22 | 23 | ## Procedure 24 | 25 | - This e2e-test accepts the parameters in form of job environmental variables. 26 | - This job patches the respective blockdevice can be replaced by the already inused blockdevice in a cspc pool and verifying the BD repalcement is blocked. 27 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/fail_bd_replacement_with_claimed_bd/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: bd-replacement-with-claimed-bd- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | labels: 11 | app: bd-replacement-with-claimed-bd 12 | spec: 13 | serviceAccountName: e2e 14 | restartPolicy: Never 15 | containers: 16 | - name: ansibletest 17 | image: openebs/cstor-csi-e2e:ci 18 | env: 19 | - name: ANSIBLE_STDOUT_CALLBACK 20 | value: default 21 | 22 | # Namespace where the OpenEBS components are deployed 23 | - name: OPERATOR_NS 24 | value: "" 25 | 26 | # Name of the Pool to perform the block device Replacement 27 | - name: POOL_NAME 28 | value: "" 29 | 30 | command: ["/bin/bash"] 31 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cspc-pool/fail_bd_replacement_with_claimed_bd/test.yml -i /etc/ansible/hosts -v; exit 0"] 32 | 33 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/fail_bd_replacement_with_claimed_bd/test_vars.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ## TEST-SPECIFIC PARAMS 3 | test_name: fail-blockdevice-replacement-with-claimed-bd 4 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 5 | pool_name: "{{ lookup('env','POOL_NAME') }}" 6 | 7 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/fail_pool_expansion_with_claimed_bd/README.md: -------------------------------------------------------------------------------- 1 | ## Experiment Metadata 2 | 3 | | Type | Description | Storage | Applications | K8s Platform | 4 | | ---------- | ----------------------------------------------------- | ------------ | ------------ | ------------ | 5 | | Functional | CSPC Pool expansion has to be blocked by admission server when the block device is already used by any pool | OpenBS cStor | Any | Any | 6 | 7 | ## Entry-Criteria 8 | 9 | - K8s nodes should be ready. 10 | - cStor CSPC should be created. 11 | - Claimed BlockDevices should be available to expand the pool. 12 | 13 | ## Exit-Criteria 14 | 15 | - Pool Expansion should be blocked by the Admission server. 16 | 17 | ## Procedure 18 | 19 | - This test checks if the cspc pool Expansion can be Blocked successfully when the blockdevice already used by any other pool. 20 | - This e2e-test accepts the parameters in form of job environmental variables. 21 | - This job patches the respective CSPC pool to expand the cspc pool and verifying the pool expansion is blocked. 22 | 23 | ## e2e-test Environment Variables 24 | 25 | | Parameters | Description | 26 | | ------------- | ------------------------------------------------------ | 27 | | CSPC_NAME | CSPC Pool name to expand | 28 | | POOL_TYPE | CSPC pool raid type [stripe,mirror,raidz,raidz2] | 29 | | OPERATOR_NS | Nmaespace where the openebs is deployed | 30 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/fail_pool_expansion_with_claimed_bd/node_index_count: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | declare -i index=-1 4 | nodeName=$1 5 | while read i; do 6 | index=$(( index + 1 )) 7 | if [[ $i == *"$nodeName"* ]]; then 8 | break 9 | fi 10 | done <<<$(jq -c '.spec.pools[]' $2) 11 | echo $index 12 | 13 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/fail_pool_expansion_with_claimed_bd/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: pool-expansion-with-claimed-bd- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: pool-expansion-with-claimed-bd 13 | spec: 14 | serviceAccountName: e2e 15 | restartPolicy: Never 16 | containers: 17 | - name: ansibletest 18 | image: openebs/cstor-csi-e2e:ci 19 | imagePullPolicy: IfNotPresent 20 | 21 | env: 22 | - name: ANSIBLE_STDOUT_CALLBACK 23 | #value: log_plays, actionable, default 24 | value: default 25 | 26 | # Provide CSPC_NAME to expand 27 | - name: CSPC_NAME 28 | value: '' 29 | 30 | # Provide the value for POOL_TYPE to expand 31 | # stripe,mirror,raidz1,raidz2 32 | - name: POOL_TYPE 33 | value: '' 34 | 35 | # Namespace where the OpenEBS components are deployed 36 | - name: OPERATOR_NS 37 | value: '' 38 | 39 | command: ["/bin/bash"] 40 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cspc-pool/fail_pool_expansion_with_claimed_bd/test.yml -i /etc/ansible/hosts -v; exit 0"] 41 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/fail_pool_expansion_with_claimed_bd/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 3 | test_name: fail-pool-expansion-claimed-bd 4 | pool_name: "{{ lookup('env','CSPC_NAME') }}" 5 | pool_type: "{{ lookup('env','POOL_TYPE') }}" 6 | 7 | bd_count: 8 | stripe: 9 | count: 1 10 | mirror: 11 | count: 2 12 | raidz1: 13 | count: 3 14 | raidz2: 15 | count: 6 16 | 17 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/pool_expansion/node_index_count: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | declare -i index=-1 4 | nodeName=$1 5 | while read i; do 6 | index=$(( index + 1 )) 7 | if [[ $i == *"$nodeName"* ]]; then 8 | break 9 | fi 10 | done <<<$(jq -c '.spec.pools[]' $2) 11 | echo $index 12 | 13 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/pool_expansion/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: cstor-cspc-pool-expansion- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: cstor-cspc-pool-expansion 13 | spec: 14 | serviceAccountName: e2e 15 | restartPolicy: Never 16 | containers: 17 | - name: ansibletest 18 | image: openebs/cstor-csi-e2e:ci 19 | imagePullPolicy: IfNotPresent 20 | 21 | env: 22 | - name: ANSIBLE_STDOUT_CALLBACK 23 | value: default 24 | 25 | # Provide POOL_NAME to expand 26 | - name: POOL_NAME 27 | value: '' 28 | 29 | # Provide the value for POOL_TYPE to expand 30 | # stripe,mirror,raidz1,raidz2 31 | - name: POOL_TYPE 32 | value: '' 33 | 34 | # Namespace where the OpenEBS components are deployed 35 | - name: OPERATOR_NS 36 | value: '' 37 | 38 | command: ["/bin/bash"] 39 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cspc-pool/pool_expansion/test.yml -i /etc/ansible/hosts -v; exit 0"] 40 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/pool_expansion/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 3 | test_name: cstor-cspc-pool-expansion 4 | pool_name: "{{ lookup('env','POOL_NAME') }}" 5 | pool_type: "{{ lookup('env','POOL_TYPE') }}" 6 | 7 | bd_count: 8 | stripe: 9 | count: 1 10 | mirror: 11 | count: 2 12 | raidz1: 13 | count: 3 14 | raidz2: 15 | count: 6 16 | 17 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/pool_scaleup/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: cstor-cspc-pool-scaleup- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | name: e2e 11 | labels: 12 | app: cstor-cspc-pool-scaleup 13 | spec: 14 | serviceAccountName: e2e 15 | restartPolicy: Never 16 | containers: 17 | - name: ansibletest 18 | image: openebs/cstor-csi-e2e:ci 19 | imagePullPolicy: IfNotPresent 20 | 21 | env: 22 | - name: ANSIBLE_STDOUT_CALLBACK 23 | value: default 24 | 25 | # Provide POOL_NAME to expand 26 | - name: POOL_NAME 27 | value: "" 28 | 29 | # Provide the value for POOL_TYPE to expand 30 | # stripe,mirror,raidz1,raidz2 31 | - name: POOL_TYPE 32 | value: "" 33 | 34 | # Namespace where the OpenEBS components are deployed 35 | - name: OPERATOR_NS 36 | value: "" 37 | 38 | command: ["/bin/bash"] 39 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cspc-pool/pool_scaleup/test.yml -i /etc/ansible/hosts -v; exit 0"] 40 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cspc-pool/pool_scaleup/test_vars.yml: -------------------------------------------------------------------------------- 1 | # Test-specific parameters 2 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 3 | test_name: cstor-cspc-pool-scaleup 4 | pool_name: "{{ lookup('env','POOL_NAME') }}" 5 | pool_type: "{{ lookup('env','POOL_TYPE') }}" 6 | 7 | bd_count: 8 | stripe: 9 | count: 1 10 | mirror: 11 | count: 2 12 | raidz1: 13 | count: 3 14 | raidz2: 15 | count: 6 16 | 17 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cstor-csi-volume-scaledown/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cstor-csi-volume-scaledown/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: csi-replica-scaledown 6 | namespace: e2e 7 | data: 8 | parameters.yml: | 9 | 10 | --- 11 | apiVersion: batch/v1 12 | kind: Job 13 | metadata: 14 | generateName: cstor-csi-replica-scaledown- 15 | namespace: e2e 16 | spec: 17 | template: 18 | metadata: 19 | labels: 20 | name: cstor-csi-replica-scaledown 21 | spec: 22 | serviceAccountName: e2e 23 | restartPolicy: Never 24 | containers: 25 | - name: ansibletest 26 | image: openebs/cstor-csi-e2e:ci 27 | imagePullPolicy: IfNotPresent 28 | env: 29 | - name: ANSIBLE_STDOUT_CALLBACK 30 | value: default 31 | 32 | - name: APP_NAMESPACE 33 | value: '' 34 | 35 | - name: APP_PVC 36 | value: '' 37 | 38 | - name: APP_LABEL 39 | value: '' 40 | 41 | - name: OPENEBS_NAMESPACE 42 | value: "openebs" 43 | 44 | - name: DATA_PERSISTENCE 45 | value: "" 46 | 47 | command: ["/bin/bash"] 48 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cstor-csi-volume-scaledown/test.yml -i /etc/ansible/hosts -vv; exit 0"] 49 | 50 | volumeMounts: 51 | - name: parameters 52 | mountPath: /mnt/ 53 | volumes: 54 | - name: parameters 55 | configMap: 56 | name: csi-replica-scaledown 57 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cstor-csi-volume-scaledown/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: cstor-csi-replica-scaledown 2 | 3 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 4 | 5 | pvc_name: "{{ lookup('env','APP_PVC') }}" 6 | 7 | label: "{{ lookup('env','APP_LABEL') }}" 8 | 9 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 10 | 11 | openebs_ns: "{{ lookup('env','OPENEBS_NAMESPACE') }}" 12 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cstor-csi-volume-scaleup/README.md: -------------------------------------------------------------------------------- 1 | ## Experiment Metadata 2 | 3 | | Type | Description | Storage 4 | | ---------- | ----------------------------------------------------- | ------------ 5 | | Functional | Scale up the cStor volume replica of cstor-csi volume | OpenBS cStor 6 | 7 | ## Entry-Criteria 8 | 9 | - K8s nodes should be ready. 10 | - cStor CSPC should be created. 11 | - Application should be deployed using with volume provisioned through CSI provisioner. 12 | - CSPIs should be present for scaling up the volume replicas. 13 | 14 | ## Exit-Criteria 15 | 16 | - Volume replicas should be scaled up and rebuilt successfully. 17 | 18 | ## Procedure 19 | 20 | - This functional test checks if the csi volume replicas can be scaled up. 21 | - This e2e-test accepts the parameters in form of job environmental variables. 22 | - It is assumed that the volume is created with single replica. 23 | - This job patches the respective CVC with the unused pool names and thereby scaling up the replicas 24 | 25 | ## E2E-TEST Environment Variables 26 | 27 | | Parameters | Description | 28 | | ------------- | ------------------------------------------------------ | 29 | | APP_NAMESPACE | Namespace where application and volume is deployed. | 30 | | APP_PVC | Name of PVC whose storage capacity has to be increased | 31 | | APP_LABEL | Label of application pod | 32 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cstor-csi-volume-scaleup/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cstor-csi-volume-scaleup/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: csi-replica-scaleup 6 | namespace: e2e 7 | data: 8 | parameters.yml: | 9 | 10 | --- 11 | apiVersion: batch/v1 12 | kind: Job 13 | metadata: 14 | generateName: cstor-csi-replica-scaleup- 15 | namespace: e2e 16 | spec: 17 | template: 18 | metadata: 19 | labels: 20 | name: cstor-csi-replica-scaleup 21 | spec: 22 | serviceAccountName: e2e 23 | restartPolicy: Never 24 | containers: 25 | - name: ansibletest 26 | image: openebs/cstor-csi-e2e:ci 27 | imagePullPolicy: IfNotPresent 28 | env: 29 | - name: ANSIBLE_STDOUT_CALLBACK 30 | #value: log_plays 31 | #value: actionable 32 | value: default 33 | 34 | - name: APP_NAMESPACE 35 | value: '' 36 | 37 | - name: APP_PVC 38 | value: '' 39 | 40 | - name: APP_LABEL 41 | value: '' 42 | 43 | - name: OPENEBS_NAMESPACE 44 | value: "openebs" 45 | 46 | - name: DATA_PERSISTENCE 47 | value: "" 48 | 49 | command: ["/bin/bash"] 50 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/functional/cstor-csi-volume-scaleup/test.yml -i /etc/ansible/hosts -vv; exit 0"] 51 | 52 | volumeMounts: 53 | - name: parameters 54 | mountPath: /mnt/ 55 | volumes: 56 | - name: parameters 57 | configMap: 58 | name: csi-replica-scaleup 59 | -------------------------------------------------------------------------------- /e2e-tests/experiments/functional/cstor-csi-volume-scaleup/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: cstor-csi-replica-scaleup 2 | 3 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 4 | 5 | pvc_name: "{{ lookup('env','APP_PVC') }}" 6 | 7 | label: "{{ lookup('env','APP_LABEL') }}" 8 | 9 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 10 | 11 | openebs_ns: "{{ lookup('env','OPENEBS_NAMESPACE') }}" 12 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/drain_node/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: node-failure-drain- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | labels: 11 | name: node-failure-drain 12 | spec: 13 | serviceAccountName: e2e 14 | restartPolicy: Never 15 | #nodeSelector: 16 | # kubernetes.io/hostname: 17 | 18 | tolerations: 19 | - key: "infra-aid" 20 | operator: "Equal" 21 | value: "observer" 22 | effect: "NoSchedule" 23 | 24 | containers: 25 | - name: ansibletest 26 | image: openebs/cstor-csi-e2e:ci 27 | imagePullPolicy: IfNotPresent 28 | env: 29 | - name: ANSIBLE_STDOUT_CALLBACK 30 | value: default 31 | 32 | - name: APP_NAMESPACE 33 | value: "" 34 | 35 | - name: APP_LABEL 36 | value: "" 37 | 38 | - name: LIVENESS_APP_LABEL 39 | value: "" 40 | 41 | - name: LIVENESS_APP_NAMESPACE 42 | value: "" 43 | 44 | - name: DATA_PERSISTENCY 45 | value: "" 46 | 47 | command: ["/bin/bash"] 48 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/infra-chaos/drain_node/test.yml -i /etc/ansible/hosts -vv; exit 0"] 49 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/drain_node/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: node-failure-drain 2 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 3 | label: "{{ lookup('env','APP_LABEL') }}" 4 | liveness_label: "{{ lookup('env','LIVENESS_APP_LABEL') }}" 5 | liveness_namespace: "{{ lookup('env','LIVENESS_APP_NAMESPACE') }}" 6 | data_persistance: "{{ lookup('env','DATA_PERSISTENCY') }}" 7 | 8 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/kubernetes/service_failure/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/kubernetes/service_failure/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: svc-failure-chaos 2 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 3 | label: "{{ lookup('env','APP_LABEL') }}" 4 | pvc: "{{ lookup('env','APP_PVC') }}" 5 | svc_type: "{{ lookup('env','SVC_TYPE') }}" 6 | operator_ns: "{{ lookup('env','OPERATOR_NAMESPACE') }}" 7 | liveness_label: "{{ lookup('env','LIVENESS_APP_LABEL') }}" 8 | liveness_namespace: "{{ lookup('env','LIVENESS_APP_NAMESPACE') }}" 9 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 10 | node_pwd: "{{ lookup('env','NODE_PASSWORD') }}" 11 | user: "{{ lookup('env','USERNAME') }}" 12 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/multiple_application_on_single_volume/chaosutil.j2: -------------------------------------------------------------------------------- 1 | {% if platform is defined and platform == 'vmware' %} 2 | chaosutil: e2e-tests/chaoslib/vmware_chaos/vm_power_operations.yml 3 | {% endif %} 4 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/multiple_application_on_single_volume/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/multiple_application_on_single_volume/test_vars.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Test specific parameters 3 | 4 | test_name: multiple-application-on-single-volume 5 | 6 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 7 | 8 | pvc: "{{ lookup('env','APP_PVC') }}" 9 | 10 | label: "{{ lookup('env','APP_LABEL') }}" 11 | 12 | platform: "{{ lookup('env','PLATFORM') }}" 13 | 14 | host_ip: "{{ lookup('env','ESX_HOST_IP') }}" 15 | 16 | esx_pwd: "{{ lookup('env','ESX_PASSWORD') }}" 17 | 18 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 19 | 20 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 21 | 22 | user: "{{ lookup('env','USERNAME') }}" 23 | 24 | node_pwd: "{{ lookup('env','NODE_PASSWORD') }}" 25 | 26 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/node_failure/chaosutil.j2: -------------------------------------------------------------------------------- 1 | {% if platform is defined and platform == 'vmware' %} 2 | chaosutil: e2e-tests/chaoslib/vmware_chaos/vm_power_operations.yml 3 | {% endif %} 4 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/node_failure/data_persistence.j2: -------------------------------------------------------------------------------- 1 | {% if data_persistence is defined and data_persistence == 'mysql' %} 2 | consistencyutil: /e2e-tests/utils/scm/applications/mysql/mysql_data_persistence.yml 3 | {% elif data_persistence is defined and data_persistence == 'busybox' %} 4 | consistencyutil: /e2e-tests/utils/scm/applications/busybox/busybox_data_persistence.yml 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/node_failure/test_vars.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Test specific parameters 3 | 4 | test_name: node-failure 5 | 6 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 7 | 8 | pvc: "{{ lookup('env','APP_PVC') }}" 9 | 10 | label: "{{ lookup('env','APP_LABEL') }}" 11 | 12 | platform: "{{ lookup('env','PLATFORM') }}" 13 | 14 | host_ip: "{{ lookup('env','ESX_HOST_IP') }}" 15 | 16 | esx_pwd: "{{ lookup('env','ESX_PASSWORD') }}" 17 | 18 | data_persistence: "{{ lookup('env','DATA_PERSISTENCE') }}" 19 | 20 | operator_ns: "{{ lookup('env','OPERATOR_NS') }}" 21 | 22 | user: "{{ lookup('env','USERNAME') }}" 23 | 24 | node_pwd: "{{ lookup('env','NODE_PASSWORD') }}" 25 | 26 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/taint_node/run_e2e_test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: batch/v1 3 | kind: Job 4 | metadata: 5 | generateName: node-failure-taint- 6 | namespace: e2e 7 | spec: 8 | template: 9 | metadata: 10 | labels: 11 | name: node-failure-taint 12 | spec: 13 | serviceAccountName: e2e 14 | restartPolicy: Never 15 | #nodeSelector: 16 | # kubernetes.io/hostname: 17 | 18 | tolerations: 19 | - key: "infra-aid" 20 | operator: "Equal" 21 | value: "observer" 22 | effect: "NoSchedule" 23 | 24 | containers: 25 | - name: ansibletest 26 | image: openebs/cstor-csi-e2e:ci 27 | imagePullPolicy: IfNotPresent 28 | env: 29 | - name: ANSIBLE_STDOUT_CALLBACK 30 | #value: log_plays 31 | #value: actionable 32 | value: default 33 | 34 | - name: APP_NAMESPACE 35 | value: "" 36 | 37 | - name: APP_LABEL 38 | value: "" 39 | 40 | - name: LIVENESS_APP_LABEL 41 | value: "" 42 | 43 | - name: LIVENESS_APP_NAMESPACE 44 | value: "" 45 | 46 | - name: TAINT_KEY 47 | value: 'node.kubernetes.io/out-of-disk' 48 | 49 | - name: DATA_PERSISTENCY 50 | value: "enable" 51 | command: ["/bin/bash"] 52 | args: ["-c", "ansible-playbook ./e2e-tests/experiments/infra-chaos/taint_node/test.yml -i /etc/ansible/hosts -vv; exit 0"] 53 | -------------------------------------------------------------------------------- /e2e-tests/experiments/infra-chaos/taint_node/test_vars.yml: -------------------------------------------------------------------------------- 1 | test_name: node-failure-taint 2 | namespace: "{{ lookup('env','APP_NAMESPACE') }}" 3 | label: "{{ lookup('env','APP_LABEL') }}" 4 | liveness_label: "{{ lookup('env','LIVENESS_APP_LABEL') }}" 5 | liveness_namespace: "{{ lookup('env','LIVENESS_APP_NAMESPACE') }}" 6 | taint: "{{ lookup('env','TAINT_KEY') }}" 7 | data_persistance: "{{ lookup('env','DATA_PERSISTENCY') }}" 8 | -------------------------------------------------------------------------------- /e2e-tests/hack/e2e-result.j2: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: e2e.io/v1alpha1 3 | kind: E2eResult 4 | metadata: 5 | 6 | # name of the e2e testcase 7 | name: {{ test }} 8 | spec: 9 | 10 | # holds information on the testcase 11 | testMetadata: 12 | app: {{ app }} 13 | chaostype: {{ chaostype }} 14 | 15 | # holds the state of testcase, manually updated by json merge patch 16 | # result is the useful value today, but anticipate phase use in future 17 | testStatus: 18 | phase: {{ phase }} 19 | result: {{ verdict }} 20 | 21 | -------------------------------------------------------------------------------- /e2e-tests/hack/push: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | if [ -z "${REPONAME}" ] 5 | then 6 | REPONAME="openebs" 7 | fi 8 | 9 | if [ -z "${IMGNAME}" ] || [ -z "${IMGTAG}" ]; 10 | then 11 | echo "Image details are missing. Nothing to push."; 12 | exit 1 13 | fi 14 | 15 | IMAGEID=$( sudo docker images -q ${REPONAME}/${IMGNAME}:${IMGTAG} ) 16 | 17 | if [ ! -z "${DNAME}" ] && [ ! -z "${DPASS}" ]; 18 | then 19 | sudo docker login -u "${DNAME}" -p "${DPASS}"; 20 | # Push image to docker hub 21 | echo "Pushing ${REPONAME}/${IMGNAME}:${IMGTAG} ..."; 22 | sudo docker push ${REPONAME}/${IMGNAME}:${IMGTAG} ; 23 | if [ ! -z "${TRAVIS_TAG}" ] ; 24 | then 25 | # Push with different tags if tagged as a release 26 | # When github is tagged with a release, then Travis will 27 | # set the release tag in env TRAVIS_TAG 28 | echo "Pushing ${REPONAME}/${IMGNAME}:${TRAVIS_TAG} ..."; 29 | sudo docker tag ${IMAGEID} ${REPONAME}/${IMGNAME}:${TRAVIS_TAG} 30 | sudo docker push ${REPONAME}/${IMGNAME}:${TRAVIS_TAG}; 31 | echo "Pushing ${REPONAME}/${IMGNAME}:latest ..."; 32 | sudo docker tag ${IMAGEID} ${REPONAME}/${IMGNAME}:latest 33 | sudo docker push ${REPONAME}/${IMGNAME}:latest; 34 | fi; 35 | else 36 | echo "No docker credentials provided. Skip uploading ${REPONAME}/${IMGNAME}:${IMGTAG} to docker hub"; 37 | fi; 38 | -------------------------------------------------------------------------------- /e2e-tests/hack/rbac.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: e2e 5 | --- 6 | apiVersion: v1 7 | kind: ServiceAccount 8 | metadata: 9 | name: e2e 10 | namespace: e2e 11 | labels: 12 | name: e2e 13 | --- 14 | # Source: openebs/templates/clusterrole.yaml 15 | apiVersion: rbac.authorization.k8s.io/v1 16 | kind: ClusterRole 17 | metadata: 18 | name: e2e 19 | labels: 20 | name: e2e 21 | rules: 22 | - apiGroups: ["*"] 23 | resources: ["*"] 24 | verbs: ["*"] 25 | --- 26 | apiVersion: rbac.authorization.k8s.io/v1 27 | kind: ClusterRoleBinding 28 | metadata: 29 | name: e2e 30 | labels: 31 | name: e2e 32 | roleRef: 33 | apiGroup: rbac.authorization.k8s.io 34 | kind: ClusterRole 35 | name: e2e 36 | subjects: 37 | - kind: ServiceAccount 38 | name: e2e 39 | namespace: e2e 40 | -------------------------------------------------------------------------------- /e2e-tests/utils/fcm/create_testname.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - block: 3 | - name: Record test instance/run ID 4 | set_fact: 5 | run_id: "{{ lookup('env','RUN_ID') }}" 6 | 7 | - name: Construct testname appended with runID 8 | set_fact: 9 | test_name: "{{ test_name }}-{{ run_id }}" 10 | 11 | when: lookup('env','RUN_ID') 12 | -------------------------------------------------------------------------------- /e2e-tests/utils/fcm/update_e2e_result_resource.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - block: 3 | - name: Generate the e2e result CR to reflect SOT (Start of Test) 4 | template: 5 | src: /e2e-tests/hack/e2e-result.j2 6 | dest: e2e-result.yaml 7 | vars: 8 | test: "{{ test_name }}" 9 | app: "" 10 | chaostype: "" 11 | phase: in-progress 12 | verdict: none 13 | 14 | - name: Analyze the cr yaml 15 | shell: cat e2e-result.yaml 16 | 17 | - name: Apply the e2e result CR 18 | shell: kubectl apply -f e2e-result.yaml 19 | args: 20 | executable: /bin/bash 21 | register: er_status 22 | failed_when: "er_status is failed" 23 | 24 | when: status == "SOT" 25 | 26 | - block: 27 | - name: Generate the e2e result CR to reflect EOT (End of Test) 28 | template: 29 | src: /e2e-tests/hack/e2e-result.j2 30 | dest: e2e-result.yaml 31 | vars: 32 | test: "{{ test_name }}" 33 | app: "" 34 | chaostype: "" 35 | phase: completed 36 | verdict: "{{ flag }}" 37 | 38 | - name: Analyze the cr yaml 39 | shell: cat e2e-result.yaml 40 | 41 | - name: Apply the e2e result CR 42 | shell: kubectl apply -f e2e-result.yaml 43 | args: 44 | executable: /bin/bash 45 | register: er_status 46 | failed_when: "er_status is failed" 47 | 48 | when: status == "EOT" 49 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/application_liveness_check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Get the liveness pods 3 | shell: kubectl get pod -n {{ liveness_namespace }} -l {{ liveness_label }} -o=custom-columns=NAME:".metadata.name" --no-headers 4 | register: liveness_pods 5 | 6 | - name: Checking status of liveness pods 7 | shell: kubectl get pods {{ item }} -n {{ liveness_namespace }} -o=custom-columns=NAME:".status.phase" --no-headers 8 | register: result 9 | with_items: "{{ liveness_pods.stdout_lines }}" 10 | until: "'Running' in result.stdout" 11 | delay: 10 12 | retries: 10 13 | 14 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/check_deployment_status.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This util checks the application status in k8s cluster 3 | # The parameters required are 4 | # - app_ns ( namespace where the application is deployed) 5 | # - app_label ( Label of application in the form 'key=value')) 6 | 7 | - block: 8 | - name: Check the pod status 9 | shell: > 10 | kubectl get pods -n {{ app_ns }} -l {{ app_label }} --no-headers 11 | -o custom-columns=:status.phase 12 | args: 13 | executable: /bin/bash 14 | register: result 15 | until: "'Running' in result.stdout" 16 | delay: 30 17 | retries: 15 18 | 19 | when: lookup('env','DEPLOY_TYPE') == 'deployment' 20 | 21 | - block: 22 | - name: obtain the number of replicas. 23 | shell: kubectl get statefulset -n {{ app_ns }} -l {{ app_label }} -o custom-columns=:spec.replicas 24 | register: rep_count 25 | until: "rep_count.rc ==0" 26 | delay: 60 27 | retries: 15 28 | 29 | - name: Obtain the ready replica count and compare with the replica count. 30 | shell: kubectl get statefulset -n {{ app_ns }} -l {{ app_label }} -o custom-columns=:..readyReplicas 31 | register: ready_rep 32 | until: "ready_rep.rc == 0 and ready_rep.stdout|int == rep_count.stdout|int" 33 | delay: 60 34 | retries: 30 35 | 36 | when: lookup('env','DEPLOY_TYPE') == 'statefulset' 37 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/check_no_of_nodes.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - block: 3 | 4 | - name: Waiting for application pod reschedule (evict) 5 | wait_for: 6 | timeout: "{{ post_chaos_soak_time }}" 7 | 8 | - name: Checking the status of chaos injected node 9 | shell: kubectl get nodes --no-headers | grep -vi 'master' 10 | args: 11 | executable: /bin/bash 12 | register: node_names 13 | until: "'{{ app_node.stdout }}' not in node_names.stdout" 14 | retries: "{{ retries }}" 15 | delay: "{{ delay }}" 16 | 17 | when: injected_node_chaos == "yes" 18 | 19 | 20 | - block: 21 | 22 | - name: Checking the no.of nodes 23 | shell: kubectl get nodes --no-headers | grep -vi 'master' | grep -i 'Ready' 24 | args: 25 | executable: /bin/bash 26 | register: node_count 27 | until: node_count.stdout_lines|length >= pre_chaos_node_count.stdout_lines|length 28 | retries: "{{ retries }}" 29 | delay: "{{ delay }}" 30 | 31 | when: injected_node_chaos == "no" 32 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/check_statefulset_status.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This utility checks if all the replicas in a statefulset are running. 3 | # The parameters required are 4 | # - app_ns (Namespace on which the application is deployed) 5 | # - app_label( Label of application in the form 'key=value')) 6 | # - 7 | - name: Obtain the number of replicas. 8 | shell: kubectl get statefulset -n {{ app_ns }} -l {{ app_label }} -o custom-columns=:spec.replicas 9 | args: 10 | executable: /bin/bash 11 | register: rep_count 12 | until: "rep_count.rc == 0" 13 | delay: 60 14 | retries: 15 15 | 16 | - name: Obtain the ready replica count and compare with the replica count. 17 | shell: kubectl get statefulset -n {{ app_ns }} -l {{ app_label }} -o custom-columns=:..readyReplicas 18 | args: 19 | executable: /bin/bash 20 | register: ready_rep 21 | until: "ready_rep.rc == 0 and ready_rep.stdout|int == rep_count.stdout|int" 22 | delay: 60 23 | retries: 15 24 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/create_ns.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Obtain list of existing namespaces 3 | shell: > 4 | kubectl get ns 5 | --no-headers 6 | -o custom-columns=:metadata.name 7 | args: 8 | executable: /bin/bash 9 | register: ns_list 10 | 11 | - name: Create test specific namespace. 12 | shell: kubectl create ns {{ app_ns }} 13 | args: 14 | executable: /bin/bash 15 | when: app_ns != 'e2e' and app_ns not in ns_list.stdout_lines 16 | 17 | - include_tasks: /e2e-tests/utils/k8s/status_testns.yml 18 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/deploy_app_svc.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Replace the application label placeholder in service spec 3 | replace: 4 | path: "{{ application_svc }}" 5 | regexp: "lkey: lvalue" 6 | replace: "{{ app_lkey }}: {{ app_lvalue }}" 7 | 8 | - name: Deploying {{ application_name }} service 9 | shell: kubectl apply -f {{ application_svc }} -n {{ app_ns }} 10 | args: 11 | executable: /bin/bash 12 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/deploy_application.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This util can deploy application in K8s cluster. 3 | # The parameters required are 4 | # - app_yml ( Application spec) 5 | # - app_ns ( namespace where application needs to be deployed) 6 | 7 | - name: Deploy Application 8 | shell: kubectl apply -f {{ item }} -n {{ app_ns }} 9 | args: 10 | executable: /bin/bash 11 | with_items: "{{ app_yml }}" 12 | 13 | 14 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/deploy_single_app.yml: -------------------------------------------------------------------------------- 1 | --- 2 | #Deploying application on k8's cluster and cross checking whether the 3 | #application is deployed successfully. 4 | - name: Deploying {{ application_name }} 5 | k8s: 6 | state: present 7 | src: "{{ application_deployment }}" 8 | namespace: "{{ app_ns }}" 9 | merge_type: merge 10 | register: result 11 | 12 | - include_tasks: /e2e-tests/utils/k8s/status_app_pod.yml 13 | when: check_app_pod == 'yes' 14 | 15 | - include_tasks: /e2e-tests/utils/scm/openebs/check_replica_count.yml 16 | when: lookup('env','DEPLOY_TYPE') == 'statefulset' 17 | 18 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/fetch_app_pod.yml: -------------------------------------------------------------------------------- 1 | --- 2 | #Fetching the details of the application pod 3 | - name: Getting the {{ application_name }} POD name 4 | k8s_facts: 5 | kind: Pod 6 | namespace: "{{ app_ns }}" 7 | label_selectors: 8 | - "{{ app_label }}" 9 | register: pod_name 10 | 11 | - debug: 12 | msg: "{{ pod_name | json_query('resources[*].metadata.name') }}" 13 | 14 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/scale_statefulset_replicas.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This utilty task file can scale up the statefulset application deployed in K8s cluster. 3 | # The parameters required are 4 | # - app_ns ( namespace in which application is deployed) 5 | # - app_label( Applicastions's label in the form key=value) 6 | # - app_replica_count( Required number of application replicas) 7 | 8 | - name: Identifying the statefulset deployed. 9 | shell: kubectl get statefulset -n {{ app_ns }} --no-headers -l {{ app_label }} -o custom-columns=:metadata.name 10 | args: 11 | executable: /bin/bash 12 | register: result 13 | 14 | - name: Recording the application pod name. 15 | set_fact: 16 | sts_name: "{{ result.stdout }}" 17 | 18 | - name: scaling up the statefulset application. 19 | shell: kubectl scale statefulsets {{ sts_name }} --replicas={{ app_replica_count }} -n {{ app_ns }} 20 | args: 21 | executable: /bin/bash 22 | register: result 23 | failed_when: "'scaled' not in result.stdout" 24 | 25 | - name: Check if all the application replicas are running. 26 | shell: kubectl get statefulsets -n {{ app_ns }} --no-headers -l {{ app_label }} -o custom-columns=:..readyReplicas 27 | args: 28 | executable: /bin/bash 29 | register: running_replicas 30 | until: "running_replicas.stdout|int == app_replica_count|int" 31 | delay: 60 32 | retries: 15 33 | 34 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/status_app_pod.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Get the container status of application. 3 | shell: > 4 | kubectl get pod -n {{ app_ns }} -l {{app_lkey}}="{{app_lvalue}}" 5 | -o custom-columns=:..containerStatuses[].state --no-headers | grep -w "running" 6 | args: 7 | executable: /bin/bash 8 | register: containerStatus 9 | until: "'running' in containerStatus.stdout" 10 | delay: 2 11 | retries: 150 12 | 13 | - name: Checking {{ application_name }} pod is in running state 14 | shell: kubectl get pods -n {{ app_ns }} -o jsonpath='{.items[?(@.metadata.labels.{{app_lkey}}=="{{app_lvalue}}")].status.phase}' 15 | register: result 16 | until: "((result.stdout.split()|unique)|length) == 1 and 'Running' in result.stdout" 17 | delay: '{{ delay }}' 18 | retries: '{{ retries }}' 19 | -------------------------------------------------------------------------------- /e2e-tests/utils/k8s/status_testns.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Checking the status of test specific namespace. 3 | k8s_facts: 4 | kind: Namespace 5 | name: "{{ app_ns }}" 6 | register: npstatus 7 | until: "'Active' in npstatus.resources.0.status.phase" 8 | delay: 30 9 | retries: 10 10 | 11 | -------------------------------------------------------------------------------- /e2e-tests/utils/scm/applications/mysql/check_db_connection.yml: -------------------------------------------------------------------------------- 1 | #Check if the database is ready for connection, upper bound wait time: 900s 2 | - name: Check if db is ready for connections 3 | shell: kubectl logs {{ pod_name.resources.0.metadata.name }} -n {{ app_ns }} | grep 'ready for connections' | wc -l 4 | register: initcheck 5 | until: initcheck.stdout == "2" 6 | delay: 5 7 | retries: 180 8 | 9 | -------------------------------------------------------------------------------- /e2e-tests/utils/scm/openebs/check_replica_count.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - block: 3 | - name: Obtain the number of replicas. 4 | shell: kubectl get statefulset -n {{ app_ns }} --no-headers -l "{{app_label}}" -o custom-columns=:spec.replicas 5 | args: 6 | executable: /bin/bash 7 | register: rep_count 8 | until: "rep_count.rc == 0" 9 | delay: 60 10 | retries: 15 11 | 12 | - name: Obtain the ready replica count and compare with the replica count. 13 | shell: kubectl get statefulset -n {{ app_ns }} -l "{{app_label}}" --no-headers -o custom-columns=:..readyReplicas 14 | args: 15 | executable: /bin/bash 16 | register: ready_rep 17 | until: "ready_rep.rc == 0 and ready_rep.stdout|int == rep_count.stdout|int" 18 | delay: 60 19 | retries: 30 -------------------------------------------------------------------------------- /e2e-tests/utils/scm/openebs/csi-app-target-affinity-policy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: cstor.openebs.io/v1 3 | kind: CStorVolumePolicy 4 | metadata: 5 | name: app-target-affinity-policy 6 | namespace: openebs 7 | spec: 8 | target: 9 | affinity: 10 | requiredDuringSchedulingIgnoredDuringExecution: 11 | - labelSelector: 12 | matchExpressions: 13 | - key: openebs.io/target-affinity 14 | operator: In 15 | values: 16 | - app-label 17 | topologyKey: kubernetes.io/hostname 18 | namespaces: ["app-namespace"] 19 | --- 20 | apiVersion: storage.k8s.io/v1 21 | kind: StorageClass 22 | metadata: 23 | name: testclass 24 | provisioner: cstor.csi.openebs.io 25 | allowVolumeExpansion: true 26 | volumeBindingMode: Immediate 27 | parameters: 28 | replicaCount: "3" 29 | cstorPoolCluster: "pool-name" 30 | cas-type: "cstor" 31 | cstorVolumePolicy: "app-target-affinity-policy" 32 | 33 | -------------------------------------------------------------------------------- /e2e-tests/utils/scm/openebs/cstor_pool_deploy_check.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This util checks if all the pool pods are running and are scheduled on different nodes. 3 | # This util takes namespace (ns) as var ('openebs') 4 | 5 | - name: Obtain the number of CSP. 6 | shell: kubectl get csp --no-headers | wc -l 7 | args: 8 | executable: /bin/bash 9 | register: csp_count 10 | 11 | - name: Checking all the pool pods are in running state 12 | shell: kubectl get po -l app=cstor-pool -n {{ ns }} -o jsonpath='{.items[?(@.status.phase=="Running")].metadata.name}' | wc -w 13 | register: pool_pods 14 | until: "pool_pods.stdout == csp_count.stdout" 15 | retries: 5 16 | delay: 10 17 | 18 | - name: Checking all the nodes are distinct 19 | shell: kubectl get csp -o jsonpath='{.items[*].metadata.labels.kubernetes\.io/hostname}' 20 | register: node_names 21 | failed_when: "{{ node_names.stdout.split(' ') | unique | count}} != csp_count.stdout|int" 22 | 23 | - debug: 24 | msg: " NODE NAMES {{ node_names.stdout.split(' ') | unique }}" -------------------------------------------------------------------------------- /e2e-tests/utils/scm/openebs/fetch_cstor_pool_pods.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This util derives the cstor pool pods corresponding to the PVC. The input parameters required are 3 | # 4 | # - {{ pvc }} - Name of PVC. 5 | # - {{ namespace }} - Namespaces where application is deployed. 6 | # - {{ operator_namespace }} - Namespace where openebs is deployed. 7 | # 8 | - name: Derive PV name from PVC. 9 | shell: > 10 | kubectl get pvc {{ pvc }} -n {{ namespace }} 11 | --no-headers -o custom-columns=:spec.volumeName 12 | args: 13 | executable: /bin/bash 14 | register: pv 15 | 16 | - name: Obtaining the pool deployments from cvr. 17 | shell: > 18 | kubectl get cvr -n {{ operator_namespace }} 19 | -l openebs.io/persistent-volume={{ pv.stdout }} --no-headers 20 | -o=jsonpath='{range .items[*]}{.metadata.labels.cstorpool\.openebs\.io\/name}{"\n"}{end}' 21 | args: 22 | executable: /bin/bash 23 | register: pool_deployment 24 | 25 | - name: Obtaining the replicasets corresponding to pool deployements. 26 | shell: > 27 | kubectl get rs --selector=app=cstor-pool -n {{ operator_namespace }} --no-headers 28 | -o=jsonpath='{.items[?(@.metadata.ownerReferences[0].name=="{{item}}")].metadata.name}' 29 | register: rs_list 30 | with_items: 31 | - "{{ pool_deployment.stdout_lines }}" 32 | 33 | - name: Obtaining the pool pods. 34 | shell: > 35 | kubectl get pod --selector=app=cstor-pool -n {{ operator_namespace }} --no-headers 36 | -o=jsonpath='{.items[?(@.metadata.ownerReferences[0].name=="{{item.stdout}}")].metadata.name}' 37 | register: pool_pods 38 | with_items: 39 | - "{{ rs_list.results }}" 40 | 41 | 42 | -------------------------------------------------------------------------------- /e2e-tests/utils/scm/openebs/fetch_replica_values.yml: -------------------------------------------------------------------------------- 1 | --- 2 | #Reading the replica values from env and replace them in application lable 3 | #placholder 4 | - name: Get the application replica values from env 5 | set_fact: 6 | app_rkey: "{{ app_replica.split('=')[0] }}" 7 | app_rvalue: "{{ app_replica.split('=')[1] }}" 8 | 9 | - name: Replace the application replica placeholder in statefulset spec. 10 | replace: 11 | path: "{{ application_deployment }}" 12 | regexp: "rkey: rvalue" 13 | replace: "{{ app_rkey }}: {{ app_rvalue }}" 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/cspc/cspc-single.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cstor.openebs.io/v1 2 | kind: CStorPoolCluster 3 | metadata: 4 | name: cstor-storage 5 | namespace: openebs 6 | spec: 7 | pools: 8 | - nodeSelector: 9 | kubernetes.io/hostname: "gke-cstor-demo-default-pool-3385ab41-2hkc" 10 | dataRaidGroups: 11 | - blockDevices: 12 | - blockDeviceName: "sparse-176cda34921fdae209bdd489fe72475d" 13 | poolConfig: 14 | dataRaidGroupType: "stripe" 15 | -------------------------------------------------------------------------------- /examples/cspc/cspc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cstor.openebs.io/v1 2 | kind: CStorPoolCluster 3 | metadata: 4 | name: cstor-storage 5 | namespace: openebs 6 | spec: 7 | pools: 8 | - nodeSelector: 9 | kubernetes.io/hostname: "gke-cstor-demo-default-pool-3385ab41-2hkc" 10 | dataRaidGroups: 11 | - blockDevices: 12 | - blockDeviceName: "sparse-d1cd029f5ba4ada0db75adc8f6c88653" 13 | poolConfig: 14 | dataRaidGroupType: "stripe" 15 | 16 | - nodeSelector: 17 | kubernetes.io/hostname: "gke-cstor-demo-default-pool-3385ab41-v2x2" 18 | dataRaidGroups: 19 | - blockDevices: 20 | - blockDeviceName: "sparse-79fe8245efd25bd7e7aabdf29eae4d71" 21 | poolConfig: 22 | dataRaidGroupType: "stripe" 23 | 24 | - nodeSelector: 25 | kubernetes.io/hostname: "gke-cstor-demo-default-pool-3385ab41-zntw" 26 | dataRaidGroups: 27 | - blockDevices: 28 | - blockDeviceName: "sparse-50761ff2c406004e68ac2920e7215679" 29 | poolConfig: 30 | dataRaidGroupType: "stripe" 31 | -------------------------------------------------------------------------------- /examples/cspc/cspi.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cstor.openebs.io/v1 2 | kind: CStorPoolInstance 3 | metadata: 4 | labels: 5 | kubernetes.io/hostname: 127.0.0.1 6 | openebs.io/cas-type: cstor 7 | openebs.io/cstor-pool-cluster: cstor-sparse-pool 8 | openebs.io/version: 1.9.0 9 | name: cstor-mirror-pool 10 | namespace: openebs 11 | spec: 12 | dataRaidGroups: 13 | - blockDevices: 14 | - blockDeviceName: sparse-5a92ced3e2ee21eac7b930f670b5eab5 15 | - blockDeviceName: sparse-37a7de580322f43a13338bf2467343f5 16 | - blockDevices: 17 | - blockDeviceName: sparse-72971f3b2e173c1b79db9a43e4cb841f 18 | - blockDeviceName: sparse-a205e38ff5ec89c223654fdf1361f182 19 | hostName: 127.0.0.1 20 | nodeSelector: 21 | kubernetes.io/hostname: 127.0.0.1 22 | poolConfig: 23 | auxResources: null 24 | compression: "" 25 | dataRaidGroupType: mirror 26 | priorityClassName: "" 27 | resources: null 28 | roThresholdLimit: null 29 | thickProvision: false 30 | tolerations: null 31 | writeCacheGroupType: "" 32 | writeCacheRaidGroups: null 33 | -------------------------------------------------------------------------------- /examples/doc.md: -------------------------------------------------------------------------------- 1 | // ToDo : Docs -------------------------------------------------------------------------------- /hack/api-docs/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "hideMemberFields": [ 3 | "TypeMeta" 4 | ], 5 | "hideTypePatterns": [ 6 | "ParseError$", 7 | "List$" 8 | ], 9 | "externalPackages": [ 10 | { 11 | "typeMatchPrefix": "^k8s\\.io/apimachinery/pkg/apis/meta/v1\\.Duration$", 12 | "docsURLTemplate": "https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#Duration" 13 | }, 14 | { 15 | "typeMatchPrefix": "^k8s\\.io/(api|apimachinery/pkg/apis)/", 16 | "docsURLTemplate": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#{{lower .TypeIdentifier}}-{{arrIndex .PackageSegments -1}}-{{arrIndex .PackageSegments -2}}" 17 | }, 18 | { 19 | "typeMatchPrefix": "^github\\.com/knative/pkg/apis/duck/", 20 | "docsURLTemplate": "https://godoc.org/github.com/knative/pkg/apis/duck/{{arrIndex .PackageSegments -1}}#{{.TypeIdentifier}}" 21 | } 22 | ], 23 | "typeDisplayNamePrefixOverrides": { 24 | "k8s.io/api/": "Kubernetes ", 25 | "k8s.io/apimachinery/pkg/apis/": "Kubernetes " 26 | }, 27 | "markdownDisabled": false 28 | } 29 | -------------------------------------------------------------------------------- /hack/api-docs/template/members.tpl: -------------------------------------------------------------------------------- 1 | {{ define "members" }} 2 | 3 | {{ range .Members }} 4 | {{ if not (hiddenMember .)}} 5 | 6 | 7 | {{ fieldName . }}
8 | 9 | {{ if linkForType .Type }} 10 | 11 | {{ typeDisplayName .Type }} 12 | 13 | {{ else }} 14 | {{ typeDisplayName .Type }} 15 | {{ end }} 16 | 17 | 18 | 19 | {{ if fieldEmbedded . }} 20 |

21 | (Members of {{ fieldName . }} are embedded into this type.) 22 |

23 | {{ end}} 24 | 25 | {{ if isOptionalMember .}} 26 | (Optional) 27 | {{ end }} 28 | 29 | {{ safe (renderComments .CommentLines) }} 30 | 31 | {{ if and (eq (.Type.Name.Name) "ObjectMeta") }} 32 | Refer to the Kubernetes API documentation for the fields of the 33 | metadata field. 34 | {{ end }} 35 | 36 | {{ if or (eq (fieldName .) "spec") }} 37 |
38 |
39 | 40 | {{ template "members" .Type }} 41 |
42 | {{ end }} 43 | 44 | 45 | {{ end }} 46 | {{ end }} 47 | 48 | {{ end }} 49 | -------------------------------------------------------------------------------- /hack/api-docs/template/pkg.tpl: -------------------------------------------------------------------------------- 1 | {{ define "packages" }} 2 | 3 | {{ with .packages}} 4 |

Packages:

5 | 12 | {{ end}} 13 | 14 | {{ range .packages }} 15 |

16 | {{- packageDisplayName . -}} 17 |

18 | 19 | {{ with (index .GoPackages 0 )}} 20 | {{ with .DocComments }} 21 |

22 | {{ safe (renderComments .) }} 23 |

24 | {{ end }} 25 | {{ end }} 26 | 27 | Resource Types: 28 | 37 | 38 | {{ range (visibleTypes (sortedTypes .Types))}} 39 | {{ template "type" . }} 40 | {{ end }} 41 |
42 | {{ end }} 43 | 44 |

45 | Generated with gen-crd-api-reference-docs 46 | {{ with .gitCommit }} on git commit {{ . }}{{end}}. 47 |

48 | 49 | {{ end }} 50 | -------------------------------------------------------------------------------- /hack/api-docs/template/type.tpl: -------------------------------------------------------------------------------- 1 | {{ define "type" }} 2 | 3 |

4 | {{- .Name.Name }} 5 | {{ if eq .Kind "Alias" }}({{.Underlying}} alias)

{{ end -}} 6 |

7 | {{ with (typeReferences .) }} 8 |

9 | (Appears on: 10 | {{- $prev := "" -}} 11 | {{- range . -}} 12 | {{- if $prev -}}, {{ end -}} 13 | {{ $prev = . }} 14 | {{ typeDisplayName . }} 15 | {{- end -}} 16 | ) 17 |

18 | {{ end }} 19 | 20 | 21 |

22 | {{ safe (renderComments .CommentLines) }} 23 |

24 | 25 | {{ if .Members }} 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | {{ if isExportedType . }} 35 | 36 | 39 | 44 | 45 | 46 | 50 | 51 | 52 | {{ end }} 53 | {{ template "members" .}} 54 | 55 |
FieldDescription
37 | apiVersion
38 | string
40 | 41 | {{apiGroup .}} 42 | 43 |
47 | kind
48 | string 49 |
{{.Name.Name}}
56 | {{ end }} 57 | 58 | {{ end }} 59 | -------------------------------------------------------------------------------- /pkg/controllers/cstorvolumeconfig/volume_operations_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | package cstorvolumeconfig 16 | -------------------------------------------------------------------------------- /pkg/controllers/restore-controller/handler_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package restorecontroller 17 | 18 | import ( 19 | "testing" 20 | ) 21 | 22 | // TestGetPoolResource checks if volume replica resource created 23 | // is successfully got. 24 | // TODO: Add test case 25 | func TestGetVolumeReplicaResource(t *testing.T) { 26 | } 27 | -------------------------------------------------------------------------------- /pkg/controllers/restore-controller/run_restore_controller_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package restorecontroller 17 | 18 | // ToDO: Add unit test 19 | -------------------------------------------------------------------------------- /pkg/controllers/testutil/zcmd/zfs/fake.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package zfs 18 | 19 | // VolumeMocker contains the volume information which 20 | // will helpful to execute zfs command 21 | type VolumeMocker struct { 22 | PoolName string 23 | Compression string 24 | // TestConfig holds the Volume test related information 25 | TestConfig TestConfig 26 | } 27 | 28 | // TestConfig holds the the test configuration based on this 29 | // configuration zfs utility commands will return error 30 | type TestConfig struct { 31 | ZFSCommand ZFSCommandError 32 | HealthyReplicas int 33 | ProvisionedReplicas int 34 | } 35 | 36 | // ZfsCommandError used to inject the errors in various ZFS commands 37 | // It will help to mock the zfs command behaviour 38 | type ZFSCommandError struct { 39 | ZFSStatsError bool 40 | ZFSGetError bool 41 | ZFSListError bool 42 | } 43 | -------------------------------------------------------------------------------- /pkg/controllers/testutil/zcmd/zfs/list.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package zfs 17 | 18 | import ( 19 | "fmt" 20 | 21 | "github.com/pkg/errors" 22 | ) 23 | 24 | // ListProperty mocks the zfs list command 25 | func (volumeMocker *VolumeMocker) ListProperty(cmd string) ([]byte, error) { 26 | if volumeMocker.TestConfig.ZFSCommand.ZFSListError { 27 | return []byte("fake zfs error"), errors.New("exit statu 1") 28 | } 29 | var output []string 30 | for i := 0; i < volumeMocker.TestConfig.ProvisionedReplicas; i++ { 31 | output = append(output, fmt.Sprintf("%s/ProvisionedVolume-%d\n", volumeMocker.PoolName, i)) 32 | } 33 | for i := 0; i < volumeMocker.TestConfig.HealthyReplicas; i++ { 34 | output = append(output, fmt.Sprintf("%s/HealthyVolume-%d\n", volumeMocker.PoolName, i)) 35 | } 36 | return []byte(fmt.Sprintf("%s", output)), nil 37 | } 38 | -------------------------------------------------------------------------------- /pkg/controllers/testutil/zcmd/zpool/delete.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package zpool 17 | 18 | import "github.com/pkg/errors" 19 | 20 | // Delete is mock zpool destroy command 21 | func (poolMocker *PoolMocker) Delete(cmd string) ([]byte, error) { 22 | // If configuration expects error then return error 23 | if poolMocker.TestConfig.ZpoolCommand.ZpoolDestroyError { 24 | return deleteError(cmd) 25 | } 26 | return []byte{}, nil 27 | } 28 | 29 | func deleteError(cmd string) ([]byte, error) { 30 | return []byte("fake delete error"), errors.Errorf("exist status 1") 31 | } 32 | -------------------------------------------------------------------------------- /pkg/controllers/testutil/zcmd/zpool/import.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package zpool 17 | 18 | import ( 19 | "strings" 20 | 21 | "github.com/pkg/errors" 22 | ) 23 | 24 | // Import mocks zpool import command 25 | func (poolMocker *PoolMocker) Import(cmd string) ([]byte, error) { 26 | // If configuration expects error then return error 27 | if poolMocker.TestConfig.ZpoolCommand.ZpoolImportError { 28 | return importError(cmd) 29 | } 30 | 31 | if len(strings.Split(cmd, " ")) == 2 { 32 | return []byte{}, nil 33 | } 34 | if poolMocker.PoolName == "" { 35 | return []byte("no pools available to import"), errors.Errorf("exit status 1") 36 | } 37 | poolMocker.IsPoolImported = true 38 | return []byte{}, nil 39 | } 40 | 41 | func importError(cmd string) ([]byte, error) { 42 | return []byte("Fake No Pool Exist to import"), nil 43 | } 44 | -------------------------------------------------------------------------------- /pkg/controllers/testutil/zcmd/zpool/labelclear.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package zpool 17 | 18 | // LabelClear mocks the zpool labelclear command 19 | func (poolMocker *PoolMocker) LabelClear(cmd string) ([]byte, error) { 20 | return []byte{}, nil 21 | } 22 | -------------------------------------------------------------------------------- /pkg/controllers/testutil/zcmd/zpool/set.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package zpool 17 | 18 | import ( 19 | "fmt" 20 | "strings" 21 | 22 | "github.com/pkg/errors" 23 | ) 24 | 25 | // SetProperty mocks the zpool get command and returns the error based on the output 26 | func (poolMocker *PoolMocker) SetProperty(cmd string) ([]byte, error) { 27 | 28 | // If configuration expects error then return error 29 | if poolMocker.TestConfig.ZpoolCommand.ZpoolGetError { 30 | return getPropertyError(cmd) 31 | } 32 | 33 | values := strings.Split(cmd, " ") 34 | if poolMocker.PoolName == "" { 35 | return []byte(fmt.Sprintf("cannot open '%s': no such pool", values[len(values)-1])), errors.Errorf("exit statu 1") 36 | } 37 | if !strings.Contains(cmd, poolMocker.PoolName) { 38 | return []byte(fmt.Sprintf("cannot open '%s': no such pool", values[len(values)-1])), errors.Errorf("exit statu 1") 39 | } 40 | // Add fields in PoolMocker for setting the property 41 | return []byte{}, nil 42 | } 43 | -------------------------------------------------------------------------------- /pkg/cspc/algorithm/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package algorithm 18 | -------------------------------------------------------------------------------- /pkg/log/alertlog/log.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package alertlog 18 | 19 | import ( 20 | "log" 21 | 22 | "go.uber.org/zap" 23 | ) 24 | 25 | var ( 26 | // Logger facilitates logging with alert format 27 | Logger = initLogger() 28 | ) 29 | 30 | func initLogger() *zap.SugaredLogger { 31 | logger, err := zap.NewDevelopment() 32 | if err != nil { 33 | log.Fatalf("can't initialize zap logger: %v", err) 34 | } 35 | //logger, err := zap.NewProduction() 36 | defer logger.Sync() // flushes buffer, if any 37 | return logger.Sugar() 38 | } 39 | 40 | //sugar.Infow("failed to fetch URL", 41 | //// Structured context as loosely typed key-value pairs. 42 | //"url", url, 43 | //"attempt", 3, 44 | //"backoff", time.Second, 45 | //) 46 | //sugar.Infof("Failed to fetch URL: %s", url) 47 | -------------------------------------------------------------------------------- /pkg/pool/operations/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1alpha2 18 | 19 | import ( 20 | "os" 21 | 22 | "github.com/openebs/cstor-operators/pkg/controllers/common" 23 | "github.com/pkg/errors" 24 | ) 25 | 26 | const ( 27 | // PoolPrefix is prefix for pool name 28 | PoolPrefix string = "cstor-" 29 | ) 30 | 31 | var poolName string 32 | 33 | // ErrorWrapf wrap error 34 | // If given err is nil then it will return new error 35 | func ErrorWrapf(err error, format string, args ...interface{}) error { 36 | if err == nil { 37 | return errors.Errorf(format, args...) 38 | } 39 | 40 | return errors.Wrapf(err, format, args...) 41 | } 42 | 43 | // PoolName return pool name for given CSPI object 44 | func PoolName() string { 45 | if poolName == "" { 46 | poolName = PoolPrefix + os.Getenv(string(common.OpenEBSIOPoolName)) 47 | } 48 | return poolName 49 | } 50 | 51 | // IsEmpty check if string is empty or not 52 | func IsEmpty(s string) bool { 53 | return len(s) == 0 54 | } 55 | -------------------------------------------------------------------------------- /pkg/server/cstorvolumeconfig/interface.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package cstorvolumeconfig 18 | 19 | // backupHelper is an interface which will serve 20 | // the request of different versions of backup resources 21 | type backupHelper interface { 22 | isBackupCompleted() bool 23 | getCSPIName() string 24 | findLastBackupStat() string 25 | updateBackupStatus(string) backupHelper 26 | getBackupObject() interface{} 27 | //TODO: Rename the function 28 | deleteCompletedBackup(name, namespace, snapName string) error 29 | deleteBackup(name, namespace string) error 30 | getOrCreateLastBackupSnap() (string, error) 31 | setBackupStatus(string) backupHelper 32 | setLastSnapshotName(string) backupHelper 33 | createBackupResource() (backupHelper, error) 34 | } 35 | -------------------------------------------------------------------------------- /pkg/signals/signal.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package signals 18 | 19 | import ( 20 | "os" 21 | "os/signal" 22 | ) 23 | 24 | // SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned 25 | // which is closed on one of these signals. If a second signal is caught, the program 26 | // is terminated with exit code 1. 27 | func SetupSignalHandler() (stopCh <-chan struct{}) { 28 | stop := make(chan struct{}) 29 | c := make(chan os.Signal, 2) 30 | signal.Notify(c, shutdownSignals...) 31 | go func() { 32 | <-c 33 | close(stop) 34 | <-c 35 | os.Exit(1) // second signal. Exit directly. 36 | }() 37 | 38 | return stop 39 | } 40 | -------------------------------------------------------------------------------- /pkg/signals/signal_posix.go: -------------------------------------------------------------------------------- 1 | //go:build !windows 2 | // +build !windows 3 | 4 | /* 5 | Copyright 2020 The OpenEBS Authors. 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | 20 | package signals 21 | 22 | import ( 23 | "os" 24 | "syscall" 25 | ) 26 | 27 | var shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM} 28 | -------------------------------------------------------------------------------- /pkg/signals/signal_windows.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package signals 18 | 19 | import ( 20 | "os" 21 | ) 22 | 23 | var shutdownSignals = []os.Signal{os.Interrupt} 24 | -------------------------------------------------------------------------------- /pkg/snapshot/snapshottest/snapshot.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | package snapshottest 16 | 17 | import ( 18 | v1proto "github.com/openebs/api/v3/pkg/proto" 19 | "github.com/pkg/errors" 20 | ) 21 | 22 | // FakeSnapshotter is used to mock the snapshot operations 23 | type FakeSnapshotter struct { 24 | ShouldReturnFakeError bool 25 | } 26 | 27 | // CreateSnapshot mocks snapshot create operation 28 | func (fs *FakeSnapshotter) CreateSnapshot(ip, volName, snapName string) (*v1proto.VolumeSnapCreateResponse, error) { 29 | if fs.ShouldReturnFakeError { 30 | return nil, errors.Errorf("injected fake errors during snapshot create operation") 31 | } 32 | return &v1proto.VolumeSnapCreateResponse{}, nil 33 | } 34 | 35 | // DestroySnapshot mocks snapshot delete operation 36 | func (fs *FakeSnapshotter) DestroySnapshot(ip, volName, snapName string) (*v1proto.VolumeSnapDeleteResponse, error) { 37 | if fs.ShouldReturnFakeError { 38 | return nil, errors.Errorf("injected fake errors during snapshot delete operation") 39 | } 40 | return &v1proto.VolumeSnapDeleteResponse{}, nil 41 | } 42 | -------------------------------------------------------------------------------- /pkg/version/util_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The OpenEBS Authors 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | package version 16 | 17 | import "testing" 18 | 19 | func TestIsCurrentVersionValid(t *testing.T) { 20 | // setting the variable for test 21 | validDesiredVersion = "2.9.0" 22 | type args struct { 23 | v string 24 | } 25 | tests := []struct { 26 | name string 27 | args args 28 | want bool 29 | }{ 30 | { 31 | name: "Valid Current Version", 32 | args: args{ 33 | v: "1.12.0", 34 | }, 35 | want: true, 36 | }, 37 | { 38 | name: "Less than Min Current Version", 39 | args: args{ 40 | v: "1.9.0", 41 | }, 42 | want: false, 43 | }, 44 | { 45 | name: "More than Valid Desired Version", 46 | args: args{ 47 | v: "2.13.0", 48 | }, 49 | want: false, 50 | }, 51 | } 52 | for _, tt := range tests { 53 | t.Run(tt.name, func(t *testing.T) { 54 | if got := IsCurrentVersionValid(tt.args.v); got != tt.want { 55 | t.Errorf("IsCurrentVersionValid() = %v, want %v", got, tt.want) 56 | } 57 | }) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /pkg/webhook/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The OpenEBS Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package webhook 16 | -------------------------------------------------------------------------------- /pkg/zcmd/bin/cmd.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package bin 18 | 19 | import ( 20 | "os/exec" 21 | ) 22 | 23 | const ( 24 | // ZPOOL is zpool command name 25 | ZPOOL = "zpool" 26 | 27 | // BASH is bash command name 28 | BASH = "bash" 29 | 30 | // ZFS is zfs command name 31 | ZFS = "zfs" 32 | ) 33 | 34 | // Executor is an interface for executing ZPOOL/ZFS operations 35 | type Executor interface { 36 | Execute(command string) ([]byte, error) 37 | } 38 | 39 | // Zcmd is structure which is responsible for executing ZPOOl/ZFS 40 | // commands 41 | type Zcmd struct{} 42 | 43 | // NewZcmd is new instance of Zcmd 44 | func NewZcmd() *Zcmd { 45 | return &Zcmd{} 46 | } 47 | 48 | // Execute is to execute zpool/zfs commands in bash 49 | func (z *Zcmd) Execute(command string) ([]byte, error) { 50 | // execute command here 51 | // #nosec 52 | return exec.Command(BASH, "-c", command).CombinedOutput() 53 | } 54 | -------------------------------------------------------------------------------- /pkg/zcmd/zfs/destroy/predicate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package vdestroy 18 | 19 | // PredicateFunc defines data-type for validation function 20 | type PredicateFunc func(*VolumeDestroy) bool 21 | 22 | // IsDryRunSet method check if the DryRun field of VolumeDestroy object is set. 23 | func IsDryRunSet() PredicateFunc { 24 | return func(v *VolumeDestroy) bool { 25 | return v.DryRun 26 | } 27 | } 28 | 29 | // IsRecursiveSet method check if the Recursive field of VolumeDestroy object is set. 30 | func IsRecursiveSet() PredicateFunc { 31 | return func(v *VolumeDestroy) bool { 32 | return v.Recursive 33 | } 34 | } 35 | 36 | // IsNameSet method check if the Name field of VolumeDestroy object is set. 37 | func IsNameSet() PredicateFunc { 38 | return func(v *VolumeDestroy) bool { 39 | return len(v.Name) != 0 40 | } 41 | } 42 | 43 | // IsCommandSet method check if the Command field of VolumeDestroy object is set. 44 | func IsCommandSet() PredicateFunc { 45 | return func(v *VolumeDestroy) bool { 46 | return len(v.Command) != 0 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/zcmd/zfs/listsnap/predicate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package vlistsnap 18 | 19 | // PredicateFunc defines data-type for validation function 20 | type PredicateFunc func(*VolumeListSnapshot) bool 21 | 22 | // IsDatasetSet method check if the Dataset field of VolumeListSnapshot object is set. 23 | func IsDatasetSet() PredicateFunc { 24 | return func(v *VolumeListSnapshot) bool { 25 | return len(v.Dataset) != 0 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /pkg/zcmd/zfs/stats/predicate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package vstats 18 | 19 | // PredicateFunc defines data-type for validation function 20 | type PredicateFunc func(*VolumeStats) bool 21 | 22 | // IsProplistSet method check if the Property field of VolumeStats object is set. 23 | func IsProplistSet() PredicateFunc { 24 | return func(v *VolumeStats) bool { 25 | return len(v.Proplist) != 0 26 | } 27 | } 28 | 29 | // IsDatasetSet method check if the Dataset field of VolumeStats object is set. 30 | func IsDatasetSet() PredicateFunc { 31 | return func(v *VolumeStats) bool { 32 | return len(v.Dataset) != 0 33 | } 34 | } 35 | 36 | // IsCommandSet method check if the Command field of VolumeStats object is set. 37 | func IsCommandSet() PredicateFunc { 38 | return func(v *VolumeStats) bool { 39 | return len(v.Command) != 0 40 | } 41 | } 42 | 43 | // IsExecutorSet method check if the Executor field of VolumeStats object is set. 44 | func IsExecutorSet() PredicateFunc { 45 | return func(v *VolumeStats) bool { 46 | return v.Executor != nil 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/clear/predicate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pclear 18 | 19 | // PredicateFunc defines data-type for validation function 20 | type PredicateFunc func(*PoolClear) bool 21 | 22 | // IsPoolSet method check if the Pool field of PoolClear object is set. 23 | func IsPoolSet() PredicateFunc { 24 | return func(p *PoolClear) bool { 25 | return len(p.Pool) != 0 26 | } 27 | } 28 | 29 | // IsVdevSet method check if the Vdev field of PoolClear object is set. 30 | func IsVdevSet() PredicateFunc { 31 | return func(p *PoolClear) bool { 32 | return len(p.Vdev) != 0 33 | } 34 | } 35 | 36 | // IsCommandSet method check if the Command field of PoolClear object is set. 37 | func IsCommandSet() PredicateFunc { 38 | return func(p *PoolClear) bool { 39 | return len(p.Command) != 0 40 | } 41 | } 42 | 43 | // IsExecutorSet method check if the Executor field of 44 | // PoolClear object is set. 45 | func IsExecutorSet() PredicateFunc { 46 | return func(p *PoolClear) bool { 47 | return p.Executor != nil 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/clear/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pclear 18 | 19 | // SetPool method set the Pool field of PoolClear object. 20 | func (p *PoolClear) SetPool(Pool string) { 21 | p.Pool = Pool 22 | } 23 | 24 | // SetVdev method set the Vdev field of PoolClear object. 25 | func (p *PoolClear) SetVdev(Vdev string) { 26 | p.Vdev = append(p.Vdev, Vdev) 27 | } 28 | 29 | // SetCommand method set the Command field of PoolClear object. 30 | func (p *PoolClear) SetCommand(Command string) { 31 | p.Command = Command 32 | } 33 | 34 | // GetPool method get the Pool field of PoolClear object. 35 | func (p *PoolClear) GetPool() string { 36 | return p.Pool 37 | } 38 | 39 | // GetVdev method get the Vdev field of PoolClear object. 40 | func (p *PoolClear) GetVdev() []string { 41 | return p.Vdev 42 | } 43 | 44 | // GetCommand method get the Command field of PoolClear object. 45 | func (p *PoolClear) GetCommand() string { 46 | return p.Command 47 | } 48 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/destroy/predicate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pdestroy 18 | 19 | // PredicateFunc defines data-type for validation function 20 | type PredicateFunc func(*PoolDestroy) bool 21 | 22 | // IsPoolSet method check if the Pool field of PoolDestroy object is set. 23 | func IsPoolSet() PredicateFunc { 24 | return func(p *PoolDestroy) bool { 25 | return len(p.Pool) != 0 26 | } 27 | } 28 | 29 | // IsForcefullySet method check if the Forcefully field of PoolDestroy object is set. 30 | func IsForcefullySet() PredicateFunc { 31 | return func(p *PoolDestroy) bool { 32 | return p.Forcefully 33 | } 34 | } 35 | 36 | // IsCommandSet method check if the Command field of PoolDestroy object is set. 37 | func IsCommandSet() PredicateFunc { 38 | return func(p *PoolDestroy) bool { 39 | return len(p.Command) != 0 40 | } 41 | } 42 | 43 | // IsExecutorSet method check if the Executor field of PoolDestroy object is set. 44 | func IsExecutorSet() PredicateFunc { 45 | return func(p *PoolDestroy) bool { 46 | return p.Executor != nil 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/destroy/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pdestroy 18 | 19 | // SetPool method set the Pool field of PoolDestroy object. 20 | func (p *PoolDestroy) SetPool(Pool string) { 21 | p.Pool = Pool 22 | } 23 | 24 | // SetForcefully method set the Forcefully field of PoolDestroy object. 25 | func (p *PoolDestroy) SetForcefully(Forcefully bool) { 26 | p.Forcefully = Forcefully 27 | } 28 | 29 | // SetCommand method set the Command field of PoolDestroy object. 30 | func (p *PoolDestroy) SetCommand(Command string) { 31 | p.Command = Command 32 | } 33 | 34 | // GetPool method get the Pool field of PoolDestroy object. 35 | func (p *PoolDestroy) GetPool() string { 36 | return p.Pool 37 | } 38 | 39 | // GetForcefully method get the Forcefully field of PoolDestroy object. 40 | func (p *PoolDestroy) GetForcefully() bool { 41 | return p.Forcefully 42 | } 43 | 44 | // GetCommand method get the Command field of PoolDestroy object. 45 | func (p *PoolDestroy) GetCommand() string { 46 | return p.Command 47 | } 48 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/detach/predicate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pdetach 18 | 19 | // PredicateFunc defines data-type for validation function 20 | type PredicateFunc func(*PoolDetach) bool 21 | 22 | // IsPoolSet method check if the Pool field of PoolDetach object is set. 23 | func IsPoolSet() PredicateFunc { 24 | return func(p *PoolDetach) bool { 25 | return len(p.Pool) != 0 26 | } 27 | } 28 | 29 | // IsVdevSet method check if the Vdev field of PoolDetach object is set. 30 | func IsVdevSet() PredicateFunc { 31 | return func(p *PoolDetach) bool { 32 | return len(p.Vdev) != 0 33 | } 34 | } 35 | 36 | // IsCommandSet method check if the Command field of PoolDetach object is set. 37 | func IsCommandSet() PredicateFunc { 38 | return func(p *PoolDetach) bool { 39 | return len(p.Command) != 0 40 | } 41 | } 42 | 43 | // IsExecutorSet method check if the Executor field of PoolDetach object is set. 44 | func IsExecutorSet() PredicateFunc { 45 | return func(p *PoolDetach) bool { 46 | return p.Executor != nil 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/detach/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pdetach 18 | 19 | // SetPool method set the Pool field of PoolDetach object. 20 | func (p *PoolDetach) SetPool(Pool string) { 21 | p.Pool = Pool 22 | } 23 | 24 | // SetVdev method set the Vdev field of PoolDetach object. 25 | func (p *PoolDetach) SetVdev(Vdev string) { 26 | p.Vdev = Vdev 27 | } 28 | 29 | // SetCommand method set the Command field of PoolDetach object. 30 | func (p *PoolDetach) SetCommand(Command string) { 31 | p.Command = Command 32 | } 33 | 34 | // GetPool method get the Pool field of PoolDetach object. 35 | func (p *PoolDetach) GetPool() string { 36 | return p.Pool 37 | } 38 | 39 | // GetVdev method get the Vdev field of PoolDetach object. 40 | func (p *PoolDetach) GetVdev() string { 41 | return p.Vdev 42 | } 43 | 44 | // GetCommand method get the Command field of PoolDetach object. 45 | func (p *PoolDetach) GetCommand() string { 46 | return p.Command 47 | } 48 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/dump/predicate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pstatus 18 | 19 | // PredicateFunc defines data-type for validation function 20 | type PredicateFunc func(*PoolDump) bool 21 | 22 | // IsPoolSet method check if the Pool field of PoolDump object is set. 23 | func IsPoolSet() PredicateFunc { 24 | return func(p *PoolDump) bool { 25 | return len(p.Pool) != 0 26 | } 27 | } 28 | 29 | // IsCommandSet method check if the Command field of PoolDump object is set. 30 | func IsCommandSet() PredicateFunc { 31 | return func(p *PoolDump) bool { 32 | return len(p.Command) != 0 33 | } 34 | } 35 | 36 | // IsExecutorSet method check if the Executor field of PoolDump object is set. 37 | func IsExecutorSet() PredicateFunc { 38 | return func(p *PoolDump) bool { 39 | return p.Executor != nil 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/get/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pget 18 | 19 | // SetPropList method set the PropList field of PoolGProperty object. 20 | func (p *PoolGProperty) SetPropList(key string) { 21 | p.PropList = append(p.PropList, key) 22 | } 23 | 24 | // SetPool method set the Pool field of PoolGProperty object. 25 | func (p *PoolGProperty) SetPool(Pool string) { 26 | p.Pool = Pool 27 | } 28 | 29 | // SetCommand method set the Command field of PoolGProperty object. 30 | func (p *PoolGProperty) SetCommand(Command string) { 31 | p.Command = Command 32 | } 33 | 34 | // GetPropList method get the PropList field of PoolGProperty object. 35 | func (p *PoolGProperty) GetPropList() []string { 36 | return p.PropList 37 | } 38 | 39 | // GetPool method get the Pool field of PoolGProperty object. 40 | func (p *PoolGProperty) GetPool() string { 41 | return p.Pool 42 | } 43 | 44 | // GetCommand method get the Command field of PoolGProperty object. 45 | func (p *PoolGProperty) GetCommand() string { 46 | return p.Command 47 | } 48 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/labelclear/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package plabelclear 18 | 19 | // SetVdev method set the Vdev field of PoolLabelClear object. 20 | func (p *PoolLabelClear) SetVdev(Vdev string) { 21 | p.Vdev = Vdev 22 | } 23 | 24 | // SetForcefully method set the Forcefully field of PoolLabelClear object. 25 | func (p *PoolLabelClear) SetForcefully(Forcefully bool) { 26 | p.Forcefully = Forcefully 27 | } 28 | 29 | // SetCommand method set the Command field of PoolLabelClear object. 30 | func (p *PoolLabelClear) SetCommand(Command string) { 31 | p.Command = Command 32 | } 33 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/remove/predicate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package premove 18 | 19 | // PredicateFunc defines data-type for validation function 20 | type PredicateFunc func(*PoolRemove) bool 21 | 22 | // IsPoolSet method check if the Pool field of PoolRemove object is set. 23 | func IsPoolSet() PredicateFunc { 24 | return func(p *PoolRemove) bool { 25 | return len(p.Pool) != 0 26 | } 27 | } 28 | 29 | // IsDeviceSet method check if the Device field of PoolRemove object is set. 30 | func IsDeviceSet() PredicateFunc { 31 | return func(p *PoolRemove) bool { 32 | return len(p.Device) != 0 33 | } 34 | } 35 | 36 | // IsCommandSet method check if the Command field of PoolRemove object is set. 37 | func IsCommandSet() PredicateFunc { 38 | return func(p *PoolRemove) bool { 39 | return len(p.Command) != 0 40 | } 41 | } 42 | 43 | // IsExecutorSet method check if the Executor field of PoolRemove object is set. 44 | func IsExecutorSet() PredicateFunc { 45 | return func(p *PoolRemove) bool { 46 | return p.Executor != nil 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/remove/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package premove 18 | 19 | // SetPool method set the Pool field of PoolRemove object. 20 | func (p *PoolRemove) SetPool(Pool string) { 21 | p.Pool = Pool 22 | } 23 | 24 | // SetDevice method set the Device field of PoolRemove object. 25 | func (p *PoolRemove) SetDevice(Device string) { 26 | p.Device = append(p.Device, Device) 27 | } 28 | 29 | // SetCommand method set the Command field of PoolRemove object. 30 | func (p *PoolRemove) SetCommand(Command string) { 31 | p.Command = Command 32 | } 33 | 34 | // GetPool method get the Pool field of PoolRemove object. 35 | func (p *PoolRemove) GetPool() string { 36 | return p.Pool 37 | } 38 | 39 | // GetDevice method get the Device field of PoolRemove object. 40 | func (p *PoolRemove) GetDevice() []string { 41 | return p.Device 42 | } 43 | 44 | // GetCommand method get the Command field of PoolRemove object. 45 | func (p *PoolRemove) GetCommand() string { 46 | return p.Command 47 | } 48 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/set/predicate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pset 18 | 19 | // PredicateFunc defines data-type for validation function 20 | type PredicateFunc func(*PoolSProperty) bool 21 | 22 | // IsPropListSet method check if the PropList field of PoolSProperty object is set. 23 | func IsPropListSet() PredicateFunc { 24 | return func(p *PoolSProperty) bool { 25 | return len(p.PropList) != 0 26 | } 27 | } 28 | 29 | // IsPoolSet method check if the Pool field of PoolSProperty object is set. 30 | func IsPoolSet() PredicateFunc { 31 | return func(p *PoolSProperty) bool { 32 | return len(p.Pool) != 0 33 | } 34 | } 35 | 36 | // IsCommandSet method check if the Command field of PoolSProperty object is set. 37 | func IsCommandSet() PredicateFunc { 38 | return func(p *PoolSProperty) bool { 39 | return len(p.Command) != 0 40 | } 41 | } 42 | 43 | // IsExecutorSet method check if the Executor field of PoolSproperty object is set. 44 | func IsExecutorSet() PredicateFunc { 45 | return func(p *PoolSProperty) bool { 46 | return p.Executor != nil 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/status/predicate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pstatus 18 | 19 | // PredicateFunc defines data-type for validation function 20 | type PredicateFunc func(*PoolStatus) bool 21 | 22 | // IsPoolSet method check if the Pool field of PoolStatus object is set. 23 | func IsPoolSet() PredicateFunc { 24 | return func(p *PoolStatus) bool { 25 | return len(p.Pool) != 0 26 | } 27 | } 28 | 29 | // IsCommandSet method check if the Command field of PoolStatus object is set. 30 | func IsCommandSet() PredicateFunc { 31 | return func(p *PoolStatus) bool { 32 | return len(p.Command) != 0 33 | } 34 | } 35 | 36 | // IsExecutorSet method check if the Executor field of PoolStatus object is set. 37 | func IsExecutorSet() PredicateFunc { 38 | return func(p *PoolStatus) bool { 39 | return p.Executor != nil 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /pkg/zcmd/zpool/status/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The OpenEBS Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package pstatus 18 | 19 | // SetPool method set the Pool field of PoolStatus object. 20 | func (p *PoolStatus) SetPool(Pool string) { 21 | p.Pool = Pool 22 | } 23 | 24 | // SetCommand method set the Command field of PoolStatus object. 25 | func (p *PoolStatus) SetCommand(Command string) { 26 | p.Command = Command 27 | } 28 | 29 | // GetPool method get the Pool field of PoolStatus object. 30 | func (p *PoolStatus) GetPool() string { 31 | return p.Pool 32 | } 33 | 34 | // GetCommand method get the Command field of PoolStatus object. 35 | func (p *PoolStatus) GetCommand() string { 36 | return p.Command 37 | } 38 | -------------------------------------------------------------------------------- /tests/pkg/infra/infra.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The OpenEBS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package infra 18 | 19 | import "flag" 20 | 21 | var ( 22 | // NodeCount is number of storage nodes in a k8s cluster 23 | NodeCount int 24 | ) 25 | 26 | // ParseFlags gets the flag values at run time 27 | func ParseFlags() { 28 | flag.IntVar(&NodeCount, "nodecount", 1, "number of storage nodes to perform testing on") 29 | } 30 | 31 | // Infrastructure holds the details about the k8s 32 | // infra where OpenEBS can be tested. 33 | type Infrastructure struct { 34 | // NodeCount is the number of nodes 35 | // in the k8s infra that is capable of provisioning 36 | // cStor pools. 37 | NodeCount int 38 | } 39 | 40 | // NewInfrastructure return a new infrastructure instance 41 | // by setting NodeCount. 42 | func NewInfrastructure() *Infrastructure { 43 | i := &Infrastructure{} 44 | i.WithNodeCount(NodeCount) 45 | return i 46 | } 47 | 48 | // WithNodeCount sets the NodeCount. 49 | func (i *Infrastructure) WithNodeCount(nodeCount int) *Infrastructure { 50 | i.NodeCount = nodeCount 51 | return i 52 | } 53 | --------------------------------------------------------------------------------