v1

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package v1 is the v1 version of the API. +groupName=apate.opendc.org +k8s:deepcopy-gen=package,register +k8s:openapi-gen=true

Index

Constants

View Source
const (
	// NodeConfigurationLabel defines the label which can used to find out to which node configuration crd a node belongs
	// by external tools
	NodeConfigurationLabel = "apate-name"
	// NodeConfigurationLabelNamespace defines the namespace of the above label
	NodeConfigurationLabelNamespace = "apate-namespace"

	// EmulatedLabel is used by taints and node labels
	EmulatedLabel = "emulated"
	// EmulatedLabelValue is the value associated with the EmulatedLabel
	EmulatedLabelValue = "yes"
	// NodeIDLabel defines the label which can be used to get the uuid of the node
	NodeIDLabel = "apate-uuid"
)

Variables

View Source
var (
	// SchemeBuilder initialises a scheme builder
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme is a global function that registers this API group & version to a scheme
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: nodeconfiguration.GroupName, Version: "v1"}

SchemeGroupVersion is group version used to register these objects

Functions

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

func UpdateInKubernetes

func UpdateInKubernetes(config *kubeconfig.KubeConfig, deleteCRD bool) error

UpdateInKubernetes registers or deletes the generated CRD YAML to Kubernetes

Types

type NodeConfiguration

type NodeConfiguration struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`

	Spec NodeConfigurationSpec `json:"spec"`
}

NodeConfiguration is a definition of a NodeConfiguration resource +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:resource:path=nodeconfigurations,shortName=nc,singular=nodeconfiguration

func (*NodeConfiguration) DeepCopy

func (in *NodeConfiguration) DeepCopy() *NodeConfiguration

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeConfiguration.

func (*NodeConfiguration) DeepCopyInto

func (in *NodeConfiguration) DeepCopyInto(out *NodeConfiguration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NodeConfiguration) DeepCopyObject

func (in *NodeConfiguration) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type NodeConfigurationCustomState

type NodeConfigurationCustomState struct {
	// CreatePodResponse determines how to respond to the CreatePod request
	// +kubebuilder:default=UNSET
	// +kubebuilder:validation:Optional
	CreatePodResponse NodeResponse `json:"create_pod_response,omitempty"`

	// UpdatePodResponse determines how to respond to the UpdatePod request
	// +kubebuilder:default=UNSET
	// +kubebuilder:validation:Optional
	UpdatePodResponse NodeResponse `json:"update_pod_response,omitempty"`

	// DeletePodResponse determines how to respond to the DeletePod request
	// +kubebuilder:default=UNSET
	// +kubebuilder:validation:Optional
	DeletePodResponse NodeResponse `json:"delete_pod_response,omitempty"`

	// PodGetPodResponse determines how to respond to the GetPod request
	// +kubebuilder:default=UNSET
	// +kubebuilder:validation:Optional
	GetPodResponse NodeResponse `json:"get_pod_response,omitempty"`

	// GetPodsResponse determines how to respond to the GetPods request
	// +kubebuilder:default=UNSET
	// +kubebuilder:validation:Optional
	GetPodsResponse NodeResponse `json:"get_pods_response,omitempty"`

	// GetPodStatusResponse determines how to respond to the GetPodStatus request
	// +kubebuilder:default=UNSET
	// +kubebuilder:validation:Optional
	GetPodStatusResponse NodeResponse `json:"get_pod_status_response,omitempty"`

	// NodePingResponse determines how to respond to a heartbeat ping
	// +kubebuilder:default=UNSET
	// +kubebuilder:validation:Optional
	NodePingResponse NodeResponse `json:"node_ping_response,omitempty"`
}

NodeConfigurationCustomState is the state of the node, used for determining how to respond to request from kubernetes. This state will not be translated or anything similar, as this is a direct mapping to the actual state of the apatelet

func (*NodeConfigurationCustomState) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeConfigurationCustomState.

func (*NodeConfigurationCustomState) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NodeConfigurationList

type NodeConfigurationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []NodeConfiguration `json:"items"`
}

NodeConfigurationList is a list of NodeConfiguration +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*NodeConfigurationList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeConfigurationList.

func (*NodeConfigurationList) DeepCopyInto

func (in *NodeConfigurationList) DeepCopyInto(out *NodeConfigurationList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NodeConfigurationList) DeepCopyObject

func (in *NodeConfigurationList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type NodeConfigurationSpec

type NodeConfigurationSpec struct {
	// A way to directly update the node state
	// +kubebuilder:validation:Optional
	NodeConfigurationState `json:",inline,omitempty"`

	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Required
	Replicas int64 `json:"replicas"`

	// +kubebuilder:validation:Required
	Resources NodeResources `json:"resources"`

	// The tasks to be executed on this node
	// +kubebuilder:validation:Optional
	Tasks []NodeConfigurationTask `json:"tasks,omitempty"`
}

NodeConfigurationSpec is the spec which belongs to NodeConfiguration

func (*NodeConfigurationSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeConfigurationSpec.

func (*NodeConfigurationSpec) DeepCopyInto

func (in *NodeConfigurationSpec) DeepCopyInto(out *NodeConfigurationSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NodeConfigurationState

type NodeConfigurationState struct {
	// If set, NodeFailed will result in timeouts for all requests by kubernetes
	// effectively taking down the node
	// +kubebuilder:default=false
	// +kubebuilder:validation:Optional
	NodeFailed bool `json:"node_failed,omitempty"`

	// NetworkLatency determines how much added latency will be introduced to requests by kubernetes.
	// Any time.ParseDuration format is accepted, such as "10ms" or "42s"
	// The default is unset. Any invalid or negative integer will also be interpreted as unset.
	// +kubebuilder:default=unset
	// +kubebuilder:validation:Optional
	NetworkLatency string `json:"network_latency,omitempty"`

	// If set, HeartbeatFailed will result in the node no longer responding to pings
	// +kubebuilder:default=false
	// +kubebuilder:validation:Optional
	HeartbeatFailed bool `json:"heartbeat_failed,omitempty"`

	// CustomState specifies a custom state
	// +kubebuilder:validation:Optional
	CustomState *NodeConfigurationCustomState `json:"custom_state,omitempty"`
}

NodeConfigurationState is the state of the node, used for determining how to respond to request from kubernetes. This state includes some built-in states, which Apate will translate to direct state for ease of use. Said built-in states take precedence over the custom state

func (*NodeConfigurationState) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeConfigurationState.

func (*NodeConfigurationState) DeepCopyInto

func (in *NodeConfigurationState) DeepCopyInto(out *NodeConfigurationState)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NodeConfigurationTask

type NodeConfigurationTask struct {
	// The timestamp at which the task is executed
	// Any time.ParseDuration format is accepted, such as "10ms" or "42s"
	// +kubebuilder:validation:Required
	Timestamp string `json:"timestamp"`

	// The desired state of the node after this task
	// +kubebuilder:validation:Required
	State NodeConfigurationState `json:"state"`
}

NodeConfigurationTask is a single task which modifies the node state on the given timestamp

func (*NodeConfigurationTask) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeConfigurationTask.

func (*NodeConfigurationTask) DeepCopyInto

func (in *NodeConfigurationTask) DeepCopyInto(out *NodeConfigurationTask)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NodeResources

type NodeResources struct {
	// +kubebuilder:validation:Required
	Memory string `json:"memory,omitempty"`

	// +kubebuilder:validation:Required
	CPU int64 `json:"cpu,omitempty"`

	// +kubebuilder:validation:Required
	Storage string `json:"storage,omitempty"`

	// +kubebuilder:validation:Required
	EphemeralStorage string `json:"ephemeral_storage,omitempty"`

	// +kubebuilder:validation:Required
	MaxPods int64 `json:"max_pods,omitempty"`
}

NodeResources specifies the resources the node has available

func (*NodeResources) DeepCopy

func (in *NodeResources) DeepCopy() *NodeResources

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeResources.

func (*NodeResources) DeepCopyInto

func (in *NodeResources) DeepCopyInto(out *NodeResources)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NodeResponse

type NodeResponse string

NodeResponse can be NORMAL, TIMEOUT, ERROR or UNSET, and describes how a node should respond to a pod related request +kubebuilder:validation:Enum=NORMAL;TIMEOUT;ERROR;UNSET

const (
	ResponseNormal  NodeResponse = "NORMAL"
	ResponseTimeout NodeResponse = "TIMEOUT"
	ResponseError   NodeResponse = "ERROR"
	ResponseUnset   NodeResponse = "UNSET"
)

Enum variants for PodResponse

Jump to

Keyboard shortcuts

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