plans

package
v1.5.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 10 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation added in v1.4.0

type Annotation struct {
	Key   string
	Value string
}

func (Annotation) Equal added in v1.4.0

func (an Annotation) Equal(o Annotation) bool

func (Annotation) MarshalJSON added in v1.4.0

func (an Annotation) MarshalJSON() ([]byte, error)

func (Annotation) MarshalYAML added in v1.4.0

func (an Annotation) MarshalYAML() (interface{}, error)

func (Annotation) String added in v1.4.0

func (an Annotation) String() string

func (*Annotation) UnmarshalJSON added in v1.4.0

func (an *Annotation) UnmarshalJSON(b []byte) error

func (*Annotation) UnmarshalYAML added in v1.4.0

func (an *Annotation) UnmarshalYAML(node *yaml.Node) error

type AnnotationChange added in v1.4.0

type AnnotationChange struct {
	// Annotations to be added.
	//
	// If the Plan to be annotated already has the key, the value is updated.
	// If same key is set multiple times, the last one is used.
	Add Annotations `json:"add,omitempty" yaml:"add,omitempty"`

	// Keys of Annotations to be removed.
	Remove Annotations `json:"remove,omitempty" yaml:"remove,omitempty"`

	RemoveKey []string `json:"remove_key,omitempty" yaml:"remove_key,omitempty"`
}

AnnotationChange is a changeset of Annotations of a Plan.

Knitfab WebAPI applies Remove first, then Add.

type Annotations added in v1.4.0

type Annotations []Annotation

func (Annotations) Equal added in v1.4.0

func (ans Annotations) Equal(o Annotations) bool

func (Annotations) MarshalJSON added in v1.4.0

func (ans Annotations) MarshalJSON() ([]byte, error)

type Detail

type Detail struct {
	Summary

	// Inputs are the input mountpoints of the plan.
	Inputs []Input `json:"inputs"`

	// Outputs are the output mountpoints of the plan.
	Outputs []Output `json:"outputs"`

	// Log is the log point of the plan.
	//
	// If nil, the plan does not record logs.
	Log *Log `json:"log,omitempty"`

	// Active shows Plan's activeness.
	//
	// It is true if the plan is active and new runs can be created.
	Active bool `json:"active"`

	// OnNode is the node affinity/torelance of the plan.
	//
	// If nil, the plan does not have node affinity/torelance.
	OnNode *OnNode `json:"on_node,omitempty"`

	// Resources is the resource limits and requiremnts of the plan.
	Resources Resources `json:"resources,omitempty"`

	// ServiceAccount is the ServiceAccount name of the plan.
	//
	// Workers of the Run based this Plan will run with this ServiceAccount.
	ServiceAccount string `json:"service_account,omitempty"`
}

Detail is the format for the response body from Knitfab APIs below:

- GET /api/plans/ (as list)

- POST /api/plans/

- GET /api/plans/{planId}

- PUT /api/plans/{planId}/active

- PUT /api/plans/{planId}/resources

func (Detail) Equal

func (d Detail) Equal(o Detail) bool

type Downstream added in v1.5.0

type Downstream struct {
	// Plan is the downstream Plan.
	Plan Summary `json:"plan"`

	// Mountpoint represents the Input which is direct downstream.
	Mountpoint Mountpoint `json:"mountpoint"`
}

Downstream is the format for output dependencies of a Plan.

func (Downstream) Equal added in v1.5.0

func (d Downstream) Equal(o Downstream) bool

type Image

type Image struct {
	Repository string
	Tag        string
}

func (*Image) Equal

func (i *Image) Equal(o *Image) bool

func (Image) MarshalJSON

func (i Image) MarshalJSON() ([]byte, error)

func (Image) MarshalYAML

func (i Image) MarshalYAML() (interface{}, error)

func (*Image) Parse

func (i *Image) Parse(s string) error

parse string as Image Tag, and upgate itself.

this spec is based on docker image tag spec^1.

func (*Image) String

func (i *Image) String() string

func (*Image) UnmarshalJSON

func (i *Image) UnmarshalJSON(b []byte) error

func (*Image) UnmarshalYAML

func (i *Image) UnmarshalYAML(node *yaml.Node) error

type Input added in v1.5.0

type Input struct {
	Mountpoint

	// Upstreams are the upstream Plans and their output mountpoints
	// whose output Data can be mounted to this input mountpoint.
	Upstreams []Upstream `json:"upstreams"`
}

Input is the format for input mountpoints of a Plan.

func (Input) Equal added in v1.5.0

func (i Input) Equal(o Input) bool

type Log added in v1.5.0

type Log struct {
	LogPoint

	// Downstreams are the downstream Plans and their input mountpoints
	// can be assigned with Data from this output.
	Downstreams []Downstream `json:"downstreams"`
}

func (Log) Equal added in v1.5.0

func (l Log) Equal(ol Log) bool

func (Log) String added in v1.5.0

func (l Log) String() string

type LogPoint

type LogPoint struct {
	Tags []tags.Tag
}

func (LogPoint) Equal

func (lp LogPoint) Equal(o LogPoint) bool

func (LogPoint) String

func (lp LogPoint) String() string

type Mountpoint

type Mountpoint struct {
	// Path is the path of the mountpoint.
	//
	// This is the path in the container where the Data will be mounted
	// when the Run starts.
	Path string `json:"path"`

	// Tags are the tags of the mountpoint.
	//
	// For input mountpoints, these are the required tags of the Data to be mounted.
	// The Data with these all tags will be mounted to the Path when the Run starts.
	//
	// For output mountpoints, these are the tags to be attached to the Data mounted.
	Tags []tags.Tag `json:"tags"`
}

Mountpoint is the format for input/output mountpoints of a Plan.

func (Mountpoint) Equal

func (m Mountpoint) Equal(o Mountpoint) bool

type OnNode

type OnNode struct {
	May    []OnSpecLabel `json:"may,omitempty" yaml:"may,omitempty"`
	Prefer []OnSpecLabel `json:"prefer,omitempty" yaml:"prefer,omitempty"`
	Must   []OnSpecLabel `json:"must,omitempty" yaml:"must,omitempty"`
}

func (OnNode) Equal

func (o OnNode) Equal(oo OnNode) bool

type OnSpecLabel

type OnSpecLabel struct {
	Key   string
	Value string
}

func (OnSpecLabel) Equal

func (l OnSpecLabel) Equal(o OnSpecLabel) bool

func (OnSpecLabel) MarshalJSON

func (l OnSpecLabel) MarshalJSON() ([]byte, error)

func (OnSpecLabel) MarshalYAML

func (l OnSpecLabel) MarshalYAML() (interface{}, error)

func (*OnSpecLabel) Parse

func (l *OnSpecLabel) Parse(s string) error

func (OnSpecLabel) String

func (l OnSpecLabel) String() string

func (*OnSpecLabel) UnmarshalJSON

func (l *OnSpecLabel) UnmarshalJSON(value []byte) error

func (*OnSpecLabel) UnmarshalYAML

func (l *OnSpecLabel) UnmarshalYAML(node *yaml.Node) error

type Output added in v1.5.0

type Output struct {
	Mountpoint

	// Downstreams are the downstream Plans and their input mountpoints
	// can be assigned with Data from this output.
	Downstreams []Downstream `json:"downstreams"`
}

Output is the format for output mountpoints of a Plan.

func (Output) Equal added in v1.5.0

func (o Output) Equal(oo Output) bool

type PlanSpec

type PlanSpec struct {
	// Annotations are the annotations of the Plan.
	//
	// In JSON format, it is a list of strings in the form of "key=value".
	//
	// If same key is set multiple times, the last one is used.
	Annotations Annotations `json:"annotations,omitempty" yaml:"annotations,omitempty"`

	// Image is the container image of the Plan.
	Image Image `json:"image" yaml:"image"`

	// Entrypoint is the entrypoint of the container of the Plan.
	Entrypoint []string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"`

	// Args are the arguments of the container of the Plan.
	Args []string `json:"args,omitempty" yaml:"args,omitempty"`

	// Inputs are the input mountpoints of the plan.
	//
	// These describes "where should input Data be mounted to the container" and
	// "what tags should be attached to the input Data".
	//
	// When Knitfab detect the Data with the tags, it will be mounted to the container and started as a Run.
	Inputs []Mountpoint `json:"inputs" yaml:"inputs"`

	// Outputs are the output mountpoints of the plan.
	//
	// These describes "where should output Data be mounted to the container" and
	// "what tags will be attached to the output Data".
	//
	// On the Run start, Knitfab will create the mountpoints and attach the tags to the output Data.
	Outputs []Mountpoint `json:"outputs" yaml:"outputs"`

	// Log is the log point of the plan.
	//
	// "Log" means a Data containing standard output and standard error of the container.
	// If nil, the plan does not record logs.
	//
	// As Outputs, Log can have Tags which will be attached to the log Data.
	Log *LogPoint `json:"log,omitempty" yaml:"log,omitempty"`

	// OnNode is the node affinity/torelance of the plan.
	//
	// If nil, the plan does not have node affinity/torelance.
	OnNode *OnNode `json:"on_node,omitempty" yaml:"on_node,omitempty"`

	// Resources is the conputational resource limits and requiremnts of the plan.
	Resources Resources `json:"resources,omitempty" yaml:"resources,omitempty"`

	// ServiceAccount is the Kubernetes ServiceAccount name of the plan.
	ServiceAccount string `json:"service_account,omitempty" yaml:"service_account,omitempty"`

	// Active shows Plan's activeness.
	//
	// If true or nil, the Plan is active and new Runs based the Plan can be started.
	//
	// If false, the Plan is inactive and new Runs based the Plan are created but suspended to start.
	Active *bool `json:"active" yaml:"active,omitempty"`
}

PlanSpec is the format for request body to Knitfab APIs below:

- POST /api/plans/

func (PlanSpec) Equal

func (ps PlanSpec) Equal(o PlanSpec) bool

type ResourceLimitChange

type ResourceLimitChange struct {

	// Resource to be set.
	Set Resources `json:"set,omitempty" yaml:"set,omitempty"`

	// Resource types to be unset.
	//
	// If same type Set and Unset, Unset is affected.
	Unset []string `json:"unset,omitempty" yaml:"unset,omitempty"`
}

ResourceLimitChange is a change of resource limit of plan.

type Resources

type Resources map[string]resource.Quantity

func (Resources) Equal

func (r Resources) Equal(o Resources) bool

func (Resources) MarshalJSON

func (r Resources) MarshalJSON() ([]byte, error)

func (Resources) MarshalYAML

func (r Resources) MarshalYAML() (interface{}, error)

func (*Resources) UnmarshalJSON

func (r *Resources) UnmarshalJSON(b []byte) error

func (*Resources) UnmarshalYAML

func (r *Resources) UnmarshalYAML(node *yaml.Node) error

type SetServiceAccount added in v1.4.0

type SetServiceAccount struct {
	ServiceAccount string `json:"service_account" yaml:"service_account"`
}

SetServiceccount declares new ServiceAccount name of a Plan.

type Summary

type Summary struct {
	// PlanId is the id of the Plan.
	PlanId string `json:"planId"`

	// Image is the container image of the Plan.
	//
	// This is exclusive with Name.
	Image *Image `json:"image,omitempty"`

	// Entrypoint is the entrypoint of the container of the Plan.
	Entrypoint []string `json:"entrypoint,omitempty"`

	// Args are the arguments of the container of the Plan.
	Args []string `json:"args,omitempty"`

	// Name is the name of the Plan.
	//
	// This is exclusive with Image, and used only for the system-builtin Plan with no image.
	Name string `json:"name,omitempty"`

	// Annotations are the annotations of the Plan.
	//
	// In JSON format, it is a list of strings in the form of "key=value".
	Annotations Annotations `json:"annotations,omitempty"`
}

func (Summary) Equal

func (s Summary) Equal(o Summary) bool

type Upstream added in v1.5.0

type Upstream struct {
	// Plan is the upstream Plan.
	Plan Summary `json:"plan"`

	// Mountpoint represents the Output which is directt upstream.
	//
	// Log and Mountpoint are mutually exclusive.
	Mountpoint *Mountpoint `json:"mountpoint,omitempty"`

	// Log represents the Log which is direct upstream.
	//
	// Log and Mountpoint are mutually exclusive.
	Log *LogPoint `json:"log,omitempty"`
}

Upstream is the format for input dependencies of a Plan.

func (Upstream) Equal added in v1.5.0

func (d Upstream) Equal(o Upstream) bool

Jump to

Keyboard shortcuts

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