mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Add interface to abstract GCE volume operations.
We want to write unit test with fake GCE.
This commit is contained in:
@@ -100,6 +100,28 @@ type Config struct {
|
||||
}
|
||||
}
|
||||
|
||||
// Disks is interface for manipulation with GCE PDs.
|
||||
type Disks interface {
|
||||
// AttachDisk attaches given disk to given instance. Current instance
|
||||
// is used when instanceID is empty string.
|
||||
AttachDisk(diskName, instanceID string, readOnly bool) error
|
||||
|
||||
// DetachDisk detaches given disk to given instance. Current instance
|
||||
// is used when instanceID is empty string.
|
||||
DetachDisk(devicePath, instanceID string) error
|
||||
|
||||
// CreateDisk creates a new PD with given properties. Tags are serialized
|
||||
// as JSON into Description field.
|
||||
CreateDisk(name string, zone string, sizeGb int64, tags map[string]string) error
|
||||
|
||||
// DeleteDisk deletes PD.
|
||||
DeleteDisk(diskToDelete string) error
|
||||
|
||||
// GetAutoLabelsForPD returns labels to apply to PeristentVolume
|
||||
// representing this PD, namely failure domain and zone.
|
||||
GetAutoLabelsForPD(name string) (map[string]string, error)
|
||||
}
|
||||
|
||||
type instRefSlice []*compute.InstanceReference
|
||||
|
||||
func (p instRefSlice) Len() int { return len(p) }
|
||||
|
||||
Reference in New Issue
Block a user