Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,59 @@ Template folder for creating new E2E tests. Contains a complete framework with:

Use `./tests/create-test.sh <your-test-name>` to create a new test from this template.

### csi-ceph

Reference testkit that provisions a full Rook-managed Ceph cluster and a
csi-ceph-backed `StorageClass` end-to-end, then verifies a plain `PVC`
bound against that class.

Built around `testkit.EnsureCephStorageClass` (see
[pkg/FUNCTIONS_GLOSSARY.md](pkg/FUNCTIONS_GLOSSARY.md#ceph-storageclass-testkit)),
which handles: enabling `sds-node-configurator` + `sds-elastic` + `csi-ceph`
modules, optionally provisioning a `sds-local-volume` Thick `StorageClass`
for OSD backing, seeding `rook-config-override` (for things like
`ms_crc_data=false`), creating Rook `CephCluster` + `CephBlockPool`, and
wiring `CephClusterConnection` / `CephClusterAuthentication` /
`CephStorageClass` csi-ceph CRs.

The testkit itself only runs a smoke check; downstream repos (e.g.
`csi-ceph`) can import `github.com/deckhouse/storage-e2e/pkg/testkit` and
reuse `EnsureCephStorageClass` inside their own Ginkgo specs.

Testkit-specific env variables:

- `CSI_CEPH_OSD_STORAGE_CLASS` — pre-existing block-mode StorageClass used to
back Rook OSD PVCs. When empty, a `sds-local-volume` Thick SC is
auto-provisioned via `EnsureDefaultStorageClass`.
- `CSI_CEPH_MODULE_PULL_OVERRIDE` — image tag for `csi-ceph`'s
ModulePullOverride (dev registries only, e.g. when testing a PR build).

#### `modulePullOverride` env templating

Any module entry in `cluster_config.yml` may reference an env var with the
`${VAR}` form in `modulePullOverride`. `storage-e2e` resolves those at config
load time, so CI can point a module at a per-PR/MR image without editing the
YAML between runs:

```yaml
dkpParameters:
modules:
- name: csi-ceph
modulePullOverride: "${MODULE_IMAGE_TAG}" # CI must set MODULE_IMAGE_TAG, e.g. "pr131" on GitHub or "mr131" on GitLab
```

If a referenced env var is unset, `LoadClusterConfig` fails fast with
`module "<name>" references env var ${VAR} in modulePullOverride but it is not set`
instead of silently falling back to `main` — so a missing variable in CI is
caught before bootstrap, not after a 30-minute wrong-image install.

Run:

```bash
source tests/csi-ceph/test_exports
go test -timeout=240m -v ./tests/csi-ceph -count=1
```

### csi-all-stress-tests

Stress tests for all CSI storage drivers. This test suite:
Expand Down
41 changes: 36 additions & 5 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ storage-e2e/
│ ├── config/ # Configuration management
│ │ ├── config.go # Main configuration struct
│ │ ├── env.go # Environment variable parsing
│ │ ├── overrides.go # ${VAR} expansion in modulePullOverride at config load time
│ │ ├── types.go # Configuration type definitions
│ │ └── images.go # OS image definitions
│ │
Expand Down Expand Up @@ -75,6 +76,12 @@ storage-e2e/
│ ├── kubernetes/ # Public Kubernetes utilities
│ │ ├── apply.go # YAML manifest application
│ │ ├── blockdevice.go # BlockDevice operations
│ │ ├── cephblockpool.go # Rook CephBlockPool operations
│ │ ├── cephcluster.go # Rook CephCluster operations
│ │ ├── cephfilesystem.go # Rook CephFilesystem operations
│ │ ├── cephclusterconnection.go # csi-ceph connection/auth CRs
│ │ ├── cephcredentials.go # Rook Ceph credential discovery
│ │ ├── cephstorageclass.go # csi-ceph CephStorageClass CR
│ │ ├── client.go # Clientset/dynamic client with retry
│ │ ├── localstorageclass.go # LocalStorageClass CR operations
│ │ ├── lvmvolumegroup.go # LVMVolumeGroup operations
Expand All @@ -83,17 +90,25 @@ storage-e2e/
│ │ ├── nodegroup.go # NodeGroup operations
│ │ ├── nodes.go # Node listing, taints, labels
│ │ ├── pod.go # Pod operations
│ │ ├── pod_exec.go # Pods/exec helpers + DistrolessReader for distroless containers
│ │ ├── poll.go # Generic readiness poller (per-call timeout, WARN on net errors)
│ │ ├── pvc.go # PVC operations
│ │ ├── rookconfigoverride.go # Rook ceph.conf override ConfigMap
│ │ ├── secrets.go # Secret operations
│ │ ├── storageclass.go # StorageClass get/wait/default
│ │ ├── storageclass_manage.go # Global default StorageClass management
│ │ ├── virtualdisk.go # VirtualDisk attach/detach
│ │ └── vmpod.go # VM pod lookup
│ │ ├── vmpod.go # VM pod lookup
│ │ └── volumesnapshotclass.go # VolumeSnapshotClass helpers
│ │
│ ├── retry/ # Generic retry with exponential backoff
│ │ └── retry.go
│ │
│ └── testkit/ # Test framework utilities
│ ├── storageclass.go # Default StorageClass provisioning
│ ├── ceph.go # EnsureCephStorageClass (Rook + csi-ceph)
│ ├── ceph_cluster.go # EnsureCephCluster (Rook only, no csi-ceph)
│ ├── ceph_crc.go # Ceph CRC tuning helpers
│ ├── storageclass.go # EnsureDefaultStorageClass (sds-local-volume)
│ └── stress-tests.go # Stress test runner
├── tests/ # Test suites
Expand Down Expand Up @@ -326,6 +341,7 @@ Tests use Ginkgo's lifecycle hooks:
config/
├── config.go # Main configuration operations
├── env.go # Environment variable definitions and validation
├── overrides.go # ${VAR} expansion in modulePullOverride at config load time
├── types.go # Configuration type definitions
└── images.go # OS image URL definitions
```
Expand Down Expand Up @@ -486,6 +502,12 @@ pkg/
├── kubernetes/
│ ├── apply.go # YAML manifest application
│ ├── blockdevice.go # BlockDevice operations
│ ├── cephblockpool.go # Rook CephBlockPool CRUD + wait
│ ├── cephcluster.go # Rook CephCluster CRUD + wait
│ ├── cephfilesystem.go # Rook CephFilesystem CRUD + wait
│ ├── cephclusterconnection.go # csi-ceph CephClusterConnection/Auth CRs
│ ├── cephcredentials.go # Read fsid/mons/admin-key from Rook secrets
│ ├── cephstorageclass.go # csi-ceph CephStorageClass CR
│ ├── client.go # Clientset/dynamic client with retry
│ ├── localstorageclass.go # LocalStorageClass CR operations
│ ├── lvmvolumegroup.go # LVMVolumeGroup operations
Expand All @@ -494,15 +516,23 @@ pkg/
│ ├── nodegroup.go # NodeGroup operations
│ ├── nodes.go # Node listing, taints, labels
│ ├── pod.go # Pod operations
│ ├── pod_exec.go # Exec helpers + DistrolessReader (ephemeral-container session)
│ ├── poll.go # pollResourceUntilReady helper for Wait*Ready callers
│ ├── pvc.go # PVC operations
│ ├── rookconfigoverride.go # Rook global ceph.conf override
│ ├── secrets.go # Secret operations
│ ├── storageclass.go # StorageClass get/wait/default
│ ├── storageclass_manage.go # Global default-SC management
│ ├── virtualdisk.go # VirtualDisk attach/detach
│ └── vmpod.go # VM pod lookup
│ ├── vmpod.go # VM pod lookup
│ └── volumesnapshotclass.go # VolumeSnapshotClass helpers
├── retry/
│ └── retry.go # Generic retry with exponential backoff
└── testkit/
├── storageclass.go # Default StorageClass provisioning
├── ceph.go # EnsureCephStorageClass / EnsureDefaultCephStorageClass
├── ceph_cluster.go # EnsureCephCluster (Rook-only, no csi-ceph)
├── ceph_crc.go # Ceph CRC tuning helpers
├── storageclass.go # EnsureDefaultStorageClass (sds-local-volume)
└── stress-tests.go # Stress test runner
```

Expand Down Expand Up @@ -730,7 +760,8 @@ logger.Error("Failed to create resource: %v", err)
| `TEST_CLUSTER_VIRTUAL_MACHINE_CLASS_NAME` | `generic` | VM class for VMs on the base cluster in `alwaysCreateNew`. If set to another name (DNS-1123 subdomain) and the class does not exist, it is created from `generic` with `spec.cpu.type: Host`, **`spec.nodeSelector` / `spec.tolerations` cleared**, sizing policies retained from template, labeled `storage-e2e.deckhouse.io/auto-created=true`, and left after cleanup |
| `TEST_CLUSTER_CLEANUP` | `false` | Cleanup cluster after tests |
| `LOG_LEVEL` | `debug` | Log level (debug/info/warn/error) |
| `KUBE_CONFIG_PATH` | - | Fallback kubeconfig path |
| `KUBE_CONFIG_PATH` | - | Explicit kubeconfig path. Used when SSH retrieval of `/etc/kubernetes/{super-admin,admin}.conf` from the master fails. If unset and SSH also fails, `GetKubeconfig` returns an error (no silent fallback to `~/.kube/config`). |
| `MODULE_IMAGE_TAG` (and any other custom name) | - | Any `${VAR}` placeholder used inside `modulePullOverride:` in `cluster_config.yml` is expanded at config load time by `internal/config/overrides.ExpandEnvInModulePullOverride`. Missing/empty placeholders fail fast with an explicit error so CI can point modules at `pr<N>` / `mr<N>` images via a single env var without editing the YAML between runs. |

### Commander Variables (only when `TEST_CLUSTER_CREATE_MODE=commander`)

Expand Down
Loading
Loading