specs

package
v0.0.0-...-666b07d Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortKeysForFiles

func SortKeysForFiles(f map[string]string) []string

SortKeysForFiles returns a slice of all the keys for a given files map sorted in increasing order as per sort.String

Types

type ConfigMap

type ConfigMap map[string]string

ConfigMap describes the format of configmap resource.

type ContainerConfig

type ContainerConfig map[string]interface{}

ContainerConfig describes the config used for setting up a pod container's environment variables.

type ContainerPort

type ContainerPort struct {
	Name          string `json:"name,omitempty" yaml:"name,omitempty"`
	ContainerPort int32  `json:"containerPort" yaml:"containerPort"`
	Protocol      string `json:"protocol" yaml:"protocol"`
}

ContainerPort defines a port on a container.

type ContainerSpec

type ContainerSpec struct {
	Name string `json:"name" yaml:"name"`
	Init bool   `json:"init,omitempty" yaml:"init,omitempty"`
	// Image is deprecated in preference to using ImageDetails.
	Image        string          `json:"image,omitempty" yaml:"image,omitempty"`
	ImageDetails ImageDetails    `json:"imageDetails" yaml:"imageDetails"`
	Ports        []ContainerPort `json:"ports,omitempty" yaml:"ports,omitempty"`

	Command    []string `json:"command,omitempty" yaml:"command,omitempty"`
	Args       []string `json:"args,omitempty" yaml:"args,omitempty"`
	WorkingDir string   `json:"workingDir,omitempty" yaml:"workingDir,omitempty"`

	EnvConfig    ContainerConfig `json:"envConfig,omitempty" yaml:"envConfig,omitempty"`
	VolumeConfig []FileSet       `json:"volumeConfig,omitempty" yaml:"volumeConfig,omitempty"`

	ImagePullPolicy PullPolicy `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"`

	// ProviderContainer defines config which is specific to a substrate, eg k8s
	ProviderContainer `json:"-" yaml:"-"`
}

ContainerSpec defines the data values used to configure a container on the CAAS substrate.

func (*ContainerSpec) Validate

func (spec *ContainerSpec) Validate() error

Validate is defined on ProviderContainer.

type ContainerSpecV2

type ContainerSpecV2 struct {
	Name string `json:"name" yaml:"name"`
	Init bool   `json:"init,omitempty" yaml:"init,omitempty"`
	// Image is deprecated in preference to using ImageDetails.
	Image        string          `json:"image,omitempty" yaml:"image,omitempty"`
	ImageDetails ImageDetails    `json:"imageDetails" yaml:"imageDetails"`
	Ports        []ContainerPort `json:"ports,omitempty" yaml:"ports,omitempty"`

	Command    []string `json:"command,omitempty" yaml:"command,omitempty"`
	Args       []string `json:"args,omitempty" yaml:"args,omitempty"`
	WorkingDir string   `json:"workingDir,omitempty" yaml:"workingDir,omitempty"`

	Config ContainerConfig `json:"config,omitempty" yaml:"config,omitempty"`
	Files  []FileSetV2     `json:"files,omitempty" yaml:"files,omitempty"`

	ImagePullPolicy PullPolicy `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"`

	// ProviderContainer defines config which is specific to a substrate, eg k8s
	ProviderContainer `json:"-" yaml:"-"`
}

ContainerSpecV2 defines the data values used to configure a container on the CAAS substrate.

func (*ContainerSpecV2) Validate

func (spec *ContainerSpecV2) Validate() error

Validate is defined on ProviderContainer.

type EmptyDirVol

type EmptyDirVol struct {
	Medium    string             `json:"medium,omitempty" yaml:"medium,omitempty"`
	SizeLimit *resource.Quantity `json:"sizeLimit,omitempty" yaml:"sizeLimit,omitempty"`
}

EmptyDirVol represents an empty directory for a pod.

func (*EmptyDirVol) Validate

func (edv *EmptyDirVol) Validate(name string) error

Validate validates EmptyDirVol.

type File

type File struct {
	Path    string `json:"path" yaml:"path"`
	Content string `json:"content" yaml:"content"`
	Mode    *int32 `json:"mode,omitempty" yaml:"mode,omitempty"`
}

File describes a file to mount into a pod.

func (*File) Validate

func (f *File) Validate(name string) error

Validate validates File.

type FileRef

type FileRef struct {
	Key  string `json:"key" yaml:"key"`
	Path string `json:"path" yaml:"path"`
	Mode *int32 `json:"mode,omitempty" yaml:"mode,omitempty"`
}

FileRef describes a file to mount into a pod.

func (*FileRef) Validate

func (f *FileRef) Validate(name string) error

Validate validates FileRef.

type FileSet

type FileSet struct {
	VolumeSource `json:",inline" yaml:",inline"`
	Name         string `json:"name" yaml:"name"`
	MountPath    string `json:"mountPath" yaml:"mountPath"`
}

FileSet defines a set of files to mount into the container.

func (FileSet) Equal

func (fs FileSet) Equal(another FileSet) bool

Equal compares if two FileSet are same.

func (FileSet) EqualVolume

func (fs FileSet) EqualVolume(another FileSet) bool

EqualVolume checks if two fileset definitions will create same volume.

func (*FileSet) Validate

func (fs *FileSet) Validate() error

Validate validates FileSet.

type FileSetV2

type FileSetV2 struct {
	Name      string            `json:"name" yaml:"name"`
	MountPath string            `json:"mountPath" yaml:"mountPath"`
	Files     map[string]string `json:"files" yaml:"files"`
}

FileSetV2 defines a set of files to mount into the container.

func (*FileSetV2) Validate

func (fs *FileSetV2) Validate() error

Validate validates FileSetV2.

type HostPathVol

type HostPathVol struct {
	Path string `json:"path" yaml:"path"`
	Type string `json:"type,omitempty" yaml:"type,omitempty"`
}

HostPathVol represents a host path mapped into a pod.

func (*HostPathVol) Validate

func (hpv *HostPathVol) Validate(name string) error

Validate validates HostPathVol.

type ImageDetails

type ImageDetails struct {
	ImagePath string `json:"imagePath" yaml:"imagePath"`
	Username  string `json:"username,omitempty" yaml:"username,omitempty"`
	Password  string `json:"password,omitempty" yaml:"password,omitempty"`
}

ImageDetails defines all details required to pull a docker image from any registry

type IntOrString

type IntOrString struct {
	Type   Type   `json:"type"`
	IntVal int32  `json:"intVal,omitempty"`
	StrVal string `json:"strVal,omitempty"`
}

IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. It is ported from k8s.io/apimachinery/pkg/util/intstr/intstr.go to avoid introducing k8s dependency in top level package.

func (*IntOrString) IntValue

func (intstr *IntOrString) IntValue() int

IntValue returns the IntVal if type Int, or if it is a String, will attempt a conversion to int.

func (IntOrString) MarshalJSON

func (intstr IntOrString) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface.

func (*IntOrString) String

func (intstr *IntOrString) String() string

String returns the string value, or the Itoa of the int value.

func (*IntOrString) UnmarshalJSON

func (intstr *IntOrString) UnmarshalJSON(value []byte) error

UnmarshalJSON implements the json.Unmarshaller interface.

type PodSpec

type PodSpec = PodSpecV3

PodSpec is the current version of pod spec.

type PodSpecLegacy

type PodSpecLegacy struct {
	// contains filtered or unexported fields
}

PodSpecLegacy defines the legacy version of data values used to configure a pod on the CAAS substrate.

func (*PodSpecLegacy) Validate

func (spec *PodSpecLegacy) Validate() error

Validate returns an error if the spec is not valid.

type PodSpecV2

type PodSpecV2 struct {
	ServiceAccount *ServiceAccountSpecV2 `json:"serviceAccount,omitempty" yaml:"serviceAccount,omitempty"`
	// contains filtered or unexported fields
}

PodSpecV2 defines the data values used to configure a pod on the CAAS substrate for version 2.

func (*PodSpecV2) Validate

func (spec *PodSpecV2) Validate() error

Validate returns an error if the spec is not valid.

type PodSpecV3

type PodSpecV3 struct {
	ServiceAccount *PrimeServiceAccountSpecV3 `json:"serviceAccount,omitempty" yaml:"serviceAccount,omitempty"`
	// contains filtered or unexported fields
}

PodSpecV3 defines the data values used to configure a pod on the CAAS substrate for version 3.

func (*PodSpecV3) Validate

func (spec *PodSpecV3) Validate() error

Validate returns an error if the spec is not valid.

type PodSpecVersion

type PodSpecVersion struct {
	Version Version `json:"version,omitempty" yaml:"version,omitempty"`
}

PodSpecVersion indicates the version of the podspec.

type PolicyRule

type PolicyRule struct {
	Verbs           []string `json:"verbs" yaml:"verbs"`
	APIGroups       []string `json:"apiGroups,omitempty" yaml:"apiGroups,omitempty"`
	Resources       []string `json:"resources,omitempty" yaml:"resources,omitempty"`
	ResourceNames   []string `json:"resourceNames,omitempty" yaml:"resourceNames,omitempty"`
	NonResourceURLs []string `json:"nonResourceURLs,omitempty" yaml:"nonResourceURLs,omitempty"`
}

PolicyRule defines a rule policy for a role or cluster role.

type PrimeServiceAccountSpecV3

type PrimeServiceAccountSpecV3 struct {
	ServiceAccountSpecV3 `json:",inline" yaml:",inline"`
	// contains filtered or unexported fields
}

PrimeServiceAccountSpecV3 defines spec for creating the prime RBAC resources for version 3.

func (PrimeServiceAccountSpecV3) GetName

func (psa PrimeServiceAccountSpecV3) GetName() string

GetName returns the service accout name.

func (*PrimeServiceAccountSpecV3) SetName

func (psa *PrimeServiceAccountSpecV3) SetName(name string)

SetName sets the service accout name.

func (PrimeServiceAccountSpecV3) Validate

func (psa PrimeServiceAccountSpecV3) Validate() error

Validate returns an error if the spec is not valid.

type ProviderContainer

type ProviderContainer interface {
	Validate() error
}

ProviderContainer defines a provider specific container.

type ProviderPod

type ProviderPod interface {
	Validate() error
}

ProviderPod defines a provider specific pod.

type PullPolicy

type PullPolicy string

PullPolicy describes a policy for if/when to pull a container image.

type ResourceRefVol

type ResourceRefVol struct {
	Name        string    `json:"name" yaml:"name"`
	Files       []FileRef `json:"files,omitempty" yaml:"files,omitempty"`
	DefaultMode *int32    `json:"defaultMode,omitempty" yaml:"defaultMode,omitempty"`
}

ResourceRefVol reprents a configmap or secret source could be referenced by a volume.

func (*ResourceRefVol) Validate

func (rrv *ResourceRefVol) Validate(name string) error

Validate validates ResourceRefVol.

type Role

type Role struct {
	Name   string       `json:"name" yaml:"name"`
	Global bool         `json:"global,omitempty" yaml:"global,omitempty"`
	Rules  []PolicyRule `json:"rules,omitempty" yaml:"rules,omitempty"`
}

Role defines role spec for version 3.

func (Role) Validate

func (r Role) Validate() error

Validate returns an error if the spec is not valid.

type RollingUpdateSpec

type RollingUpdateSpec struct {
	MaxUnavailable *IntOrString `json:"maxUnavailable,omitempty"`
	MaxSurge       *IntOrString `json:"maxSurge,omitempty"`

	Partition *int32 `json:"partition,omitempty"`
}

RollingUpdateSpec defines the spec for controlling the desired behavior for rolling update.

func (RollingUpdateSpec) Validate

func (s RollingUpdateSpec) Validate() error

Validate returns an error if the spec is not valid.

type ScalePolicyType

type ScalePolicyType string

ScalePolicyType defines the policy for creating or terminating pods under a service.

const (
	// ParallelScale will create and delete pods as soon as the
	// replica count is changed, and will not wait for pods to be ready or complete
	// termination.
	ParallelScale ScalePolicyType = "parallel"

	// SerialScale will create pods in strictly increasing order on
	// scale up and strictly decreasing order on scale down, progressing only when
	// the previous pod is ready or terminated. At most one pod will be changed
	// at any time.
	SerialScale ScalePolicyType = "serial"
)

func (ScalePolicyType) Validate

func (spt ScalePolicyType) Validate() error

Validate returns an error if the spec is not valid.

type ServiceAccountSpecV2

type ServiceAccountSpecV2 struct {
	AutomountServiceAccountToken *bool        `json:"automountServiceAccountToken,omitempty" yaml:"automountServiceAccountToken,omitempty"`
	Global                       bool         `json:"global,omitempty" yaml:"global,omitempty"`
	Rules                        []PolicyRule `json:"rules,omitempty" yaml:"rules,omitempty"`
}

ServiceAccountSpecV2 defines spec for referencing or creating RBAC resource for the application for version 2.

func (ServiceAccountSpecV2) ToLatest

ToLatest converts ServiceAccountSpecV2 to the latest version.

func (ServiceAccountSpecV2) Validate

func (sa ServiceAccountSpecV2) Validate() error

Validate returns an error if the spec is not valid.

type ServiceAccountSpecV3

type ServiceAccountSpecV3 struct {
	AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty" yaml:"automountServiceAccountToken,omitempty"`

	Roles []Role `json:"roles" yaml:"roles"`
}

ServiceAccountSpecV3 defines spec for creating RBAC resource for the application for version 3.

func (ServiceAccountSpecV3) Validate

func (sa ServiceAccountSpecV3) Validate() error

Validate returns an error if the spec is not valid.

type ServiceSpec

type ServiceSpec struct {
	Annotations map[string]string `json:"annotations,omitempty"`

	UpdateStrategy *UpdateStrategy `json:"updateStrategy,omitempty"`
	ScalePolicy    ScalePolicyType `json:"scalePolicy,omitempty"`
}

ServiceSpec contains attributes to be set on v1.Service when the application is deployed.

func (ServiceSpec) Validate

func (ss ServiceSpec) Validate() error

Validate returns an error if the spec is not valid.

type Type

type Type int64

Type represents the stored type of IntOrString.

const (
	// Int indicates the IntOrString holds an int.
	Int Type = iota
	// String indicates the IntOrString holds a string.
	String
)

type UpdateStrategy

type UpdateStrategy struct {
	Type          string             `json:"type,omitempty"`
	RollingUpdate *RollingUpdateSpec `json:"rollingUpdate,omitempty"`
}

UpdateStrategy is a struct used to control the update strategy.

func (UpdateStrategy) Validate

func (s UpdateStrategy) Validate() error

Validate returns an error if the spec is not valid.

type Version

type Version int32

Version describes pod spec version type.

const CurrentVersion Version = Version3

CurrentVersion is the latest version of pod spec.

const Version2 Version = 2

Version2 defines the version number for pod spec version 2.

const Version3 Version = 3

Version3 defines the version number for pod spec version 3.

const VersionLegacy Version = 0

VersionLegacy defines the version number for pod spec version 0 - legacy.

func GetVersion

func GetVersion(strSpec string) (Version, error)

GetVersion picks the version from pod spec string.

type VolumeSource

type VolumeSource struct {
	Files     []File          `json:"files" yaml:"files"`
	HostPath  *HostPathVol    `json:"hostPath" yaml:"hostPath"`
	EmptyDir  *EmptyDirVol    `json:"emptyDir" yaml:"emptyDir"`
	ConfigMap *ResourceRefVol `json:"configMap" yaml:"configMap"`
	Secret    *ResourceRefVol `json:"secret" yaml:"secret"`
}

VolumeSource represents the source of a volume to mount.

func (VolumeSource) Validate

func (vs VolumeSource) Validate(name string) error

Validate validates VolumeSource.

Jump to

Keyboard shortcuts

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