plans

package
v1.4.0-beta Latest Latest
Warning

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

Go to latest
Published: Sep 27, 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) UnmarshalJSON added in v1.4.0

func (an *Annotation) UnmarshalJSON(b []byte) 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"`
}

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 []Mountpoint `json:"inputs"`

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

	// Log is the log point of the plan.
	//
	// If nil, the plan does not record logs.
	Log *LogPoint `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 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 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 string     `json:"path"`
	Tags []tags.Tag `json:"tags"`
}

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 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          Image        `json:"image" yaml:"image"`
	Inputs         []Mountpoint `json:"inputs" yaml:"inputs"`
	Outputs        []Mountpoint `json:"outputs" yaml:"outputs"`
	Log            *LogPoint    `json:"log,omitempty" yaml:"log,omitempty"`
	OnNode         *OnNode      `json:"on_node,omitempty" yaml:"on_node,omitempty"`
	Resources      Resources    `json:"resources,omitempty" yaml:"resources,omitempty"`
	ServiceAccount string       `json:"service_account,omitempty" yaml:"service_account,omitempty"`
	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"`

	// 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

Jump to

Keyboard shortcuts

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