diskscollector

package
v0.0.0-...-a4b4531 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskAPI

type DiskAPI interface {
	ListDisks(project, zone string) ([]*compute.Disk, error)
	RemoveDisk(name, project, zone string) error
}

DiskAPI allows to access Disks Compute API in GCP

type DiskAPIWrapper

type DiskAPIWrapper struct {
	Context context.Context
	Service *compute.DisksService
}

DiskAPIWrapper abstracts GCP DisksService API

func (*DiskAPIWrapper) ListDisks

func (daw *DiskAPIWrapper) ListDisks(project, zone string) ([]*compute.Disk, error)

ListDisks implements DiskAPI.ListDisks function

func (*DiskAPIWrapper) RemoveDisk

func (daw *DiskAPIWrapper) RemoveDisk(project, zone, name string) error

RemoveDisk implements DiskAPI.RemoveDisk function

type DiskRemovalPredicate

type DiskRemovalPredicate func(*compute.Disk) (bool, error)

DiskRemovalPredicate returns true when disk should be deleted (matches removal criteria)

func NewDiskFilter

func NewDiskFilter(diskNameRegexp *regexp.Regexp, ageInHours int) DiskRemovalPredicate

NewDiskFilter is a default DiskRemovalPredicate factory Disk is matching the criteria if it's: - Name matches diskNameRegexp - CreationTimestamp indicates that it is created more than ageInHours ago. - Users list is empty

type DisksGarbageCollector

type DisksGarbageCollector struct {
	// contains filtered or unexported fields
}

DisksGarbageCollector can find and delete disks provisioned by gke-integration prow jobs and not cleaned up properly.

func NewDisksGarbageCollector

func NewDisksGarbageCollector(zoneAPI ZoneAPI, diskAPI DiskAPI, shouldRemove DiskRemovalPredicate) *DisksGarbageCollector

NewDisksGarbageCollector returns a new instance of DisksGarbageCollector

func (*DisksGarbageCollector) Run

func (gc *DisksGarbageCollector) Run(project string, makeChanges bool) (allSucceeded bool, err error)

Run executes disks garbage collection process

type ZoneAPI

type ZoneAPI interface {
	ListZones(project string) ([]string, error)
}

ZoneAPI allows to acces Zones Compute API in GCP

type ZoneAPIWrapper

type ZoneAPIWrapper struct {
	Context context.Context
	Service *compute.ZonesService
}

ZoneAPIWrapper abstracts GCP ZonesService API

func (*ZoneAPIWrapper) ListZones

func (zaw *ZoneAPIWrapper) ListZones(project string) ([]string, error)

ListZones implements ZoneAPI.ListZones function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL