v1alpha1

package
v0.0.0-...-f0ef8f0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package v1alpha1 implements the v1alpha1 version of kube-valet custom resource types

These types serve as source file for client-go code generation. The types here also result in a client-go compatible client.

Index

Constants

View Source
const (
	// ProtectedNodeLabelKey is used to tell kube-valet to never include a specific node in any NodeAssignmentGroups. Regardless of targeting.
	// Any node that is marked as protected will also have any existing NodeAssignmentGroup taints and labels removed.
	ProtectedNodeLabelKey = "nags.kube-valet.io/protected"

	// ProtectedLabelValue is the value that must be set on ProtectedNodeLabelKey for the node to be protected
	ProtectedLabelValue = "true"
)
View Source
const (
	Domain = "kube-valet.io"

	GroupName = "assignments.kube-valet.io"
	V1alpha1  = "v1alpha1"

	PodAssignmentRuleResourceKind       = "PodAssignmentRule"
	PodAssignmentRuleResourceName       = "podassignmentrule"
	PodAssignmentRuleResourceNamePlural = "podassignmentrules"

	ClusterPodAssignmentRuleResourceKind       = "ClusterPodAssignmentRule"
	ClusterPodAssignmentRuleResourceName       = "clusterpodassignmentrule"
	ClusterPodAssignmentRuleResourceNamePlural = "clusterpodassignmentrules"

	NodeAssignmentGroupResourceKind       = "NodeAssignmentGroup"
	NodeAssignmentGroupResourceName       = "nodeassignmentgroup"
	NodeAssignmentGroupResourceNamePlural = "nodeassignmentgroups"
)
View Source
const (
	// NodeAssignmentDefaultTaintEffect defines the default taint effect to be
	// used when not specified in the resource
	NodeAssignmentTaintEffectDefault = corev1.TaintEffectNoSchedule

	// NodeAssignmentTaintEffectNotSpecified means that the user did not specify a taint effect
	NodeAssignmentTaintEffectNotSpecified = ""
)
View Source
const (
	// NodeAssignmentSchedulingModeDefault sets the default behavior to no scheduling
	NodeAssignmentSchedulingModeDefault = ""

	// NodeAssignmentSchedulingModePackLeft tells the system to run packleft on nodes in the assignment
	NodeAssignmentSchedulingModePackLeft = "PackLeft"

	// NodeAssignmentSchedulingModeUndefined means that the resource did not have this
	// Property set and the default behavior will be used
	NodeAssignmentSchedulingModeUndefined = ""
)

Variables

View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme   = SchemeBuilder.AddToScheme
)
View Source
var (
	// SchemeGroupVersion is the group version used to register these objects.
	SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: V1alpha1}

	ClusterPodAssignmentRuleCRDName = ClusterPodAssignmentRuleResourceNamePlural + "." + GroupName
	NodeAssignmentGroupCRDName      = NodeAssignmentGroupResourceNamePlural + "." + GroupName
)

Functions

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group-qualified GroupResource.

Types

type AssignmentStates

type AssignmentStates struct {
	// Name is the name of the assignment
	Name string `json:"name,omitempty"`

	// NumSatisfied represents the number of nodes that were assigned
	NumAssigned int64 `json:"numAssigned,omitempty"`
}

AssignmentStates reports the satisfaction for each assignment +k8s:openapi-gen=true

func (*AssignmentStates) DeepCopy

func (in *AssignmentStates) DeepCopy() *AssignmentStates

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

func (*AssignmentStates) DeepCopyInto

func (in *AssignmentStates) DeepCopyInto(out *AssignmentStates)

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

type ClusterPodAssignmentRule

type ClusterPodAssignmentRule struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec defines the behavior of the rule
	Spec PodAssignmentRuleSpec `json:"spec"`
}

ClusterPodAssignmentRule defines PodAssignmentRules that are applied cluster-wide +k8s:openapi-gen=true

func (*ClusterPodAssignmentRule) DeepCopy

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

func (*ClusterPodAssignmentRule) DeepCopyInto

func (in *ClusterPodAssignmentRule) DeepCopyInto(out *ClusterPodAssignmentRule)

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

func (*ClusterPodAssignmentRule) DeepCopyObject

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

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

func (*ClusterPodAssignmentRule) TargetsPod

func (r *ClusterPodAssignmentRule) TargetsPod(pod *corev1.Pod) bool

type ClusterPodAssignmentRuleList

type ClusterPodAssignmentRuleList struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ListMeta `json:"metadata,omitempty"`

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

ClusterPodAssignmentRuleList is a list of ClusterPodAssignmentRules +k8s:openapi-gen=true

func (*ClusterPodAssignmentRuleList) DeepCopy

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

func (*ClusterPodAssignmentRuleList) DeepCopyInto

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

func (*ClusterPodAssignmentRuleList) DeepCopyObject

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

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

type NodeAssignment

type NodeAssignment struct {
	// Name is used when applying the assignment label to the nodes
	Name string `json:"name,omitempty"`

	// GroupMode determines whether labels, taints, labels and taints, or nothing
	// is applied to nodes that match the group
	Mode NodeAssignmentMode `json:"mode,omitempty"`

	// TaintEffect controls the effect of the taint. Possible values
	// come from the upstream type
	// +optional
	TaintEffect corev1.TaintEffect `json:"taintEffect,omitempty"`

	// NumDesired is the number of nodes that should be assigned to this group. Default: 0
	// when specified along with PercentDesired, whichever request results in the most nodes is used
	NumDesired int `json:"numDesired,omitempty"`

	// PercentDesired is the number percentage of matching nodes that should be assigned to this group. Default: 0
	// when specified along with NumDesired, whichever request results in the most nodes is used
	PercentDesired int `json:"percentDesired,omitempty"`

	// SchedulingMode determins what kind of scheduling alteration to use on the assignment
	// do no scheduling alterations by default
	// +optional
	SchedulingMode NodeAssignmentSchedulingMode `json:"schedulingMode,omitempty"`

	// PackLeft holds configuration options and values here are only used when the SchedulingMode is "PackLeft"
	// +optional
	PackLeft *PackLeftScheduling `json:"packLeft,omitempty"`
}

NodeAssignment describes the assignments possible for the group and the number of nodes for the assignment +k8s:openapi-gen=true

func (*NodeAssignment) DeepCopy

func (in *NodeAssignment) DeepCopy() *NodeAssignment

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

func (*NodeAssignment) DeepCopyInto

func (in *NodeAssignment) DeepCopyInto(out *NodeAssignment)

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

type NodeAssignmentGroup

type NodeAssignmentGroup struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec defines the group and it's assignments
	Spec NodeAssignmentGroupSpec `json:"spec,omitempty"`

	// Status represents the current status of the group assignments.
	Status NodeAssignmentGroupStatus `json:"status,omitempty"`
}

NodeAssignmentGroup represents the configuration of a group of nodes that will be auto-labeled +k8s:openapi-gen=true

func (*NodeAssignmentGroup) Assign

func (nag *NodeAssignmentGroup) Assign(node *corev1.Node, na *NodeAssignment)

func (*NodeAssignmentGroup) DeepCopy

func (in *NodeAssignmentGroup) DeepCopy() *NodeAssignmentGroup

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

func (*NodeAssignmentGroup) DeepCopyInto

func (in *NodeAssignmentGroup) DeepCopyInto(out *NodeAssignmentGroup)

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

func (*NodeAssignmentGroup) DeepCopyObject

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

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

func (*NodeAssignmentGroup) GetAssignment

func (nag *NodeAssignmentGroup) GetAssignment(node *corev1.Node) (string, bool)

func (*NodeAssignmentGroup) RemoveLabel

func (nag *NodeAssignmentGroup) RemoveLabel(node *corev1.Node)

func (*NodeAssignmentGroup) RemoveTaint

func (nag *NodeAssignmentGroup) RemoveTaint(node *corev1.Node) []error

func (*NodeAssignmentGroup) SetLabel

func (nag *NodeAssignmentGroup) SetLabel(node *corev1.Node, na *NodeAssignment)

func (*NodeAssignmentGroup) SetTaint

func (nag *NodeAssignmentGroup) SetTaint(node *corev1.Node, na *NodeAssignment)

func (*NodeAssignmentGroup) TargetsNode

func (nag *NodeAssignmentGroup) TargetsNode(node *corev1.Node) bool

func (*NodeAssignmentGroup) Unassign

func (nag *NodeAssignmentGroup) Unassign(node *corev1.Node) []error

type NodeAssignmentGroupList

type NodeAssignmentGroupList struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ListMeta `json:"metadata,omitempty"`

	// Items is a list of NodeAssignmentGroups
	Items []NodeAssignmentGroup `json:"items"`
}

NodeAssignmentGroupList is a list of NodeAssignmentGroups +k8s:openapi-gen=true

func (*NodeAssignmentGroupList) DeepCopy

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

func (*NodeAssignmentGroupList) DeepCopyInto

func (in *NodeAssignmentGroupList) DeepCopyInto(out *NodeAssignmentGroupList)

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

func (*NodeAssignmentGroupList) DeepCopyObject

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

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

type NodeAssignmentGroupSpec

type NodeAssignmentGroupSpec struct {
	// TargetLabels is optional. If not provided, the group will match all nodes in the cluster.
	// +optional
	TargetLabels labels.Set `json:"targetLabels,omitempty"`

	// Assignments is the array of assignments to be applied. This list should be ordered by the user
	// with the most important assignments first.
	// +optional
	DefaultAssignment *NodeAssignment `json:"defaultAssignment,omitempty"`

	// Assignments is the array of assignments to be applied. This list should be ordered by the user
	// with the most important assignments first.
	// +patchStrategy=merge
	Assignments []NodeAssignment `json:"assignments,omitempty" patchStrategy:"merge"`
}

NodeAssignmentGroupSpec describes the group and it's assignments +k8s:openapi-gen=true

func (*NodeAssignmentGroupSpec) DeepCopy

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

func (*NodeAssignmentGroupSpec) DeepCopyInto

func (in *NodeAssignmentGroupSpec) DeepCopyInto(out *NodeAssignmentGroupSpec)

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

type NodeAssignmentGroupState

type NodeAssignmentGroupState string

NodeAssignmentGroupState reports the overall health of the group +k8s:openapi-gen=true

const (
	// NodeAssignmentGroupStateSatisfied means that the group
	// has matched and operated on enough nodes to satisfy all assignments
	NodeAssignmentGroupStateSatisfied NodeAssignmentGroupState = "Satisfied"

	// NodeAssignmentGroupStateNotSatisfied means that the group
	// did not find enough nodes to satisfy all assignments
	NodeAssignmentGroupStateNotSatisfied NodeAssignmentGroupState = "NotSatisfied"

	// NodeAssignmentGroupStateError means that the controller
	// was unable to process the group properly
	NodeAssignmentGroupStateError NodeAssignmentGroupState = "Error"
)

type NodeAssignmentGroupStatus

type NodeAssignmentGroupStatus struct {
	// NumMatched represents the number of nodes that matched the targetlabels
	NumMatched int64 `json:"numMatched,omitempty"`
}

NodeAssignmentGroupStatus represents the current status of the group. +k8s:openapi-gen=true

func (*NodeAssignmentGroupStatus) DeepCopy

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

func (*NodeAssignmentGroupStatus) DeepCopyInto

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

type NodeAssignmentMode

type NodeAssignmentMode string

NodeAssignmentMode defines the operation mode of the rule +k8s:openapi-gen=true

const (
	// NodeAssignmentModeDefault sets the default behavior to "LabelOnly"
	NodeAssignmentModeDefault NodeAssignmentMode = "LabelOnly"

	// NodeAssignmentModeLabelOnly tells the system to only apply labels to the node
	NodeAssignmentModeLabelOnly NodeAssignmentMode = "LabelOnly"

	// NodeAssignmentModeLabelAndTaint tells the system to apply both labels and taints for the rule
	NodeAssignmentModeLabelAndTaint NodeAssignmentMode = "LabelAndTaint"

	// NodeAssignmentModeUndefined means that the resource did not have this
	// property set and the default behavior will be used
	NodeAssignmentModeUndefined NodeAssignmentMode = ""
)

type NodeAssignmentSchedulingMode

type NodeAssignmentSchedulingMode string

NodeAssignmentSchedulingMode defines the way to alter scheduling in the assignment +k8s:openapi-gen=true

type PackLeftScheduling

type PackLeftScheduling struct {
	// FullPercent defines percent of the Metric that must be used for a node to be considered "Full"
	FullPercent *int `json:"fullPercent,omitempty"`

	// NumAvoid indiciates the number of nodes to be set to "Avoid" for the given assignment. Assignments with few nodes should be fine
	// with a buffer of 1, But very large cluster may be better off with a larger number. Default: 1
	NumAvoid int `json:"numAvoid,omitempty"`

	// PercentAvoid indiciates a percentage of nodes to be set to "Avoid" for the given assignment
	// when specified along with NumAvoid, whichever request results in the most nodes is used
	PercentAvoid *int `json:"percentAvoid,omitempty"`
}

PackLeftScheduling holds configuration for PackLeft assignments +k8s:openapi-gen=true

func (*PackLeftScheduling) DeepCopy

func (in *PackLeftScheduling) DeepCopy() *PackLeftScheduling

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

func (*PackLeftScheduling) DeepCopyInto

func (in *PackLeftScheduling) DeepCopyInto(out *PackLeftScheduling)

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

type PodAssignmentRule

type PodAssignmentRule struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec defines the behavior of the rule
	Spec PodAssignmentRuleSpec `json:"spec"`
}

PodAssignmentRule describes pods to match and attributes to apply to them +k8s:openapi-gen=true

func (*PodAssignmentRule) DeepCopy

func (in *PodAssignmentRule) DeepCopy() *PodAssignmentRule

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

func (*PodAssignmentRule) DeepCopyInto

func (in *PodAssignmentRule) DeepCopyInto(out *PodAssignmentRule)

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

func (*PodAssignmentRule) DeepCopyObject

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

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

func (*PodAssignmentRule) TargetsPod

func (r *PodAssignmentRule) TargetsPod(pod *corev1.Pod) bool

type PodAssignmentRuleList

type PodAssignmentRuleList struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ListMeta `json:"metadata"`

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

PodAssignmentRuleList is a list of PodAssignmentRules +k8s:openapi-gen=true

func (*PodAssignmentRuleList) DeepCopy

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

func (*PodAssignmentRuleList) DeepCopyInto

func (in *PodAssignmentRuleList) DeepCopyInto(out *PodAssignmentRuleList)

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

func (*PodAssignmentRuleList) DeepCopyObject

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

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

type PodAssignmentRuleScheduling

type PodAssignmentRuleScheduling struct {
	// MergeStrategy defines the behavior of the rule when pods already have existing
	// scheduling details defined
	MergeStrategy PodAssignmentRuleSchedulingMergeStrategy `json:"mergeStrategy"`

	// NodeSelector is a simple key-value matching for nodes
	// +optional
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// Affinity is the upstream pod affinity resource
	// +optional
	Affinity *corev1.Affinity `json:"affinity,omitempty"`

	// Tolerations is a list of upstream pod toleration resources
	// +optional
	// +patchStrategy=merge
	Tolerations []corev1.Toleration `json:"tolerations,omitempty" patchStrategy:"merge"`
}

PodAssignmentRuleScheduling defines the scheduling objects to be applied to the pod +k8s:openapi-gen=true

func (*PodAssignmentRuleScheduling) ApplyToPod

func (s *PodAssignmentRuleScheduling) ApplyToPod(pod *corev1.Pod)

func (*PodAssignmentRuleScheduling) DeepCopy

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

func (*PodAssignmentRuleScheduling) DeepCopyInto

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

func (*PodAssignmentRuleScheduling) GetMergeStrategy

func (*PodAssignmentRuleScheduling) GetPatchOps

type PodAssignmentRuleSchedulingMergeStrategy

type PodAssignmentRuleSchedulingMergeStrategy string

PodAssignmentRuleSchedulingMergeStrategy defines the behavior of the rule when pods already have existing scheduling details defined +k8s:openapi-gen=true

const (
	// PodAssignmentRuleSchedulingMergeStrategyDefault is the default behavior to be used
	// when on is provided
	PodAssignmentRuleSchedulingMergeStrategyDefault PodAssignmentRuleSchedulingMergeStrategy = "OverwriteAll"

	// PodAssignmentRuleSchedulingMergeStrategyOverwriteAll tells the system to overwrite
	// any scheduling details in the pod with the details in the rule
	PodAssignmentRuleSchedulingMergeStrategyOverwriteAll PodAssignmentRuleSchedulingMergeStrategy = "OverwriteAll"

	// PodAssignmentRuleSchedulingMergeStrategyUndefined means that the document did not
	// include a strategy and the default will be used.
	PodAssignmentRuleSchedulingMergeStrategyUndefined PodAssignmentRuleSchedulingMergeStrategy = ""
)

type PodAssignmentRuleSpec

type PodAssignmentRuleSpec struct {

	// TargetLabels defines which pods this rule will be applied to. Optional.
	// When not given, the rule will match all pods.
	// +optional
	TargetLabels labels.Set `json:"targetLabels,omitempty"`

	// Scheduling defines the scheduling objects to be applied to the pod
	Scheduling PodAssignmentRuleScheduling `json:"scheduling"`
}

PodAssignmentRuleSpec defines the behavior of the PodAssignmentRule +k8s:openapi-gen=true

func (*PodAssignmentRuleSpec) DeepCopy

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

func (*PodAssignmentRuleSpec) DeepCopyInto

func (in *PodAssignmentRuleSpec) DeepCopyInto(out *PodAssignmentRuleSpec)

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

func (*PodAssignmentRuleSpec) TargetsPod

func (s *PodAssignmentRuleSpec) TargetsPod(pod *corev1.Pod) bool

Jump to

Keyboard shortcuts

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