api

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const PodName string = "itzopod"
View Source
const (
	TerminationMessagePathDefault = "/dev/termination-log"
)

Variables

This section is empty.

Functions

func IsHostNetwork

func IsHostNetwork(securityContext *PodSecurityContext) bool

Types

type AttachParams

type AttachParams struct {
	PodName     string
	UnitName    string
	Interactive bool
	TTY         bool
}

type Capabilities

type Capabilities struct {
	// List of capabilities to add.
	Add []string `json:"add,omitempty"`
	// List of capabilities to drop.
	Drop []string `protobuf:"json:"drop,omitempty"`
}

Capability contains the capabilities to add or drop.

type ConfigMapProjection

type ConfigMapProjection struct {
	LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"`
	// If unspecified, each key-value pair in the Data field of the referenced
	// ConfigMap will be projected into the volume as a file whose name is the
	// key and content is the value. If specified, the listed keys will be
	// projected into the specified paths, and unlisted keys will not be
	// present. If a key is specified which is not present in the ConfigMap,
	// the volume setup will error unless it is marked optional. Paths must be
	// relative and may not contain the '..' path or start with '..'.
	// +optional
	Items []KeyToPath `json:"items,omitempty" protobuf:"bytes,2,rep,name=items"`
	// Specify whether the ConfigMap or its keys must be defined
	// +optional
	Optional *bool `json:"optional,omitempty" protobuf:"varint,4,opt,name=optional"`
}

Adapts a ConfigMap into a projected volume.

The contents of the target ConfigMap's Data field will be presented in a projected volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. Note that this is identical to a configmap volume source without the default mode.

type ConfigMapVolumeSource

type ConfigMapVolumeSource struct {
	LocalObjectReference `json:",inline"`
	// If unspecified, each key-value pair in the Data field of the referenced
	// ConfigMap will be projected into the volume as a file whose name is the
	// key and content is the value. If specified, the listed keys will be
	// projected into the specified paths, and unlisted keys will not be
	// present. If a key is specified which is not present in the ConfigMap,
	// the volume setup will error unless it is marked optional. Paths must be
	// relative and may not contain the '..' path or start with '..'.
	Items []KeyToPath `json:"items,omitempty"`
	// Optional: mode bits to use on created files by default. Must be a
	// value between 0 and 0777. Defaults to 0644.
	// Directories within the path are not affected by this setting.
	// This might be in conflict with other options that affect the file
	// mode, like fsGroup, and the result can be other mode bits set.
	DefaultMode *int32 `json:"defaultMode,omitempty"`
	// Specify whether the ConfigMap or its keys must be defined
	Optional *bool `json:"optional,omitempty"`
}

Adapts a ConfigMap into a volume.

The contents of the target ConfigMap's Data field will be presented in a volume as files using the keys in the Data field as the file names, unless the items element is populated with specific mappings of keys to paths. ConfigMap volumes support ownership management and SELinux relabeling.

type ContainerPort

type ContainerPort struct {
	// If specified, this must be an IANA_SVC_NAME and unique within the pod. Each
	// named port in a pod must have a unique name. Name for the port that can be
	// referred to by services.
	// +optional
	Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
	// Number of port to expose on the host.
	// If specified, this must be a valid port number, 0 < x < 65536.
	// If HostNetwork is specified, this must match ContainerPort.
	// Most containers do not need this.
	// +optional
	HostPort int32 `json:"hostPort,omitempty" protobuf:"varint,2,opt,name=hostPort"`
	// Number of port to expose on the pod's IP address.
	// This must be a valid port number, 0 < x < 65536.
	ContainerPort int32 `json:"containerPort" protobuf:"varint,3,opt,name=containerPort"`
	// Protocol for port. Must be UDP, TCP, or SCTP.
	// Defaults to "TCP".
	// +optional
	Protocol Protocol `json:"protocol,omitempty" protobuf:"bytes,4,opt,name=protocol,casttype=Protocol"`
	// What host IP to bind the external port to.
	// +optional
	HostIP string `json:"hostIP,omitempty" protobuf:"bytes,5,opt,name=hostIP"`
}

ContainerPort represents a network port in a single container.

type DNSPolicy

type DNSPolicy string

DNSPolicy defines how a pod's DNS will be configured.

const (
	// DNSClusterFirstWithHostNet indicates that the pod should use cluster DNS
	// first, if it is available, then fall back on the default
	// (as determined by kubelet) DNS settings.
	DNSClusterFirstWithHostNet DNSPolicy = "ClusterFirstWithHostNet"

	// DNSClusterFirst indicates that the pod should use cluster DNS
	// first unless hostNetwork is true, if it is available, then
	// fall back on the default (as determined by kubelet) DNS settings.
	DNSClusterFirst DNSPolicy = "ClusterFirst"

	// DNSDefault indicates that the pod should use the default (as
	// determined by kubelet) DNS settings.
	DNSDefault DNSPolicy = "Default"

	// DNSNone indicates that the pod should use empty DNS settings. DNS
	// parameters such as nameservers and search paths should be defined via
	// DNSConfig.
	DNSNone DNSPolicy = "None"
)

type EmptyDir

type EmptyDir struct {
	// Backing medium for the emptyDir. The default is "" (to use disk
	// space).  The other option is "Memory", for creating a tmpfs
	// volume.
	Medium StorageMedium `json:"medium,omitempty"`
	// SizeLimit is only meaningful for tmpfs. It is the size of the tmpfs
	// volume.
	SizeLimit int64 `json:"sizeLimit,omitempty"`
}

EmptyDir is is disk or memory-backed volume. Units can use it as scratch space, or for inter-unit communication (e.g. one unit fetching files into an emptyDir, another running a webserver, serving these static files from the emptyDir).

type EnvVar

type EnvVar struct {
	// Name of the environment variable.
	Name string `json:"name"`
	// Value of the environment variable.
	Value string `json:"value"`
	// An environment variable may also come from a secret.
	ValueFrom *EnvVarSource `json:"valueFrom,omitempty"`
}

Environment variables.

type EnvVarSource

type EnvVarSource struct {
	// Selector for the secret.
	SecretKeyRef *SecretKeySelector `json:"secretKeyRef,omitempty"`
}

EnvVarSource represents a source for the value of an EnvVar. Only one of its fields may be set.

type ExecAction

type ExecAction struct {
	// Command is the command line to execute inside the container,
	// the working directory for the command is root ('/') in the
	// container's filesystem. The command is simply exec'd, it is not
	// run inside a shell, so traditional shell instructions ('|',
	// etc) won't work. To use a shell, you need to explicitly call
	// out to that shell.  Exit status of 0 is treated as live/healthy
	// and non-zero is unhealthy.
	Command []string `json:"command,omitempty"`
}

ExecAction describes a "run in container" action.

type ExecParams

type ExecParams struct {
	PodName     string
	UnitName    string
	Command     []string
	Interactive bool
	TTY         bool
	SkipNSEnter bool
}

type HTTPGetAction

type HTTPGetAction struct {
	// Path to access on the HTTP server.
	Path string `json:"path,omitempty"`
	// Name or number of the port to access on the container.
	// Number must be in the range 1 to 65535.
	// Name must be an IANA_SVC_NAME.
	Port intstr.IntOrString `json:"port"`
	// Host name to connect to, defaults to the pod IP. You probably want to set
	// "Host" in httpHeaders instead.
	Host string `json:"host,omitempty"`
	// Scheme to use for connecting to the host.
	// Defaults to HTTP.
	Scheme URIScheme `json:"scheme,omitempty"`
	// Custom headers to set in the request. HTTP allows repeated headers.
	// +optional
	HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"`
}

HTTPGetAction describes an action based on HTTP Get requests.

type HTTPHeader

type HTTPHeader struct {
	// The header field name
	Name string `json:"name"`
	// The header field value
	Value string `json:"value"`
}

HTTPHeader describes a custom header to be used in HTTP probes

type Handler

type Handler struct {
	// One and only one of the following should be specified.
	// Exec specifies the action to take.
	Exec *ExecAction `json:"exec,omitempty"`
	// HTTPGet specifies the http request to perform.
	HTTPGet *HTTPGetAction `json:"httpGet,omitempty"`
	// TCPSocket specifies an action involving a TCP port.
	// TCP hooks not yet supported
	TCPSocket *TCPSocketAction `json:"tcpSocket,omitempty"`
}

Handler defines a specific action that should be taken

type HostAlias

type HostAlias struct {
	// IP address of the host file entry.
	IP string `json:"ip,omitempty"`
	// Hostnames for the above IP address.
	Hostnames []string `json:"hostnames,omitempty"`
}

HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file.

type HostPathType

type HostPathType string
const (
	// For backwards compatible, leave it empty if unset
	HostPathUnset HostPathType = ""
	// If nothing exists at the given path, an empty directory will be created there
	// as needed with file mode 0755, having the same group and ownership with Kubelet.
	HostPathDirectoryOrCreate HostPathType = "DirectoryOrCreate"
	// A directory must exist at the given path
	HostPathDirectory HostPathType = "Directory"
	// If nothing exists at the given path, an empty file will be created there
	// as needed with file mode 0644, having the same group and ownership with Kubelet.
	HostPathFileOrCreate HostPathType = "FileOrCreate"
	// A file must exist at the given path
	HostPathFile HostPathType = "File"
	// A UNIX socket must exist at the given path
	HostPathSocket HostPathType = "Socket"
	// A character device must exist at the given path
	HostPathCharDev HostPathType = "CharDevice"
	// A block device must exist at the given path
	HostPathBlockDev HostPathType = "BlockDevice"
)

type HostPathVolumeSource

type HostPathVolumeSource struct {
	// Path of the directory on the host.
	// If the path is a symlink, it will follow the link to the real path.
	// More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
	Path string `json:"path" protobuf:"bytes,1,opt,name=path"`
	// Type for HostPath Volume
	// Defaults to ""
	// More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
	// +optional
	Type *HostPathType `json:"type,omitempty" protobuf:"bytes,2,opt,name=type"`
}

Represents a host path mapped into a pod. Host path volumes do not support ownership management or SELinux relabeling.

type KeyToPath

type KeyToPath struct {
	// The key to project.
	Key string `json:"key" protobuf:"bytes,1,opt,name=key"`

	// The relative path of the file to map the key to.
	// May not be an absolute path.
	// May not contain the path element '..'.
	// May not start with the string '..'.
	Path string `json:"path"`
	// Optional: mode bits to use on this file, must be a value between 0
	// and 0777. If not specified, the volume defaultMode will be used.
	// This might be in conflict with other options that affect the file
	// mode, like fsGroup, and the result can be other mode bits set.
	Mode *int32 `json:"mode,omitempty"`
}

Maps a string key to a path within a volume.

type LocalObjectReference

type LocalObjectReference struct {
	//TODO: Add other useful fields.  apiVersion, kind, uid?
	Name string `json:"name,omitempty"`
}

LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.

type NamespaceMode

type NamespaceMode int32
const (
	// A POD namespace is common to all containers in a pod.
	// For example, a container with a PID namespace of POD expects to view
	// all of the processes in all of the containers in the pod.
	NamespaceModePod NamespaceMode = 0
	// A CONTAINER namespace is restricted to a single container.
	// For example, a container with a PID namespace of CONTAINER expects to
	// view only the processes in that container.
	NamespaceModeContainer NamespaceMode = 1
	// A NODE namespace is the namespace of the Kubernetes node.
	// For example, a container with a PID namespace of NODE expects to view
	// all of the processes on the host running the kubelet.
	NamespaceModeNode NamespaceMode = 2
)

type NamespaceOption

type NamespaceOption struct {
	// Network namespace for this container/sandbox.
	// Note: There is currently no way to set CONTAINER scoped network in the Kubernetes API.
	// Namespaces currently set by the kubelet: POD, NODE
	Network NamespaceMode `json:"network,omitempty"`
	// PID namespace for this container/sandbox.
	// Note: The CRI default is POD, but the v1.PodSpec default is CONTAINER.
	// The kubelet's runtime manager will set this to CONTAINER explicitly for v1 pods.
	// Namespaces currently set by the kubelet: POD, CONTAINER, NODE
	Pid NamespaceMode `json:"pid,omitempty"`
	// IPC namespace for this container/sandbox.
	// Note: There is currently no way to set CONTAINER scoped IPC in the Kubernetes API.
	// Namespaces currently set by the kubelet: POD, NODE
	Ipc NamespaceMode `json:"ipc,omitempty"`
}

NamespaceOption provides options for Linux namespaces.

type PackagePath

type PackagePath struct {
	// Path of the directory or file on the host.
	Path string `json:"path"`
}

Source for a file or directory from a package that will be mapped into the rootfs of a unit.

type PlacementSpec

type PlacementSpec struct {
	AvailabilityZone string `json:"availabilityZone,omitempty"`
}

type PodDNSConfig

type PodDNSConfig struct {
	// A list of DNS name server IP addresses.
	// This will be appended to the base nameservers generated from DNSPolicy.
	// Duplicated nameservers will be removed.
	// +optional
	Nameservers []string `json:"nameservers,omitempty"`
	// A list of DNS search domains for host-name lookup.
	// This will be appended to the base search paths generated from DNSPolicy.
	// Duplicated search paths will be removed.
	// +optional
	Searches []string `json:"searches,omitempty"`
	// A list of DNS resolver options.
	// This will be merged with the base options generated from DNSPolicy.
	// Duplicated entries will be removed. Resolution options given in Options
	// will override those that appear in the base DNSPolicy.
	// +optional
	Options []PodDNSConfigOption `json:"options,omitempty"`
}

PodDNSConfig defines the DNS parameters of a pod in addition to those generated from DNSPolicy.

type PodDNSConfigOption

type PodDNSConfigOption struct {
	// Required.
	Name string `json:"name,omitempty"`
	// +optional
	Value *string `json:"value,omitempty"`
}

PodDNSConfigOption defines DNS resolver options of a pod.

type PodParameters

type PodParameters struct {
	Secrets     map[string]map[string][]byte   `json:"secrets"`
	Credentials map[string]RegistryCredentials `json:"credentials"`
	Spec        PodSpec                        `json:"spec"`
	Annotations map[string]string
	PodName     string
	NodeName    string
	PodIP       string
	PodHostname string
}

type PodPhase

type PodPhase string

Phase is the last observed phase of the pod. Can be "creating", "dispatching", "running", "succeeded", "failed" or "terminated".

const (
	// PodWaiting means that we're waiting for the pod to begin running.
	PodWaiting PodPhase = "Waiting"
	// PodDispatching means that we have a node to put this pod on
	// and we're in the process of starting the app on the node
	PodDispatching PodPhase = "Dispatching"
	// PodRunning means that the pod is up and running.
	PodRunning PodPhase = "Running"
	// Pod succeeded means all the units in the pod returned success. It is a
	// terminal phase, i.e. the final phase when a pod finished. Once the pod
	// finished, Spec.Phase and Status.Phase are the same.
	PodSucceeded PodPhase = "Succeeded"
	// Pod has failed, either a unit failed, or some other problem occurred
	// (e.g. dispatch error). This is a terminal phase.
	PodFailed PodPhase = "Failed"
	// PodTerminated means that the pod has stopped by request. It is a
	// terminal phase.
	PodTerminated PodPhase = "Terminated"
)

type PodSecurityContext

type PodSecurityContext struct {
	// PID, IPC and network namespace sharing options.
	NamespaceOptions *NamespaceOption `json:"namespaceOptions,omitempty"`
	// UID to run pod processes as.
	RunAsUser *int64 `json:"runAsUser,omitempty"`
	// GID to run pod processes as.
	RunAsGroup *int64 `json:"runAsGroup,omitempty"`
	// List of groups applied to the first process run in the sandbox, in
	// addition to the pod's primary GID.
	SupplementalGroups []int64 `json:"supplementalGroups,omitempty"`
	// Set these sysctls in the pod.
	Sysctls []Sysctl `json:"sysctls,omitempty"`
}

type PodSpec

type PodSpec struct {
	// Desired condition of the Pod.
	Phase PodPhase `json:"phase"`
	// Restart policy for all Units in this Pod. It can be "always",
	// "onFailure" or "never". Default is "always". The restartPolicy
	// applies to all Units in the Pod. Exited Units are restarted
	// with an exponential back-off delay (10s, 20s, 40s …) capped at
	// five minutes, the delay is reset after 10 minutes.
	RestartPolicy RestartPolicy `json:"restartPolicy"`
	// List of Units that together compose this Pod.
	Units []Unit `json:"units"`
	// Init Units. They are run in order, one at a time before regular Units
	// are started.
	InitUnits []Unit `json:"initUnits"`
	// List of Secrets that will be used for authenticating when pulling
	// images.
	ImagePullSecrets []string `json:"imagePullSecrets,omitemtpy"`
	// Type of cloud instance type that will be used to run this Pod.
	InstanceType string `json:"instanceType,omitempty"`
	// PodSpot is the policy that determines if a spot instance may be used for
	// a Pod.
	Spot PodSpot `json:"spot,omitempty"`
	// Resource requirements for the Node that will run this Pod. If both
	// instanceType and resources are specified, instanceType will take
	// precedence.
	Resources ResourceSpec `json:"resources,omitempty"`
	// Placement is used to specify where a Pod will be place in the
	// infrastructure.
	Placement PlacementSpec `json:"placement,omitempty"`
	// List of volumes that will be made available to the Pod. Units can then
	// attach any of these mounts.
	Volumes []Volume `json:"volumes,omitempty"`
	// Pod security context.
	SecurityContext *PodSecurityContext `json:"securityContext,omitempty"`
	// Pod DNS policy.
	DNSPolicy DNSPolicy `json:"dnsPolicy,omitempty"`
	// Pod DNS config.
	DNSConfig *PodDNSConfig `json:"dnsConfig,omitempty"`
	// Specifies the hostname of the Pod
	// If not specified, the pod's hostname will be set to a system-defined value.
	// +optional
	Hostname string `json:"hostname,omitempty"`
	// If specified, the fully qualified Pod hostname will be "<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>".
	// If not specified, the pod will not have a domainname at all.
	// +optional
	Subdomain string `json:"subdomain,omitempty"`
	// HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts
	// file if specified. This is only valid for non-hostNetwork pods.
	// +optional
	// +patchMergeKey=ip
	// +patchStrategy=merge
	HostAliases []HostAlias `json:"hostAliases,omitempty" patchStrategy:"merge" patchMergeKey:"ip"`
}

type PodSpot

type PodSpot struct {
	// Spot policy. Can be "always", "preferred" or "never", meaning to always
	// use a spot instance, use one when available, or never use a spot
	// instance for running a pod.
	Policy SpotPolicy `json:"policy"`
}

PodSpot is the policy that determines if a spot instance may be used for a pod.

type PodStatusReply

type PodStatusReply struct {
	UnitStatuses     []UnitStatus    `json:"unitStatus"`
	InitUnitStatuses []UnitStatus    `json:"initUnitStatus"`
	ResourceUsage    ResourceMetrics `json:"resourceUsage,omitempty"`
	PodIP            string          `json:"podIP"`
}

type PortForwardParams

type PortForwardParams struct {
	PodName string
	Port    string
}

type Probe

type Probe struct {
	// The action taken to determine the health of a container
	Handler `json:",inline"`
	// Number of seconds after the container has started before
	// liveness probes are initiated.  More info:
	// https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
	InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
	// Number of seconds after which the probe times out.  Defaults to
	// 1 second. Minimum value is 1.  More info:
	// https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
	TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"`
	// How often (in seconds) to perform the probe.  Default to 10
	// seconds. Minimum value is 1.
	PeriodSeconds int32 `json:"periodSeconds,omitempty"`
	// Minimum consecutive successes for the probe to be considered
	// successful after having failed.  Defaults to 1. Must be 1 for
	// liveness. Minimum value is 1.
	SuccessThreshold int32 `json:"successThreshold,omitempty"`
	// Minimum consecutive failures for the probe to be considered
	// failed after having succeeded.  Defaults to 3. Minimum value is
	// 1.
	FailureThreshold int32 `json:"failureThreshold,omitempty"`
}

Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.

type ProjectedVolumeSource

type ProjectedVolumeSource struct {
	// list of volume projections
	Sources []VolumeProjection `json:"sources"`
	// Mode bits to use on created files by default. Must be a value between
	// 0 and 0777.
	// Directories within the path are not affected by this setting.
	// This might be in conflict with other options that affect the file
	// mode, like fsGroup, and the result can be other mode bits set.
	// +optional
	DefaultMode *int32 `json:"defaultMode,omitempty"`
}

Represents a projected volume source

type Protocol

type Protocol string

Protocol defines network protocols supported for things like ports.

const (
	ProtocolTCP  Protocol = "TCP"
	ProtocolUDP  Protocol = "UDP"
	ProtocolICMP Protocol = "ICMP"
)

func MakeProtocol

func MakeProtocol(p string) Protocol

type RegistryCredentials

type RegistryCredentials struct {
	Server   string `json:"server"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type ResourceMetrics

type ResourceMetrics map[string]float64

type ResourceSpec

type ResourceSpec struct {
	// The number of cpus on the instance.  Can be a float to
	// accomodate shared cpu instance types (e.g. 0.5)
	CPU string `json:"cpu"`
	// The amount of memory on the instance in gigabytes. For AWS this
	// is in GB and for GCE this is in GiB.
	Memory string `json:"memory"`
	// Number of GPUs present on the instance.
	GPU string `json:"gpu"`
	// Root volume size in GB. All units will share this disk.
	VolumeSize string `json:"volumeSize"`
	// Request an instance with dedicated or non-shared CPU. For AWS
	// T2 instances have a shared CPU, all other instance families
	// have a dedicated CPU.  Set dedicatedCPU to true if you do
	// not want Milpa to consider using a T2 instance for your pod.
	DedicatedCPU bool `json:"dedicatedCPU"`
	// Request unlimited CPU for T2 shared instance in AWS Only
	// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html
	SustainedCPU *bool `json:"sustainedCPU,omitempty"`
	// If PrivateIPOnly is true, the pod will be launched on a node
	// without a public IP address.  By default the pod will run on
	// a node with a public IP address
	PrivateIPOnly bool `json:"privateIPOnly"`
}

ResourceSpec is used to specify resource requirements for the node that will run a pod.

type RestartPolicy

type RestartPolicy string

Restart policy for all units in this pod. It can be "always", "onFailure" or "never". Default is "always".

const (
	RestartPolicyAlways    RestartPolicy = "Always"
	RestartPolicyOnFailure RestartPolicy = "OnFailure"
	RestartPolicyNever     RestartPolicy = "Never"
)

type RunCmdParams

type RunCmdParams struct {
	Command []string
}

type SecretKeySelector

type SecretKeySelector struct {
	// The name of the secret in the pod's namespace to select from.
	Name string `json:"name"`
	// The key of the secret to select from.  Must be a valid secret key.
	Key string `json:"key"`
}

SecretKeySelector selects a key of a Secret.

type SecretProjection

type SecretProjection struct {
	LocalObjectReference `json:",inline" protobuf:"bytes,1,opt,name=localObjectReference"`
	// If unspecified, each key-value pair in the Data field of the referenced
	// Secret will be projected into the volume as a file whose name is the
	// key and content is the value. If specified, the listed keys will be
	// projected into the specified paths, and unlisted keys will not be
	// present. If a key is specified which is not present in the Secret,
	// the volume setup will error unless it is marked optional. Paths must be
	// relative and may not contain the '..' path or start with '..'.
	// +optional
	Items []KeyToPath `json:"items,omitempty" protobuf:"bytes,2,rep,name=items"`
	// Specify whether the Secret or its key must be defined
	// +optional
	Optional *bool `json:"optional,omitempty" protobuf:"varint,4,opt,name=optional"`
}

Adapts a secret into a projected volume.

The contents of the target Secret's Data field will be presented in a projected volume as files using the keys in the Data field as the file names. Note that this is identical to a secret volume source without the default mode.

type SecretVolumeSource

type SecretVolumeSource struct {
	// Name of the secret in the pod's namespace to use.
	// More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
	// +optional
	SecretName string `json:"secretName,omitempty"`
	// If unspecified, each key-value pair in the Data field of the referenced
	// Secret will be projected into the volume as a file whose name is the
	// key and content is the value. If specified, the listed keys will be
	// projected into the specified paths, and unlisted keys will not be
	// present. If a key is specified which is not present in the Secret,
	// the volume setup will error unless it is marked optional. Paths must be
	// relative and may not contain the '..' path or start with '..'.
	Items []KeyToPath `json:"items,omitempty"`
	// Optional: mode bits to use on created files by default. Must be a
	// value between 0 and 0777. Defaults to 0644.
	// Directories within the path are not affected by this setting.
	// This might be in conflict with other options that affect the file
	// mode, like fsGroup, and the result can be other mode bits set.
	DefaultMode *int32 `json:"defaultMode,omitempty"`
	// Specify whether the Secret or its keys must be defined
	Optional *bool `json:"optional,omitempty"`
}

Adapts a Secret into a volume.

The contents of the target Secret's Data field will be presented in a volume as files using the keys in the Data field as the file names.

type SecurityContext

type SecurityContext struct {
	// Capabilities to add or drop.
	Capabilities *Capabilities `json:"capabilities,omitempty"`
	// UID to run unit processes as.
	RunAsUser *int64 `json:"runAsUser,omitempty"`
	// Username to run unit processes as.
	RunAsGroup *int64 `json:"runAsGroup,omitempty"`
}

Optional security context that overrides whatever is set for the pod.

Example yaml:

securityContext:

capabilities:
  add:
  - NET_BIND_SERVICE
  drop:
  - ALL

type SpotPolicy

type SpotPolicy string

Spot policy. Can be "always", "preferred" or "never", meaning to always use a spot instance, use one when available, or never use a spot instance for running a pod.

const (
	SpotAlways    SpotPolicy = "Always"
	SpotPreferred SpotPolicy = "Preferred"
	SpotNever     SpotPolicy = "Never"
)

type StorageMedium

type StorageMedium string

Backing storage for volumes.

const (
	StorageMediumDefault StorageMedium = ""       // Use default (disk).
	StorageMediumMemory  StorageMedium = "Memory" // Use tmpfs.

)

type Sysctl

type Sysctl struct {
	// Name of a property to set.
	Name string `json:"name"`
	// Value of a property to set.
	Value string `json:"value"`
}

Sysctl defines a kernel parameter to be set.

type TCPSocketAction

type TCPSocketAction struct {
	// Number or name of the port to access on the container.
	// Number must be in the range 1 to 65535.
	// Name must be an IANA_SVC_NAME.
	Port intstr.IntOrString `json:"port"`
	// Optional: Host name to connect to, defaults to the pod IP.
	// +optional
	Host string `json:"host,omitempty"`
}

TCPSocketAction describes an action based on opening a socket

type TerminationMessagePolicy

type TerminationMessagePolicy string
const (
	// TerminationMessageReadFile is the default behavior and will set
	// the container status message to the contents of the container's
	// terminationMessagePath when the container exits.
	TerminationMessageReadFile TerminationMessagePolicy = "File"
	// TerminationMessageFallbackToLogsOnError will read the most
	// recent contents of the container logs for the container status
	// message when the container exits with an error and the
	// terminationMessagePath has no contents.
	TerminationMessageFallbackToLogsOnError TerminationMessagePolicy = "FallbackToLogsOnError"
)

type Time

type Time struct {
	time.Time
}

Time is a wrapper around time.Time which supports correct marshaling to YAML and JSON. Wrappers are provided for many of the factory methods that the time package offers.

func Date

func Date(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) Time

Date returns the Time corresponding to the supplied parameters by wrapping time.Date.

func Now

func Now() Time

Now returns the current local time.

func Unix

func Unix(sec int64, nsec int64) Time

Unix returns the local time corresponding to the given Unix time by wrapping time.Unix.

func (Time) GetYAML

func (t Time) GetYAML() (tag string, value interface{})

GetYAML implements the yaml.Getter interface.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Time) Rfc3339Copy

func (t Time) Rfc3339Copy() Time

Rfc3339Copy returns a copy of the Time at second-level precision.

func (*Time) SetYAML

func (t *Time) SetYAML(tag string, value interface{}) bool

SetYAML implements the yaml.Setter interface.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller interface.

type URIScheme

type URIScheme string

URIScheme identifies the scheme used for connection to a host for Get actions

const (
	// URISchemeHTTP means that the scheme used will be http://
	URISchemeHTTP URIScheme = "HTTP"
	// URISchemeHTTPS means that the scheme used will be https://
	URISchemeHTTPS URIScheme = "HTTPS"
)

type Unit

type Unit struct {
	// Name of the unit.
	Name string `json:"name"`
	// The docker image that will be pulled for this unit. Usual docker
	// conventions are used to specify an image, see
	// **[https://docs.docker.com/engine/reference/commandline/tag/#extended-description](https://docs.docker.com/engine/reference/commandline/tag/#extended-description)**
	// for a detailed explanation on specifying an image.
	//
	// Examples:
	//
	// - `library/python:3.6-alpine`
	//
	// - `myregistry.local:5000/testing/test-image`
	//
	Image string `json:"image"`
	// The command that will be run to start the unit. If empty, the entrypoint
	// of the image will be used. See
	// https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell
	Command []string `json:"command"`
	// Arguments to the command. If empty, the cmd from the image will be used.
	Args []string `json:"args"`
	// List of environment variables that will be exported inside the unit
	// before start the application.
	Env []EnvVar `json:"env"`
	// A list of volumes that will be attached in the unit.
	VolumeMounts []VolumeMount `json:"volumeMounts,omitempty"`
	// A list of ports that will be opened up for this unit.
	Ports []ContainerPort `json:"ports,omitempty"`
	// Working directory to change to before running the command for the unit.
	WorkingDir string `json:"workingDir,omitempty"`
	// Unit security context.
	SecurityContext *SecurityContext `json:"securityContext,omitempty"`
	// Periodic probe of container liveness.  Container will be
	// restarted if the probe fails.  Cannot be updated.  More info:
	// https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
	LivenessProbe *Probe `json:"livenessProbe,omitempty"`
	// Periodic probe of container service readiness.  Container will
	// be removed from service endpoints if the probe fails.  Cannot
	// be updated.  More info:
	// https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
	ReadinessProbe *Probe `json:"readinessProbe,omitempty"`
	//StartupProbe indicates that the Pod has successfully
	//initialized. If specified, no other probes are executed until
	//this completes successfully.
	StartupProbe *Probe `json:"startupProbe,omitempty"`

	// Optional: Path at which the file to which the container's
	// termination message will be written is mounted into the
	// container's filesystem.  Message written is intended to be
	// brief final status, such as an assertion failure message.  Will
	// be truncated by the node if greater than 4096 bytes. The total
	// message length across all containers will be limited to 12kb.
	// Defaults to /dev/termination-log.  Cannot be updated.
	TerminationMessagePath string `json:"terminationMessagePath,omitempty"`

	// Indicate how the termination message should be populated. File
	// will use the contents of terminationMessagePath to populate the
	// container status message on both success and failure.
	// FallbackToLogsOnError will use the last chunk of container log
	// output if the termination message file is empty and the
	// container exited with an error.  The log output is limited to
	// 2048 bytes or 80 lines, whichever is smaller.  Defaults to
	// File.  Cannot be updated.
	TerminationMessagePolicy TerminationMessagePolicy `json:"terminationMessagePolicy,omitempty"`
}

Units run applications. A pod consists of one or more units.

type UnitState

type UnitState struct {
	Waiting    *UnitStateWaiting    `json:"waiting,omitempty"`
	Running    *UnitStateRunning    `json:"running,omitempty"`
	Terminated *UnitStateTerminated `json:"terminated,omitempty"`
}

UnitState holds a possible state of a pod unit. Only one of its members may be specified. If none of them is specified, the default one is UnitStateRunning.

type UnitStateRunning

type UnitStateRunning struct {
	StartedAt Time `json:"startedAt,omitempty"`
}

type UnitStateTerminated

type UnitStateTerminated struct {
	ExitCode   int32  `json:"exitCode"`
	FinishedAt Time   `json:"finishedAt,omitempty"`
	Reason     string `json:"reason,omitempty"`
	Message    string `json:"message,omitempty"`
	StartedAt  Time   `json:"startedAt,omitempty"`
}

type UnitStateWaiting

type UnitStateWaiting struct {
	Reason       string `json:"reason"`
	StartFailure bool   `json:"startFailure"`
}

type UnitStatus

type UnitStatus struct {
	Name                 string    `json:"name"`
	State                UnitState `json:"state,omitempty"`
	LastTerminationState UnitState `json:"lastState,omitempty"`
	RestartCount         int32     `json:"restartCount"`
	Image                string    `json:"image"`
	Ready                bool      `json:"ready"`
	Started              *bool     `json:"started"`
}

func MakeFailedUpdateStatus added in v1.2.0

func MakeFailedUpdateStatus(name, image, reason string) *UnitStatus

func MakeStillCreatingStatus added in v1.2.0

func MakeStillCreatingStatus(name, image, reason string) *UnitStatus

type Volume

type Volume struct {
	// Name of the volume. This is used when referencing a volume from a unit
	// definition.
	Name         string `json:"name"`
	VolumeSource `json:",inline,omitempty"`
}

Defintion for volumes.

type VolumeMount

type VolumeMount struct {
	// Name of the volume to attach.
	Name string `json:"name"`
	// Path where this volume will be attached inside the unit.
	MountPath string `json:"mountPath"`
	// Path within the volume from which the container's volume should be mounted.
	// Defaults to "" (volume's root).
	// +optional
	SubPath string `json:"subPath,omitempty" protobuf:"bytes,4,opt,name=subPath"`
}

VolumeMount specifies what volumes to attach to the unit and the path where they will be located inside the unit.

type VolumeProjection

type VolumeProjection struct {

	// information about the secret data to project
	// +optional
	Secret *SecretProjection `json:"secret,omitempty"`
	// // information about the downwardAPI data to project
	// // +optional
	// DownwardAPI *DownwardAPIProjection `json:"downwardAPI,omitempty"`
	// information about the configMap data to project
	// +optional
	ConfigMap *ConfigMapProjection `json:"configMap,omitempty"`
}

Projection that may be projected along with other supported volume types

type VolumeSource

type VolumeSource struct {
	// If specified, an emptyDir will be created to back this volume.
	EmptyDir *EmptyDir `json:"emptyDir,omitempty"`
	// This is a file or directory from a package that will be mapped into the
	// rootfs of a unit.
	PackagePath *PackagePath `json:"packagePath,omitempty"`
	// ConfigMap represents a configMap that should populate this volume
	ConfigMap *ConfigMapVolumeSource `json:"configMap,omitempty"`
	// Secret represents a secret that should populate this volume.
	// More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
	// +optional
	Secret *SecretVolumeSource `json:"secret,omitempty"`
	// HostPath represents a pre-existing file or directory on the host
	// machine that is directly exposed to the container. This is generally
	// used for system agents or other privileged things that are allowed
	// to see the host machine. Most containers will NOT need this.
	// More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
	// +optional
	HostPath *HostPathVolumeSource `json:"hostPath,omitempty"`
	// Items for all in one resources secrets, configmaps, and downward API
	Projected *ProjectedVolumeSource `json:"projected,omitempty"`
}

Jump to

Keyboard shortcuts

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