types

package
v1.11.8 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseResourceLimits added in v1.9.0

func ParseResourceLimits(rl ResourcesLimits) (milliCpus *int, memoryBytes *int64, err error)

ParseResourceLimits parses a resource limits definition into milli-cpus and memory bytes if present. For example, 500m cpus = 500 millicpus, while 2 cpus = 2000 cpus. 1M == 1000000 bytes of memory, while 1Ki = 1024.

Types

type Container added in v1.0.2

type Container struct {
	// If specified, overrides the arguments passed to the container entrypoint.
	Args []string `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args,omitempty"`

	// If specified, overrides the entrypoint defined in the container image.
	Command []string `json:"command,omitempty" yaml:"command,omitempty" mapstructure:"command,omitempty"`

	// Files corresponds to the JSON schema field "files".
	Files ContainerFiles `json:"files,omitempty" yaml:"files,omitempty" mapstructure:"files,omitempty"`

	// The container image name and tag.
	Image string `json:"image" yaml:"image" mapstructure:"image"`

	// The liveness probe for the container.
	LivenessProbe *ContainerProbe `json:"livenessProbe,omitempty" yaml:"livenessProbe,omitempty" mapstructure:"livenessProbe,omitempty"`

	// The readiness probe for the container.
	ReadinessProbe *ContainerProbe `json:"readinessProbe,omitempty" yaml:"readinessProbe,omitempty" mapstructure:"readinessProbe,omitempty"`

	// The compute resources for the container.
	Resources *ContainerResources `json:"resources,omitempty" yaml:"resources,omitempty" mapstructure:"resources,omitempty"`

	// The environment variables for the container.
	Variables ContainerVariables `json:"variables,omitempty" yaml:"variables,omitempty" mapstructure:"variables,omitempty"`

	// Volumes corresponds to the JSON schema field "volumes".
	Volumes ContainerVolumes `json:"volumes,omitempty" yaml:"volumes,omitempty" mapstructure:"volumes,omitempty"`
}

The specification of a Container within the Workload.

func (*Container) UnmarshalJSON added in v1.0.2

func (j *Container) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ContainerFile added in v1.10.0

type ContainerFile struct {
	// Inline standard-base64 encoded content for the file. Does not support
	// placeholder expansion.
	BinaryContent *string `json:"binaryContent,omitempty" yaml:"binaryContent,omitempty" mapstructure:"binaryContent,omitempty"`

	// The inline content for the file. Only supports valid utf-8.
	Content *string `json:"content,omitempty" yaml:"content,omitempty" mapstructure:"content,omitempty"`

	// The optional file access mode in octal encoding. For example 0600.
	Mode *string `json:"mode,omitempty" yaml:"mode,omitempty" mapstructure:"mode,omitempty"`

	// If set to true, the placeholders expansion will not occur in the contents of
	// the file.
	NoExpand *bool `json:"noExpand,omitempty" yaml:"noExpand,omitempty" mapstructure:"noExpand,omitempty"`

	// The relative or absolute path to the content file.
	Source *string `json:"source,omitempty" yaml:"source,omitempty" mapstructure:"source,omitempty"`
}

The details of a file to mount in the container. One of 'source', 'content', or 'binaryContent' must be provided.

func (*ContainerFile) UnmarshalJSON added in v1.10.0

func (j *ContainerFile) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ContainerFiles added in v1.10.0

type ContainerFiles map[string]ContainerFile

type ContainerProbe added in v1.0.2

type ContainerProbe struct {
	// Exec corresponds to the JSON schema field "exec".
	Exec *ExecProbe `json:"exec,omitempty" yaml:"exec,omitempty" mapstructure:"exec,omitempty"`

	// HttpGet corresponds to the JSON schema field "httpGet".
	HttpGet *HttpProbe `json:"httpGet,omitempty" yaml:"httpGet,omitempty" mapstructure:"httpGet,omitempty"`
}

The probe may be defined as either http, command execution, or both. The execProbe should be preferred if the Score implementation supports both types.

type ContainerResources added in v1.0.2

type ContainerResources struct {
	// The maximum allowed resources for the container.
	Limits *ResourcesLimits `json:"limits,omitempty" yaml:"limits,omitempty" mapstructure:"limits,omitempty"`

	// The minimal resources required for the container.
	Requests *ResourcesLimits `json:"requests,omitempty" yaml:"requests,omitempty" mapstructure:"requests,omitempty"`
}

The compute resources for the container.

type ContainerVariables added in v1.0.2

type ContainerVariables map[string]string

The environment variables for the container.

type ContainerVolume added in v1.10.0

type ContainerVolume struct {
	// An optional sub path in the volume.
	Path *string `json:"path,omitempty" yaml:"path,omitempty" mapstructure:"path,omitempty"`

	// Indicates if the volume should be mounted in a read-only mode.
	ReadOnly *bool `json:"readOnly,omitempty" yaml:"readOnly,omitempty" mapstructure:"readOnly,omitempty"`

	// The external volume reference.
	Source string `json:"source" yaml:"source" mapstructure:"source"`
}

func (*ContainerVolume) UnmarshalJSON added in v1.10.0

func (j *ContainerVolume) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ContainerVolumes added in v1.10.0

type ContainerVolumes map[string]ContainerVolume

type ExecProbe added in v1.9.0

type ExecProbe struct {
	// The command and arguments to execute within the container.
	Command []string `json:"command" yaml:"command" mapstructure:"command"`
}

An executable health probe.

func (*ExecProbe) UnmarshalJSON added in v1.9.0

func (j *ExecProbe) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type HttpProbe added in v1.0.2

type HttpProbe struct {
	// Host name to connect to. Defaults to the workload IP. The is equivalent to a
	// Host HTTP header.
	Host *string `json:"host,omitempty" yaml:"host,omitempty" mapstructure:"host,omitempty"`

	// Additional HTTP headers to send with the request
	HttpHeaders []HttpProbeHttpHeadersElem `json:"httpHeaders,omitempty" yaml:"httpHeaders,omitempty" mapstructure:"httpHeaders,omitempty"`

	// The path to access on the HTTP server.
	Path string `json:"path" yaml:"path" mapstructure:"path"`

	// The port to access on the workload.
	Port int `json:"port" yaml:"port" mapstructure:"port"`

	// Scheme to use for connecting to the host (HTTP or HTTPS). Defaults to HTTP.
	Scheme *HttpProbeScheme `json:"scheme,omitempty" yaml:"scheme,omitempty" mapstructure:"scheme,omitempty"`
}

An HTTP probe details.

func (*HttpProbe) UnmarshalJSON added in v1.0.2

func (j *HttpProbe) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type HttpProbeHttpHeadersElem added in v1.0.2

type HttpProbeHttpHeadersElem struct {
	// The HTTP header name.
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// The HTTP header value.
	Value string `json:"value" yaml:"value" mapstructure:"value"`
}

func (*HttpProbeHttpHeadersElem) UnmarshalJSON added in v1.2.0

func (j *HttpProbeHttpHeadersElem) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type HttpProbeScheme added in v1.0.2

type HttpProbeScheme string
const HttpProbeSchemeHTTP HttpProbeScheme = "HTTP"
const HttpProbeSchemeHTTPS HttpProbeScheme = "HTTPS"

func (*HttpProbeScheme) UnmarshalJSON added in v1.0.2

func (j *HttpProbeScheme) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Resource added in v1.0.2

type Resource struct {
	// An optional specialisation of the Resource type.
	Class *string `json:"class,omitempty" yaml:"class,omitempty" mapstructure:"class,omitempty"`

	// An optional Resource identifier. The id may be up to 63 characters, including
	// one or more labels of a-z, 0-9, '-' not starting or ending with '-' separated
	// by '.'. When two resources share the same type, class, and id, they are
	// considered the same resource when used across related Workloads.
	Id *string `json:"id,omitempty" yaml:"id,omitempty" mapstructure:"id,omitempty"`

	// The metadata for the Resource.
	Metadata ResourceMetadata `json:"metadata,omitempty" yaml:"metadata,omitempty" mapstructure:"metadata,omitempty"`

	// Optional parameters used to provision the Resource in the environment.
	Params ResourceParams `json:"params,omitempty" yaml:"params,omitempty" mapstructure:"params,omitempty"`

	// The Resource type. This should be a type supported by the Score implementations
	// being used.
	Type string `json:"type" yaml:"type" mapstructure:"type"`
}

The set of Resources associated with this Workload.

func (*Resource) UnmarshalJSON added in v1.0.2

func (j *Resource) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ResourceMetadata added in v1.0.2

type ResourceMetadata map[string]interface{}

The metadata for the Resource.

func (*ResourceMetadata) UnmarshalYAML added in v1.7.2

func (m *ResourceMetadata) UnmarshalYAML(unmarshal func(interface{}) error) error

type ResourceParams added in v1.0.2

type ResourceParams map[string]interface{}

Optional parameters used to provision the Resource in the environment.

type ResourcesLimits added in v1.0.2

type ResourcesLimits struct {
	// The CPU limit as whole or fractional CPUs. 'm' indicates milli-CPUs. For
	// example 2 or 125m.
	Cpu *string `json:"cpu,omitempty" yaml:"cpu,omitempty" mapstructure:"cpu,omitempty"`

	// The memory limit in bytes with optional unit specifier. For example 125M or
	// 1Gi.
	Memory *string `json:"memory,omitempty" yaml:"memory,omitempty" mapstructure:"memory,omitempty"`
}

The compute and memory resource limits.

type ServicePort added in v1.0.2

type ServicePort struct {
	// The public service port.
	Port int `json:"port" yaml:"port" mapstructure:"port"`

	// The transport level protocol. Defaults to TCP.
	Protocol *ServicePortProtocol `json:"protocol,omitempty" yaml:"protocol,omitempty" mapstructure:"protocol,omitempty"`

	// The internal service port. This will default to 'port' if not provided.
	TargetPort *int `json:"targetPort,omitempty" yaml:"targetPort,omitempty" mapstructure:"targetPort,omitempty"`
}

The network port description.

func (*ServicePort) UnmarshalJSON added in v1.0.2

func (j *ServicePort) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ServicePortProtocol added in v1.1.0

type ServicePortProtocol string
const ServicePortProtocolTCP ServicePortProtocol = "TCP"
const ServicePortProtocolUDP ServicePortProtocol = "UDP"

func (*ServicePortProtocol) UnmarshalJSON added in v1.1.0

func (j *ServicePortProtocol) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Workload added in v1.0.2

type Workload struct {
	// The declared Score Specification version.
	ApiVersion string `json:"apiVersion" yaml:"apiVersion" mapstructure:"apiVersion"`

	// The set of named containers in the Workload. The container name must be a valid
	// RFC1123 Label Name of up to 63 characters, including a-z, 0-9, '-' but may not
	// start or end with '-'.
	Containers WorkloadContainers `json:"containers" yaml:"containers" mapstructure:"containers"`

	// The metadata description of the Workload.
	Metadata WorkloadMetadata `json:"metadata" yaml:"metadata" mapstructure:"metadata"`

	// The Resource dependencies needed by the Workload. The resource name must be a
	// valid RFC1123 Label Name of up to 63 characters, including a-z, 0-9, '-' but
	// may not start or end with '-'.
	Resources WorkloadResources `json:"resources,omitempty" yaml:"resources,omitempty" mapstructure:"resources,omitempty"`

	// The service that the workload provides.
	Service *WorkloadService `json:"service,omitempty" yaml:"service,omitempty" mapstructure:"service,omitempty"`
}

Score workload specification

func (*Workload) UnmarshalJSON added in v1.0.2

func (j *Workload) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type WorkloadContainers added in v1.0.2

type WorkloadContainers map[string]Container

The set of named containers in the Workload. The container name must be a valid RFC1123 Label Name of up to 63 characters, including a-z, 0-9, '-' but may not start or end with '-'.

type WorkloadMetadata added in v1.0.2

type WorkloadMetadata map[string]interface{}

The metadata description of the Workload.

func (*WorkloadMetadata) UnmarshalYAML added in v1.7.2

func (m *WorkloadMetadata) UnmarshalYAML(unmarshal func(interface{}) error) error

type WorkloadResources added in v1.0.2

type WorkloadResources map[string]Resource

The Resource dependencies needed by the Workload. The resource name must be a valid RFC1123 Label Name of up to 63 characters, including a-z, 0-9, '-' but may not start or end with '-'.

type WorkloadService added in v1.0.2

type WorkloadService struct {
	// The set of named network ports published by the service. The service name must
	// be a valid RFC1123 Label Name of up to 63 characters, including a-z, 0-9, '-'
	// but may not start or end with '-'.
	Ports WorkloadServicePorts `json:"ports,omitempty" yaml:"ports,omitempty" mapstructure:"ports,omitempty"`
}

The service that the workload provides.

type WorkloadServicePorts added in v1.0.2

type WorkloadServicePorts map[string]ServicePort

The set of named network ports published by the service. The service name must be a valid RFC1123 Label Name of up to 63 characters, including a-z, 0-9, '-' but may not start or end with '-'.

Jump to

Keyboard shortcuts

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