|
| 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