Documentation
¶
Index ¶
- func GetPodQoSClass(pod *corev1.Pod) corev1.PodQOSClass
- func LimitForRatio(name corev1.ResourceName, request resource.Quantity, ratio resource.Quantity) (resource.Quantity, error)
- func PodFromTemplate(obj *unstructured.Unstructured) (*corev1.Pod, error)
- func PodLevelResourceSupported(name corev1.ResourceName) bool
- func PodTemplatePath(gvk schema.GroupVersionKind) []string
- func RatioSupportedResource(name corev1.ResourceName) bool
- type PlacementAffinityTerm
- type PlacementMatcher
- func (m PlacementMatcher) Affinity(rule rules.WorkloadAffinityMatch, value PlacementAffinityTerm, ...) (bool, error)
- func (m PlacementMatcher) LabelSelector(rule *rules.PlacementLabelSelectorMatch, value *metav1.LabelSelector, ...) (bool, error)
- func (m PlacementMatcher) NodeSelector(rule rules.WorkloadNodeSelectorMatch, key, value string) (bool, error)
- func (m PlacementMatcher) Toleration(rule rules.WorkloadTolerationMatch, value corev1.Toleration) (bool, error)
- func (m PlacementMatcher) TopologySpread(rule rules.WorkloadTopologySpreadMatch, value corev1.TopologySpreadConstraint, ...) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPodQoSClass ¶
func GetPodQoSClass(pod *corev1.Pod) corev1.PodQOSClass
func LimitForRatio ¶ added in v0.14.0
func LimitForRatio( name corev1.ResourceName, request resource.Quantity, ratio resource.Quantity, ) (resource.Quantity, error)
LimitForRatio calculates request * ratio without floating-point arithmetic. The result is rounded down so it never exceeds the configured maximum ratio.
func PodFromTemplate ¶ added in v0.15.0
func PodFromTemplate(obj *unstructured.Unstructured) (*corev1.Pod, error)
PodFromTemplate decodes the Pod-spec projection used by existing validators. The controller object remains the admission/condition/event identity.
func PodLevelResourceSupported ¶ added in v0.14.0
func PodLevelResourceSupported(name corev1.ResourceName) bool
PodLevelResourceSupported reports whether Kubernetes permits the resource name in Pod-level resource requirements.
func PodTemplatePath ¶ added in v0.15.0
func PodTemplatePath(gvk schema.GroupVersionKind) []string
PodTemplatePath recognizes only the supported native controller groups.
func RatioSupportedResource ¶ added in v0.14.0
func RatioSupportedResource(name corev1.ResourceName) bool
RatioSupportedResource reports whether Capsule can safely calculate a limit-to-request ratio for the resource. CPU is rounded down to milliCPU; byte-based resources are rounded down to whole bytes.
Types ¶
type PlacementAffinityTerm ¶ added in v0.15.0
type PlacementAffinityTerm struct {
Type rules.PlacementAffinityType
Mode rules.PlacementAffinityMode
Weight int32
Node *corev1.NodeSelectorTerm
Pod *corev1.PodAffinityTerm
}
PlacementAffinityTerm retains term boundaries: constraints from different allow entries cannot accidentally be combined to permit an entire term.
type PlacementMatcher ¶ added in v0.15.0
type PlacementMatcher struct {
Expressions runtime.ExpressionRegexMatcher
}
PlacementMatcher uses the process-local expression cache supplied by admission.
func (PlacementMatcher) Affinity ¶ added in v0.15.0
func (m PlacementMatcher) Affinity(rule rules.WorkloadAffinityMatch, value PlacementAffinityTerm, namespace string, podLabels map[string]string) (bool, error)
func (PlacementMatcher) LabelSelector ¶ added in v0.15.0
func (m PlacementMatcher) LabelSelector(rule *rules.PlacementLabelSelectorMatch, value *metav1.LabelSelector, matchKeys, mismatchKeys []string, podLabels map[string]string) (bool, error)
LabelSelector checks matchLabels, matchExpressions and dynamic keys together. It never mutates a selector that may belong to a cache or an admission object.
func (PlacementMatcher) NodeSelector ¶ added in v0.15.0
func (m PlacementMatcher) NodeSelector(rule rules.WorkloadNodeSelectorMatch, key, value string) (bool, error)
func (PlacementMatcher) Toleration ¶ added in v0.15.0
func (m PlacementMatcher) Toleration(rule rules.WorkloadTolerationMatch, value corev1.Toleration) (bool, error)
func (PlacementMatcher) TopologySpread ¶ added in v0.15.0
func (m PlacementMatcher) TopologySpread(rule rules.WorkloadTopologySpreadMatch, value corev1.TopologySpreadConstraint, podLabels map[string]string) (bool, error)