Skip to content

Commit 306ba63

Browse files
authored
Merge pull request #605 from carlbraganza/snapshot-metadata-sidecar-alpha
Documentation on the external-snaphot-metadata sidecar (alpha).
2 parents 7ad7935 + 7f30a33 commit 306ba63

File tree

4 files changed

+166
-0
lines changed

4 files changed

+166
-0
lines changed

book/src/SUMMARY.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- [cluster-driver-registrar](cluster-driver-registrar.md) (deprecated)
1919
- [external-health-monitor-controller](external-health-monitor-controller.md)
2020
- [external-health-monitor-agent](external-health-monitor-agent.md)
21+
- [external-snapshot-metadata](external-snapshot-metadata.md)
2122
- [CSI objects](csi-objects.md)
2223
- [CSIDriver Object](csi-driver-object.md)
2324
- [CSINode Object](csi-node-object.md)
@@ -44,6 +45,7 @@
4445
- [CSI Windows](csi-windows.md)
4546
- [Volume Mode Conversion](prevent-volume-mode-conversion.md)
4647
- [Cross-Namespace Data Sources](cross-namespace-data-sources.md)
48+
- [Changed Block Tracking](changed-block-tracking.md)
4749
- [Deploying a CSI Driver on Kubernetes](deploying.md)
4850
- [Example](example.md)
4951
- [Driver Testing](testing-drivers.md)

book/src/changed-block-tracking.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Changed Block Tracking
2+
3+
## Status
4+
5+
Status | Min K8s Version | Max K8s Version | Min CSI Version | Max CSI Version |
6+
-------|-----------------|-----------------|-----------------|-----------------|
7+
Alpha | 1.33 | - | [v1.10.0](https://github.com/container-storage-interface/spec/releases/tag/v1.10.0) | -
8+
9+
10+
## Overview
11+
12+
This optional feature provides a secure mechanism to obtain metadata
13+
on the allocated blocks of a CSI VolumeSnapshot, or the changed blocks between two arbitrary pairs of CSI VolumeSnapshot objects of the same PersistentVolume.
14+
See [Kubernetes Enhancement Proposal 3314](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking)
15+
for full details.
16+
17+
A CSI driver must advertise its support for this feature by specifying the
18+
`SNAPSHOT_METADATA_SERVICE` capability in the response of the
19+
[GetPluginCapabilities](https://github.com/container-storage-interface/spec/blob/master/spec.md#getplugincapabilities)
20+
RPC (part of the
21+
[CSI Identity Service](https://github.com/container-storage-interface/spec/blob/master/spec.md#identity-service-rpc)),
22+
and must implement the
23+
[CSI SnapshotMetadata Service](https://github.com/container-storage-interface/spec/blob/master/spec.md#snapshot-metadata-service-rpcs).
24+
25+
CSI drivers that implement this feature should deploy the
26+
[external-snapshot-metadata](./external-snapshot-metadata.md)
27+
sidecar and create the associated
28+
[Snapshot Metadata Service CR](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#snapshot-metadata-service-custom-resource).
29+
30+
The `external-snapshot-metadata` sidecar implements the server side of the
31+
[Kubernetes SnapshotMetadata Service API](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-kubernetes-snapshotmetadata-service-api).
32+
Backup applications obtain VolumeSnapshot metadata directly from the sidecar
33+
through this API, bypassing the Kubernetes API server for the most part.
34+
Backup application developers should refer to the [Usage](external-snapshot-metadata.md#usage)
35+
and [Resources](external-snapshot-metadata.md#resources)
36+
sections of the sidecar documentation for details.
37+

book/src/example.md

+9
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,13 @@ The [deployment example](https://github.com/kubernetes-csi/csi-driver-host-path#
55

66
The example deployment uses the original RBAC rule files that are maintained together with sidecar apps and deploys into the default namespace. A real production should copy the RBAC files and customize them as explained in the comments of those files.
77

8+
The Hostpath CSI driver only supports the [Changed Block Tracking](./changed-block-tracking.md) feature for
9+
PersistentVolumes with `Block` VolumeMode.
10+
The support is not enabled by default, but requires additional configuration when deploying the driver.
11+
When enabled, the
12+
[external-snapshot-metadata](./external-snapshot-metadata.md)
13+
sidecar will also be deployed, and the additional RBAC policies needed will get created.
14+
See the [docs/example-snapshot-metadata.md](https://github.com/kubernetes-csi/csi-driver-host-path/blob/master/docs/example-snapshot-metadata.md)
15+
document for details.
16+
817
If you encounter any problems, please check the [Troubleshooting page](troubleshooting.html).
+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# CSI external-snapshot-metadata
2+
3+
## Status and Releases
4+
5+
**Git Repository:** [https://github.com/kubernetes-csi/external-snapshot-metadata](https://github.com/kubernetes-csi/external-snapshot-metadata)
6+
7+
### Supported Versions
8+
9+
Latest stable release | Branch | Min CSI Version | Max CSI Version | Container Image | [Min K8s Version](project-policies.md#minimum-version) | [Max K8s Version](project-policies.md#maximum-version) | [Recommended K8s Version](project-policies.md#recommended-version) |
10+
--|--|--|--|--|--|--|--
11+
v0.1.0 | [v0.1.0](https://github.com/kubernetes-csi/external-snapshot-metadata/releases/tag/v0.1.0) | [v1.10.0](https://github.com/container-storage-interface/spec/releases/tag/v1.10.0) | - | registry.k8s.io/sig-storage/csi-snapshot-metadata:v0.1.0 | v1.33 | - | v1.33
12+
13+
14+
## Alpha
15+
16+
### Description
17+
This sidecar securely serves snapshot metadata to Kubernetes clients through the
18+
[Kubernetes SnapshotMetadata Service API](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-kubernetes-snapshotmetadata-service-api).
19+
This API is similar to the
20+
[CSI SnapshotMetadata Service](https://github.com/container-storage-interface/spec/blob/master/spec.md#snapshot-metadata-service-rpcs)
21+
but is designed to be used by Kuberetes authenticated and authorized backup applications.
22+
Its [protobuf specification](https://github.com/kubernetes-csi/external-snapshot-metadata/tree/main/proto/schema.proto)
23+
is available in the sidecar repository.
24+
25+
The sidecar authenticates and authorizes each Kubernetes backup application request made through the
26+
Kubernetes SnapshotMetadata Service API.
27+
It then acts as a proxy as it fetches the desired metadata from the CSI driver and
28+
streams it directly to the requesting application with no load on the Kubernetes API server.
29+
30+
See ["The External Snapshot Metadata Sidecar"](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-external-snapshot-metadata-sidecar)
31+
section in the CSI Changed Block Tracking KEP for additional details on the sidecar.
32+
33+
### Usage
34+
Backup applications, identified by their authorized ServiceAccount objects,
35+
directly communicate with the sidecar using the
36+
[Kubernetes SnapshotMetadata Service API](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-kubernetes-snapshotmetadata-service-api).
37+
The authorization needed is described in the
38+
["Risks and Mitigations"](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#risks-and-mitigations)
39+
section of the CSI Changed Block Tracking KEP.
40+
In particular, this requires the ability to use the Kubernetes
41+
[TokenRequest](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-request-v1/)
42+
API and to access the objects required to use the API.
43+
44+
The availability of this optional feature is advertised to backup applications by the presence of a
45+
[Snapshot Metadata Service CR](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#snapshot-metadata-service-custom-resource)
46+
that is named for the CSI driver that provisioned the PersistentVolume and VolumeSnapshot objects involved.
47+
The CR contains a gRPC service endpoint and CA certificate, and an audience string for authentication.
48+
A backup application must use the Kubernetes
49+
[TokenRequest](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-request-v1/)
50+
API with the audience string to obtain a Kubernetes authentication token for use in the
51+
Kubernetes SnapshotMetadata Service API call.
52+
The backup application should establish trust for the CA certificate before making the gRPC call
53+
to the service endpoint.
54+
55+
The Kubernetes SnapshotMetadata Service API uses a gRPC stream to return VolumeSnapshot metadata
56+
to the backup application. Metadata can be lengthy, so the API supports
57+
restarting an interrupted metadata request from an intermediate point in case of failure.
58+
The [Resources](external-snapshot-metadata.md#resources) section below describes the
59+
programming artifacts available to support backup application use of this API.
60+
61+
### Deployment
62+
The CSI `external-snapshot-metadata` sidecar should be deployed by
63+
CSI drivers that support the
64+
[Changed Block Tracking](./changed-block-tracking.md) feature.
65+
The sidecar must be deployed in the same pod as the CSI driver and
66+
will communicate with its gRPC [CSI SnapshotMetadata Service](https://github.com/container-storage-interface/spec/blob/master/spec.md#snapshot-metadata-service-rpcs)
67+
and [CSI Identity Service](https://github.com/container-storage-interface/spec/blob/master/spec.md#identity-service-rpc)
68+
over a UNIX domain socket.
69+
70+
The sidecar should be configured to run under the authority of its
71+
CSI driver ServiceAccount, which must be authorized as described in the
72+
["Risks and Mitigations"](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#risks-and-mitigations)
73+
section of the CSI Changed Block Tracking KEP.
74+
In particular, this requires the ability to use the Kubernetes
75+
[TokenReview](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-review-v1/)
76+
and
77+
[SubjectAccessReview](https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/subject-access-review-v1/)
78+
APIs.
79+
80+
A Service object must be created to expose the endpoints of the
81+
[Kubernetes SnapshotMetadata Service API](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-kubernetes-snapshotmetadata-service-api)
82+
gRPC server implemented by the sidecar.
83+
84+
A [SnapshotMetadataService CR](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#snapshot-metadata-service-custom-resource),
85+
named for the CSI driver, must be created to advertise the
86+
availability of this optional feature to Kubernetes backup application clients.
87+
The CR contains the CA certificate and Service endpoint address
88+
of the sidecar and the audience string needed for the client
89+
authentication token.
90+
91+
### Resources
92+
93+
The [external-snapshot-metadata repository](https://github.com/kubernetes-csi/external-snapshot-metadata) contains
94+
the [protobuf specification](https://github.com/kubernetes-csi/external-snapshot-metadata/tree/main/proto/schema.proto)
95+
of the
96+
[Kubernetes SnapshotMetadata Service API](https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3314-csi-changed-block-tracking#the-kubernetes-snapshotmetadata-service-api).
97+
98+
In addition, the repository has a number of useful artifacts to support Go language programs:
99+
100+
- The
101+
[Go client interface](https://github.com/kubernetes-csi/external-snapshot-metadata/tree/main/client)
102+
for the Kubernetes SnapshotMetadata Service API.
103+
104+
- The
105+
[pkg/iterator](https://github.com/kubernetes-csi/external-snapshot-metadata/tree/main/pkg/iterator)
106+
client helper package.
107+
This may be used by backup applications instead of working directly with the
108+
Kubernetes SnapshotMetadata Service gRPC client interfaces.
109+
The
110+
[snapshot-metadata-lister](https://github.com/kubernetes-csi/external-snapshot-metadata/tree/main/examples/snapshot-metadata-lister)
111+
example Go command illustrates the use of this helper package.
112+
113+
- Go language
114+
[CSI SnapshotMetadataService API client mocks](https://github.com/kubernetes-csi/external-snapshot-metadata/tree/main/pkg/csiclientmocks).
115+
116+
The sample [Hostpath CSI driver](example.md) has been extended to support the
117+
[Changed Block Tracking](./changed-block-tracking.md) feature
118+
and provides an illustration on how to deploy a CSI driver.

0 commit comments

Comments
 (0)