Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultTokenExpirySeconds = int64(600) // See "Service account tokens" in // https://kubernetes.io/docs/reference/access-authn-authz/authentication/. // It turns out that a service account name starts with a well defined prefix // that is guaranteed not to match any other user name. K8sServiceAccountUserNamePrefix = "system:serviceaccount:" )
Variables ¶
Functions ¶
func GetSnapshotMetadata ¶
GetSnapshotMetadata enumerates either the allocated blocks of a VolumeSnapshot object, or the blocks changed between a pair of VolumeSnapshot objects.
Metadata is returned via an emitter interface specified in the invocation arguments. Iteration terminates on the first error encountered, or if requested by the emitter.
Types ¶
type Args ¶
type Args struct { // Client interfaces are obtained from BuildClients. Clients // Emitter is an interface used to return metadata to the invoker. Emitter IteratorEmitter // Specify the namespace of the VolumeSnapshot objects. Namespace string // SnapshotName identifies a VolumeSnaphot. SnapshotName string // PrevSnapshotName is optional, and if specified will result in // enumeration of the changed blocks between the VolumeSnapshot // identified by it and that identified by the SnapshotName field. // If not specified then the allocated blocks of the VolumeSnapshot // identified by SnapshotName will be enumerated. PrevSnapshotName string // StartingOffset is the initial byte offset. StartingOffset int64 // MaxResults is the number of tuples to return in each record. // If 0 then the CSI driver decides the value. MaxResults int32 // CSIDriver specifies the name of the CSI driver and is used to // load the associated SnapshotMetadataService CR. // The field is optional. If not specified then it // will be fetched from the VolumeSnapshotContent of // the VolumeSnapshot specified by the SnapshotName field. CSIDriver string // Specify the ServiceAccount object used to construct a security token // with the audience string from the SnapshotMetadataService CR. // If either of the following fields are unspecified, the default for the given client will be used. SANamespace string SAName string // TokenExpirySecs specifies the time in seconds after which the // security token will expire. // If unspecified then the value of DefaultTokenExpirySeconds is used. TokenExpirySecs int64 }
type Clients ¶
type Clients struct { KubeClient kubernetes.Interface SnapshotClient snapshot.Interface SmsCRClient smsCR.Interface }
func BuildClients ¶
BuildClients constructs the necessary client interfaces from the given configuration.
type IteratorEmitter ¶
type IteratorEmitter interface { // SnapshotMetadataIteratorRecord is invoked for each record received // from the gRPC stream. // The operation should return true to continue or false to stop // enumerating the records. If false was returned then the iterator // will terminate with an ErrCancelled error. SnapshotMetadataIteratorRecord(recordNumber int, metadata IteratorMetadata) bool // SnapshotMetadataIteratorDone is called prior to termination as long as // no error was encountered. SnapshotMetadataIteratorDone(numberRecords int) }
type IteratorMetadata ¶
type IteratorMetadata struct { BlockMetadataType api.BlockMetadataType `json:"block_metadata_type"` VolumeCapacityBytes int64 `json:"volume_capacity_bytes"` BlockMetadata []*api.BlockMetadata `json:"block_metadata"` }
IteratorMetadata returns a single metadata record. These fields are fetched from the stream returned by either GetMetadataAllocated or GetMetadataDelta.
type JSONEmitter ¶
JSONEmitter formats the metadata in JSON.
func (*JSONEmitter) SnapshotMetadataIteratorDone ¶
func (e *JSONEmitter) SnapshotMetadataIteratorDone(_ int)
func (*JSONEmitter) SnapshotMetadataIteratorRecord ¶
func (e *JSONEmitter) SnapshotMetadataIteratorRecord(recordNumber int, metadata IteratorMetadata) bool
type TableEmitter ¶
TableEmitter formats the metadata as a table.
func (*TableEmitter) SnapshotMetadataIteratorDone ¶
func (e *TableEmitter) SnapshotMetadataIteratorDone(_ int)
func (*TableEmitter) SnapshotMetadataIteratorRecord ¶
func (e *TableEmitter) SnapshotMetadataIteratorRecord(recordNumber int, metadata IteratorMetadata) bool
Click to show internal directories.
Click to hide internal directories.