e2e: add snapshot metadata e2e tests for RBD - #6459
Conversation
Add github.com/kubernetes-csi/external-snapshot-metadata v1.1.0 to e2e/go.mod for the sidecar gRPC API used by snapshot metadata e2e tests. Assisted-by: Claude <noreply@anthropic.com> Signed-off-by: Rakshith R <rar@redhat.com>
|
/test ci/centos/mini-e2e/k8s-1.36/rbd |
|
/test ci/centos/mini-e2e-operator/k8s-1.36/rbd |
1 similar comment
|
/test ci/centos/mini-e2e-operator/k8s-1.36/rbd |
Add 8 end-to-end test cases for CSI snapshot metadata (CBT) covering the sidecar gRPC API for GetMetadataAllocated and GetMetadataDelta. Tests require --operator-deployment and exercise: - Allocated block retrieval with exact offset verification - Delta block detection between two snapshots - Starting offset filtering - Empty volume and no-change delta edge cases - Max-results batching across streaming responses - Authentication rejection with invalid audience - Authorization rejection without RBAC Assisted-by: Claude <noreply@anthropic.com> Signed-off-by: Rakshith R <rar@redhat.com>
486cc9f to
06cf113
Compare
|
/test ci/centos/mini-e2e-operator/k8s-1.36/rbd |
There was a problem hiding this comment.
Pull request overview
Adds an RBD-focused E2E test suite that validates the Kubernetes SnapshotMetadata (CBT) sidecar gRPC API (GetMetadataAllocated, GetMetadataDelta) when running Ceph-CSI via the operator, and vendors the required external SnapshotMetadata API dependency into the e2e/ module.
Changes:
- Add SnapshotMetadata E2E coverage for RBD (8 test cases) plus supporting infra/helper code (TLS, CRD/CR, RBAC, port-forward, gRPC client).
- Vendor
github.com/kubernetes-csi/external-snapshot-metadataand updatee2e/module dependencies (OpenTelemetry, go-openapi, fsnotify, genproto, etc.). - Update
e2e/module metadata (go.mod,go.sum, vendored module manifests/files) to reflect the new dependency set.
Reviewed changes
Copilot reviewed 3 out of 93 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| e2e/snapshot_metadata.go | Adds 8 SnapshotMetadata E2E test cases for RBD in operator mode. |
| e2e/snapshot_metadata_helper.go | Adds infra helpers (TLS, OperatorConfig patching, CRD/CR, RBAC, port-forward, gRPC client). |
| e2e/go.mod | Adds external-snapshot-metadata + grpc dependency; bumps/adjusts indirect deps. |
| e2e/go.sum | Updates checksums for new/updated dependencies. |
| e2e/vendor/modules.txt | Records newly vendored module set (incl. external-snapshot-metadata) and version bumps. |
| e2e/vendor/github.com/kubernetes-csi/external-snapshot-metadata/pkg/api/schema_grpc.pb.go | Vendored SnapshotMetadata gRPC API client/server stubs used by E2E. |
| e2e/vendor/github.com/kubernetes-csi/external-snapshot-metadata/LICENSE | Vendored license file for external-snapshot-metadata. |
| e2e/vendor/go.opentelemetry.io/otel/versions.yaml | Vendored OTel module-set version bumps. |
| e2e/vendor/go.opentelemetry.io/otel/version.go | Updates OTel version constant. |
| e2e/vendor/go.opentelemetry.io/otel/trace/internal/telemetry/span.go | OTel trace JSON marshal refactor (vendor update). |
| e2e/vendor/go.opentelemetry.io/otel/trace/config.go | Skips experimental options in stable config constructors (vendor update). |
| e2e/vendor/go.opentelemetry.io/otel/trace/auto.go | Updates semconv import + adds BYTESLICE/SLICE handling (vendor update). |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/schema.go | Adds vendored semconv v1.41.0 package. |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/README.md | Adds semconv v1.41.0 README (vendor). |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/MIGRATION.md | Adds semconv v1.41.0 migration doc (vendor). |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/exception.go | Adds semconv v1.41.0 exception constants (vendor). |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/error_type.go | Adds semconv v1.41.0 ErrorType helpers (vendor). |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.41.0/doc.go | Adds semconv v1.41.0 package docs (vendor). |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/otelconv/metric.go | Vendor update: metric helpers + Enabled short-circuits. |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/error_type.go | Vendor update: fmt-wrapped error unwrapping for ErrorType. |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.40.0/attribute_group.go | Vendor update: comment formatting + whitespace fixes. |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/otelconv/metric.go | Vendor update: metric helpers formatting. |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/httpconv/metric.go | Vendor update: doc layout tweaks. |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/attribute_group.go | Vendor update: comment formatting + whitespace fixes. |
| e2e/vendor/go.opentelemetry.io/otel/semconv/v1.37.0/attribute_group.go | Vendor update: comment formatting + whitespace fixes. |
| e2e/vendor/go.opentelemetry.io/otel/propagation/baggage.go | Vendor update: enforce baggage limits + limit error reporting. |
| e2e/vendor/go.opentelemetry.io/otel/metric/syncint64.go | Vendor update: skip experimental options in config constructors. |
| e2e/vendor/go.opentelemetry.io/otel/metric/syncfloat64.go | Vendor update: skip experimental options in config constructors. |
| e2e/vendor/go.opentelemetry.io/otel/metric/instrument.go | Vendor update: settable attr options + skip experimental options. |
| e2e/vendor/go.opentelemetry.io/otel/metric/doc.go | Vendor update: docs for gauges + Enabled optimization guidance. |
| e2e/vendor/go.opentelemetry.io/otel/metric/config.go | Vendor update: skip experimental options in Meter config. |
| e2e/vendor/go.opentelemetry.io/otel/metric/asyncint64.go | Vendor update: skip experimental options in async config constructors. |
| e2e/vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go | Vendor update: skip experimental options in async config constructors. |
| e2e/vendor/go.opentelemetry.io/otel/baggage/baggage.go | Vendor update: enforce 8192-byte parsing limit + error truncation. |
| e2e/vendor/go.opentelemetry.io/otel/attribute/type_string.go | Vendor update: add BYTESLICE and SLICE types. |
| e2e/vendor/go.opentelemetry.io/otel/attribute/set.go | Vendor update: Value.String in MarshalLog + minor reflection assignment. |
| e2e/vendor/go.opentelemetry.io/otel/attribute/kv.go | Vendor update: add ByteSlice/Slice KeyValue helpers. |
| e2e/vendor/go.opentelemetry.io/otel/attribute/key.go | Vendor update: add ByteSlice/Slice Key helpers. |
| e2e/vendor/go.opentelemetry.io/otel/attribute/hash.go | Vendor update: hash BYTESLICE/SLICE values + refactor hashing. |
| e2e/vendor/go.opentelemetry.io/otel/attribute/encoder.go | Vendor update: keep Emit output w/ lint suppression. |
| e2e/vendor/go.opentelemetry.io/otel/Makefile | Vendor update: benchmark sharding variables. |
| e2e/vendor/go.opentelemetry.io/otel/dependencies.Dockerfile | Vendor update: bump weaver image. |
| e2e/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md | Vendor update: semconv version references + guidance edits. |
| e2e/vendor/go.opentelemetry.io/otel/CHANGELOG.md | Vendor update: add 1.44.0 release notes/links. |
| e2e/vendor/go.opentelemetry.io/otel/AGENTS.md | Vendor adds upstream agent guide doc. |
| e2e/vendor/go.opentelemetry.io/otel/.golangci.yml | Vendor update: semconv depguard + revive arg key renames. |
| e2e/vendor/github.com/go-openapi/swag/README.md | Vendor update: docs/links and module list changes. |
| e2e/vendor/github.com/go-openapi/swag/loading/options.go | Vendor update: add WithRoot confinement + security notes. |
| e2e/vendor/github.com/go-openapi/swag/loading/loading.go | Vendor update: safer http(s) scheme detection + FS-backed path handling. |
| e2e/vendor/github.com/go-openapi/swag/loading/doc.go | Vendor update: expanded security documentation. |
| e2e/vendor/github.com/go-openapi/swag/loading_iface.go | Vendor update: avoid extra allocations in default options assembly. |
| e2e/vendor/github.com/go-openapi/swag/jsonname_iface.go | Vendor update: jsonname import relocation/deprecation plumbing. |
| e2e/vendor/github.com/go-openapi/swag/go.work | Vendor update: includes new pools module. |
| e2e/vendor/github.com/go-openapi/swag/CONTRIBUTORS.md | Vendor update: contributor counts/links. |
| e2e/vendor/github.com/go-openapi/swag/.golangci.yml | Vendor update: enable additional linters. |
| e2e/vendor/github.com/go-openapi/swag/.gitignore | Vendor update: ignores worktree artifacts. |
| e2e/vendor/github.com/go-openapi/jsonreference/README.md | Vendor update: docs links + announcement block comment. |
| e2e/vendor/github.com/go-openapi/jsonreference/CONTRIBUTORS.md | Vendor update: contributor counts/formatting. |
| e2e/vendor/github.com/go-openapi/jsonreference/.gitignore | Vendor update: ignore list adjustments. |
| e2e/vendor/github.com/go-openapi/jsonpointer/README.md | Vendor update: announcements and project status text. |
| e2e/vendor/github.com/go-openapi/jsonpointer/pointer.go | Vendor update: doc/comment restructuring and behavior clarifications. |
| e2e/vendor/github.com/go-openapi/jsonpointer/options.go | Vendor update: jsonname import relocation + doc tweaks. |
| e2e/vendor/github.com/go-openapi/jsonpointer/jsonname/name_provider.go | Vendor update: globals lint suppression + minor refactors. |
| e2e/vendor/github.com/go-openapi/jsonpointer/jsonname/ifaces.go | Vendor update: doc formatting. |
| e2e/vendor/github.com/go-openapi/jsonpointer/jsonname/go_name_provider.go | Vendor update: reflect.Pointer usage + minor refactors. |
| e2e/vendor/github.com/go-openapi/jsonpointer/jsonname/doc.go | Vendor adds SPDX + package doc. |
| e2e/vendor/github.com/go-openapi/jsonpointer/ifaces.go | Vendor update: docs + jsonname import relocation. |
| e2e/vendor/github.com/go-openapi/jsonpointer/errors.go | Vendor update: doc formatting. |
| e2e/vendor/github.com/go-openapi/jsonpointer/CONTRIBUTORS.md | Vendor update: contributor counts/links. |
| e2e/vendor/github.com/go-openapi/jsonpointer/.golangci.yml | Vendor update: linter configuration. |
| e2e/vendor/github.com/fsnotify/fsnotify/README.md | Vendor update: Go version requirement + expanded platform notes. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/windows.go | Vendor update: remove SetRlimit stub. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/unix2.go | Vendor adds IgnoringEINTR helper. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/unix.go | Vendor update: removes SetRlimit implementation. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/freebsd.go | Vendor update: removes SetRlimit implementation. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/darwin.go | Vendor update: removes SetRlimit implementation. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/debug_openbsd.go | Vendor update: debug mask list trimming. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/debug_netbsd.go | Vendor update: debug mask list trimming. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/debug_kqueue.go | Vendor update: debug output formatting tweak. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/debug_freebsd.go | Vendor update: debug mask list reorder/trim. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/debug_dragonfly.go | Vendor update: debug mask list trimming. |
| e2e/vendor/github.com/fsnotify/fsnotify/internal/debug_darwin.go | Vendor update: debug mask list trimming. |
| e2e/vendor/github.com/fsnotify/fsnotify/fsnotify.go | Vendor update: docs + internal flags for recursion. |
| e2e/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md | Vendor update: adds internal debug command notes. |
| e2e/vendor/github.com/fsnotify/fsnotify/CHANGELOG.md | Vendor update: adds 1.10.x entries. |
| e2e/vendor/github.com/fsnotify/fsnotify/backend_windows.go | Vendor update: concurrency fixes + unsafe.Slice usage. |
| e2e/vendor/github.com/fsnotify/fsnotify/backend_kqueue.go | Vendor update: fd leak fix + IgnoringEINTR usage + state dump. |
| e2e/vendor/github.com/fsnotify/fsnotify/backend_inotify.go | Vendor update: improved errors + recursion/watch flag semantics. |
| e2e/vendor/github.com/fsnotify/fsnotify/backend_fen.go | Vendor update: IgnoringEINTR usage. |
| e2e/vendor/github.com/fsnotify/fsnotify/.cirrus.yml | Vendor removes Cirrus CI config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| dynClient, err = dynamic.NewForConfig(f.ClientConfig()) | ||
| Expect(err).ShouldNot(HaveOccurred()) | ||
|
|
||
| testNamespace = "sms-e2e-test" |
| // patchOperatorConfigWithTLS patches the OperatorConfig CR to add a | ||
| // tls-key volume, triggering operator sidecar injection. | ||
| func patchOperatorConfigWithTLS(namespace, tlsSecretName string) error { | ||
| patch := fmt.Sprintf(`{"spec":{"driverSpecDefaults":{"controllerPlugin":{"volumes":[{"volume":{"name":"tls-key","secret":{"secretName":%q}},"mount":{"name":"tls-key","mountPath":"/tmp/certificates","readOnly":true}}]}}}}`, tlsSecretName) | ||
|
|
||
| args := []string{ | ||
| "operatorconfigs.csi.ceph.io", | ||
| OperatorConfigName, | ||
| "--type=merge", | ||
| "-p", | ||
| patch, | ||
| } | ||
|
|
||
| return retryKubectlArgs(namespace, kubectlPatch, deployTimeout, args...) | ||
| } | ||
|
|
||
| // unpatchOperatorConfigTLS removes the controllerPlugin volumes. | ||
| func unpatchOperatorConfigTLS(namespace string) error { | ||
| args := []string{ | ||
| "operatorconfigs.csi.ceph.io", | ||
| OperatorConfigName, | ||
| "--type=json", | ||
| "-p", | ||
| `[{"op":"remove","path":"/spec/driverSpecDefaults/controllerPlugin/volumes"}]`, | ||
| } | ||
|
|
||
| return retryKubectlArgs(namespace, kubectlPatch, deployTimeout, args...) | ||
| } |
| if clientSet != nil { | ||
| if err := clientSet.CoreV1().Secrets(cephCSINamespace).Delete( | ||
| context.TODO(), rbdProvisionerSecretName, metav1.DeleteOptions{}); err != nil { | ||
| framework.Logf("Warning: failed to delete provisioner secret: %v", err) | ||
| } | ||
| if err := clientSet.CoreV1().Secrets(cephCSINamespace).Delete( | ||
| context.TODO(), rbdNodePluginSecretName, metav1.DeleteOptions{}); err != nil { | ||
| framework.Logf("Warning: failed to delete node secret: %v", err) | ||
| } | ||
| } |
| if _, err := clientSet.CoreV1().ServiceAccounts(testNamespace).Create(ctx, sa, metav1.CreateOptions{}); err != nil { | ||
| return fmt.Errorf("failed to create SA %s: %w", saName, err) | ||
| } | ||
|
|
||
| cr := &rbacv1.ClusterRole{ | ||
| ObjectMeta: metav1.ObjectMeta{Name: smsClusterRole}, | ||
| Rules: []rbacv1.PolicyRule{ | ||
| { | ||
| APIGroups: []string{"snapshot.storage.k8s.io"}, | ||
| Resources: []string{"volumesnapshots", "volumesnapshotcontents"}, | ||
| Verbs: []string{"get", "list", "watch"}, | ||
| }, | ||
| { | ||
| APIGroups: []string{"cbt.storage.k8s.io"}, | ||
| Resources: []string{"snapshotmetadataservices"}, | ||
| Verbs: []string{"get", "list"}, | ||
| }, | ||
| { | ||
| APIGroups: []string{""}, | ||
| Resources: []string{"serviceaccounts/token"}, | ||
| Verbs: []string{"create", "get"}, | ||
| }, | ||
| }, | ||
| } | ||
| if _, err := clientSet.RbacV1().ClusterRoles().Create(ctx, cr, metav1.CreateOptions{}); err != nil { | ||
| return fmt.Errorf("failed to create ClusterRole %s: %w", smsClusterRole, err) | ||
| } | ||
|
|
||
| crb := &rbacv1.ClusterRoleBinding{ | ||
| ObjectMeta: metav1.ObjectMeta{Name: smsClusterRole}, | ||
| RoleRef: rbacv1.RoleRef{ | ||
| APIGroup: "rbac.authorization.k8s.io", | ||
| Kind: "ClusterRole", | ||
| Name: smsClusterRole, | ||
| }, | ||
| Subjects: []rbacv1.Subject{ | ||
| { | ||
| Kind: "ServiceAccount", | ||
| Name: saName, | ||
| Namespace: testNamespace, | ||
| }, | ||
| }, | ||
| } | ||
| if _, err := clientSet.RbacV1().ClusterRoleBindings().Create(ctx, crb, metav1.CreateOptions{}); err != nil { | ||
| return fmt.Errorf("failed to create ClusterRoleBinding %s: %w", smsClusterRole, err) | ||
| } | ||
|
|
||
| return nil |
| AfterAll(func() { | ||
| if conn != nil { | ||
| _ = conn.Close() | ||
| } |
| smsServiceName = "csi-snapshot-metadata" | ||
| smsTestSAName = "sms-e2e-tester" | ||
| smsClusterRole = "sms-e2e-tester" | ||
| smsLocalPort = 6443 |
Merge Protections🔴 1 of 2 protections blocking · waiting on ⛓️ dependency
🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
Show 1 satisfied protection🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
Summary
github.com/kubernetes-csi/external-snapshot-metadatafor sidecar gRPC APIGetMetadataAllocatedandGetMetadataDeltasidecar API--operator-deployment(ceph-csi-operator mode)Test Cases
Architecture
snapshot_metadata_helper.go: Infrastructure setup/teardown (TLS certs, OperatorConfig patch, sidecar verification, SMS CRD/CR, RBAC, port-forward, gRPC client)snapshot_metadata.go: 8 Ginkgo test cases inDescribe("RBD") > Context("[SnapshotMetadata]", Ordered)Test plan
go build ./...passes ine2e/depends-on: #6452
🤖 Generated with Claude Code