resource

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ReadyCondition is used to indicate that Nodes and Pods are ready.
	ReadyCondition = Condition{
		Type:   "Ready",
		Status: "True",
	}
	// SucceededCondition is used to indicate that Pods have completed successfully and returned no errors.
	SucceededCondition = Condition{
		Type:   "Succeeded",
		Status: "True",
	}
	// FailedCondition is used to indicate that Pods have failed.
	FailedCondition = Condition{
		Type:   "Failed",
		Status: "True",
	}
	// HasIPStatusCondition is used to indicate that pods have ips available.
	HasIPStatusCondition = Condition{
		Type:   "HasIPStatus",
		Status: "True",
	}
)

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Type   string
	Status string
}

Condition represents a state that should be reached.

type Resource

type Resource interface {
	// Name returns the name of the resource
	Name() string
	// Selector returns the resource's Selector.
	Selector() Selector
	// Namespace returns the namespace where the resource lives in.
	Namespace() string
}

Resource groups a set of method to identify a resource in a cluster.

func NewResource

func NewResource(name, namespace string, selector Selector) Resource

NewResource initializes a new resource.Resource using a kubernetes service implementation.

type Selector

type Selector interface {
	// String returns the selector represented in string format.
	String() string
	// Map returns the underlying selector's map.
	Map() map[string]string
	// Extend extends the underlying base map with the extension selector.
	// NOTE: If a certain key already exists in the base map, it will be overwritten by the extension value.
	Extend(extension Selector) Selector
	// Set sets the given value to the given key. If the key already exists, it will be overwritten.
	Set(key string, value string)
	// Get gets the value at the given key. If the key doesn't exist, an empty value will be returned.
	Get(key string) string
}

Selector is used to identify a certain resource.

func NewSelector

func NewSelector(input map[string]string) Selector

NewSelector initializes a new Selector from the given map. If `nil` is passed as input, an empty selector will be returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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