model

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostName added in v0.0.3

type HostName struct {
	Name      string
	Namespace string
}

HostName represents the Hostname of a service in a given namespace

func (*HostName) Match added in v0.0.3

func (h *HostName) Match(name string) bool

Match returns true if this Hostname is equal to the short or long v of a dns name

type LocatedResourceStatus added in v0.0.2

type LocatedResourceStatus struct {
	ResourceStatus

	Labels map[string]string
}

LocatedResourceStatus is a ResourceStatus with labels

func NewLocatedResource added in v0.0.2

func NewLocatedResource(kind, name string, labels map[string]string) LocatedResourceStatus

NewLocatedResource is a simple helper to create LocatedResourceStatus

type Locator

type Locator func(SessionContext, *Ref) bool

Locator should attempt to resolve a Ref.Name to a target Named kind, e.g. Deployment, DeploymentConfig. return false if nothing was found

type Mutator

type Mutator func(SessionContext, *Ref) error

Mutator should create/modify a target Kind as required as needed * Add status to Ref for storage, failed or not

type Ref

type Ref struct {
	Name             string
	Namespace        string
	Strategy         string
	Args             map[string]string
	Targets          []LocatedResourceStatus
	ResourceStatuses []ResourceStatus
}

Ref references to a single Reference, e.g. Deployment, DeploymentConfig or GitRepo

func (*Ref) AddResourceStatus

func (r *Ref) AddResourceStatus(ref ResourceStatus)

AddResourceStatus adds the status of an involved Resource to this ref

func (*Ref) AddTargetResource added in v0.0.3

func (r *Ref) AddTargetResource(ref LocatedResourceStatus)

AddTargetResource adds the status of an involved Resource to this ref

func (*Ref) GetNewVersion added in v0.0.3

func (r *Ref) GetNewVersion(sessionName string) string

GetNewVersion returns the new updated version name

func (*Ref) GetResourceStatus

func (r *Ref) GetResourceStatus(kind string) []ResourceStatus

GetResourceStatus returns a array of involved Resources based on a k8s Kind

func (*Ref) GetTargetHostNames added in v0.0.3

func (r *Ref) GetTargetHostNames() []HostName

GetTargetHostNames returns a list of Host names that the target Deployment can be reached under

func (*Ref) GetTargetsByKind added in v0.0.3

func (r *Ref) GetTargetsByKind(kinds ...string) []LocatedResourceStatus

GetTargetsByKind returns the targets of the given kind

func (*Ref) GetVersion added in v0.0.3

func (r *Ref) GetVersion() string

GetVersion returns the existing version name

func (*Ref) RemoveResourceStatus

func (r *Ref) RemoveResourceStatus(ref ResourceStatus)

RemoveResourceStatus removes the status of an involved Resource to this ref

type ResourceAction

type ResourceAction string

ResourceAction describes which type of operation was done/attempted to the target resource. Used to determine how to undo it.

const (
	// ActionCreated imply the whole Named Kind was created and can be deleted
	ActionCreated ResourceAction = "created"
	// ActionModified imply the Named Kind has been modified and needs to be reverted to get back to original state
	ActionModified ResourceAction = "modified"
	// ActionFailed imply what ever was attempted failed. Assume current state is ok in clean up?
	ActionFailed ResourceAction = "failed"
	// ActionLocated imply the resource was found, but nothing was changed.
	ActionLocated ResourceAction = "located"
)

type ResourceStatus

type ResourceStatus struct {
	Kind string
	Name string
	// created, mutated, failed
	Action ResourceAction
}

ResourceStatus holds information about the resources created/changed to fulfill a Ref

type Revertor

type Revertor func(SessionContext, *Ref) error

Revertor should delete/modify a target Kind to return to the original state after a Mutator * Remove status from Ref unless there is a failure that requires retry

type Route

type Route struct {
	Type  string
	Name  string
	Value string
}

Route references the strategy used to route to the target Refs

type SessionContext

type SessionContext struct {
	context.Context

	Name      string
	Namespace string
	Route     Route
	Client    client.Client
	Log       logr.Logger
}

SessionContext holds the context for a single session object, giving access to key things like REST Client and target Namespace

Jump to

Keyboard shortcuts

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