vmscollector

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InstanceRemovalPredicate

type InstanceRemovalPredicate func(instance *compute.Instance) (bool, error)

InstanceRemovalPredicate returns true when the VM instance should be deleted (matches removal criteria)

func DefaultInstanceRemovalPredicate

func DefaultInstanceRemovalPredicate(instanceNameRegexp *regexp.Regexp, jobLabelRegexp *regexp.Regexp, ageInHours uint) InstanceRemovalPredicate

DefaultInstanceRemovalPredicate returns an instance of InstanceRemovalPredicate that filters instances based on instanceNameRegexp, jobLabelRegexp, ageInHours and Status

type InstancesAPI

type InstancesAPI interface {
	ListInstances(project string) ([]*compute.Instance, error)
	RemoveInstance(project, zone, name string) error
}

InstancesAPI abstracts access to Instances Compute API in GCP

type InstancesAPIWrapper

type InstancesAPIWrapper struct {
	Context context.Context
	Service *compute.InstancesService
}

InstancesAPIWrapper abstracts GCP InstancesService API

func (*InstancesAPIWrapper) ListInstances

func (iaw *InstancesAPIWrapper) ListInstances(project string) ([]*compute.Instance, error)

ListInstances delegates to InstancesService.ListInstances(project) function

func (*InstancesAPIWrapper) RemoveInstance

func (iaw *InstancesAPIWrapper) RemoveInstance(project, zone, name string) error

RemoveInstance delegates to InstancesService.Delete(project, zone, name) function

type InstancesGarbageCollector

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

InstancesGarbageCollector can find and delete VM instances provisioned by kyma-integration prow jobs and not cleaned up properly.

func NewInstancesGarbageCollector

func NewInstancesGarbageCollector(instancesAPI InstancesAPI, shouldRemove InstanceRemovalPredicate) *InstancesGarbageCollector

NewInstancesGarbageCollector returns a new object of InstancesGarbageCollector type

func (*InstancesGarbageCollector) Run

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

Run executes garbage collection process for VM instances

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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