Documentation ¶
Overview ¶
Package lifted contains the files lifted from other projects.
Index ¶
- Constants
- Variables
- func EqualIgnoreHash(template1, template2 *corev1.PodTemplateSpec) bool
- func FindNewReplicaSet(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet) *appsv1.ReplicaSet
- func GetDeletableResources(discoveryClient discovery.ServerResourcesInterface) map[schema.GroupVersionResource]struct{}
- func GetNewReplicaSet(deployment *appsv1.Deployment, f ReplicaSetListFunc) (*appsv1.ReplicaSet, error)
- func GetPodFromTemplate(template *corev1.PodTemplateSpec, parentObject runtime.Object, ...) (*corev1.Pod, error)
- func IsAttachableVolumeResourceName(name corev1.ResourceName) bool
- func IsExtendedResourceName(name corev1.ResourceName) bool
- func IsHugePageResourceName(name corev1.ResourceName) bool
- func IsIntegerResourceName(str string) bool
- func IsNativeResource(name corev1.ResourceName) bool
- func IsPrefixedNativeResource(name corev1.ResourceName) bool
- func IsQuotaHugePageResourceName(name corev1.ResourceName) bool
- func IsScalarResourceName(name corev1.ResourceName) bool
- func IsStandardQuotaResourceName(str string) bool
- func IsStandardResourceName(str string) bool
- func ListPodsByRS(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet, f PodListFunc) ([]*corev1.Pod, error)
- func ListReplicaSetsByDeployment(deployment *appsv1.Deployment, f ReplicaSetListFunc) ([]*appsv1.ReplicaSet, error)
- func NewRequestInfo(req *http.Request) *apirequest.RequestInfo
- func NodeSelectorRequirementsAsSelector(nsm []corev1.NodeSelectorRequirement) (labels.Selector, error)
- func ObjectNeedsUpdate(desiredObj, clusterObj *unstructured.Unstructured, recordedVersion string) bool
- func ObjectVersion(clusterObj *unstructured.Unstructured) string
- func ParseTaints(spec []string) ([]corev1.Taint, []corev1.Taint, error)
- func RetainServiceAccountFields(desired, observed *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func RetainServiceFields(desired, observed *unstructured.Unstructured) (*unstructured.Unstructured, error)
- func SplitPath(path string) []string
- func ValidateClusterTaints(taints []corev1.Taint, fldPath *field.Path) field.ErrorList
- func ValidateNonnegativeQuantity(value resource.Quantity, fldPath *field.Path) field.ErrorList
- func ValidateResourceQuantityValue(resource string, value resource.Quantity, fldPath *field.Path) field.ErrorList
- func ValidateResourceQuotaResourceName(value string, fldPath *field.Path) field.ErrorList
- func VisitContainers(podSpec *corev1.PodSpec, mask ContainerType, visitor ContainerVisitor) bool
- func VisitPodConfigmapNames(pod *corev1.Pod, visitor Visitor) bool
- func VisitPodSecretNames(pod *corev1.Pod, visitor Visitor) bool
- type ContainerType
- type ContainerVisitor
- type Parallelizer
- type PodListFunc
- type ReplicaSetListFunc
- type ReplicaSetsByCreationTimestamp
- type Visitor
Constants ¶
const DefaultParallelism int = 16
DefaultParallelism is the default parallelism used in scheduler.
const (
// SecretsField indicates the 'secrets' field of a service account
SecretsField = "secrets"
)
Variables ¶
var ValidatePodName = apimachineryvalidation.NameIsDNSSubdomain
ValidatePodName can be used to check whether the given pod name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.
Functions ¶
func EqualIgnoreHash ¶ added in v1.2.0
func EqualIgnoreHash(template1, template2 *corev1.PodTemplateSpec) bool
EqualIgnoreHash returns true if two given podTemplateSpec are equal, ignoring the diff in value of Labels[pod-template-hash] We ignore pod-template-hash because:
- The hash result would be different upon podTemplateSpec API changes (e.g. the addition of a new field will cause the hash code to change)
- The deployment template won't have hash labels
func FindNewReplicaSet ¶ added in v1.2.0
func FindNewReplicaSet(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet) *appsv1.ReplicaSet
FindNewReplicaSet returns the new RS this given deployment targets (the one with the same pod template).
func GetDeletableResources ¶ added in v1.2.0
func GetDeletableResources(discoveryClient discovery.ServerResourcesInterface) map[schema.GroupVersionResource]struct{}
GetDeletableResources returns all resources from discoveryClient that the garbage collector should recognize and work with. More specifically, all preferred resources which support the 'delete', 'list', and 'watch' verbs.
All discovery errors are considered temporary. Upon encountering any error, GetDeletableResources will log and return any discovered resources it was able to process (which may be none).
func GetNewReplicaSet ¶ added in v1.2.0
func GetNewReplicaSet(deployment *appsv1.Deployment, f ReplicaSetListFunc) (*appsv1.ReplicaSet, error)
GetNewReplicaSet returns a replica set that matches the intent of the given deployment; get ReplicaSetList from client interface. Returns nil if the new replica set doesn't exist yet.
func GetPodFromTemplate ¶ added in v1.2.0
func GetPodFromTemplate(template *corev1.PodTemplateSpec, parentObject runtime.Object, controllerRef *metav1.OwnerReference) (*corev1.Pod, error)
GetPodFromTemplate generates pod object from a template.
func IsAttachableVolumeResourceName ¶ added in v1.2.0
func IsAttachableVolumeResourceName(name corev1.ResourceName) bool
IsAttachableVolumeResourceName returns true when the resource name is prefixed in attachable volume
func IsExtendedResourceName ¶ added in v1.2.0
func IsExtendedResourceName(name corev1.ResourceName) bool
IsExtendedResourceName returns true if: 1. the resource name is not in the default namespace; 2. resource name does not have "requests." prefix, to avoid confusion with the convention in quota 3. it satisfies the rules in IsQualifiedName() after converted into quota resource name
func IsHugePageResourceName ¶ added in v1.2.0
func IsHugePageResourceName(name corev1.ResourceName) bool
IsHugePageResourceName returns true if the resource name has the huge page resource prefix.
func IsIntegerResourceName ¶ added in v1.2.0
IsIntegerResourceName returns true if the resource is measured in integer values
func IsNativeResource ¶ added in v1.2.0
func IsNativeResource(name corev1.ResourceName) bool
IsNativeResource returns true if the resource name is in the *kubernetes.io/ namespace. Partially-qualified (unprefixed) names are implicitly in the kubernetes.io/ namespace.
func IsPrefixedNativeResource ¶ added in v1.2.0
func IsPrefixedNativeResource(name corev1.ResourceName) bool
IsPrefixedNativeResource returns true if the resource name is in the *kubernetes.io/ namespace.
func IsQuotaHugePageResourceName ¶ added in v1.2.0
func IsQuotaHugePageResourceName(name corev1.ResourceName) bool
IsQuotaHugePageResourceName returns true if the resource name has the quota related huge page resource prefix.
func IsScalarResourceName ¶ added in v1.2.0
func IsScalarResourceName(name corev1.ResourceName) bool
IsScalarResourceName validates the resource for Extended, Hugepages, Native and AttachableVolume resources
func IsStandardQuotaResourceName ¶ added in v1.2.0
IsStandardQuotaResourceName returns true if the resource is known to the quota tracking system
func IsStandardResourceName ¶ added in v1.2.0
IsStandardResourceName returns true if the resource is known to the system
func ListPodsByRS ¶ added in v1.2.0
func ListPodsByRS(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet, f PodListFunc) ([]*corev1.Pod, error)
ListPodsByRS returns a list of pods the given deployment targets. This needs a list of ReplicaSets for the Deployment, which can be found with ListReplicaSets(). Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan), because only the controller itself should do that. However, it does filter out anything whose ControllerRef doesn't match.
func ListReplicaSetsByDeployment ¶ added in v1.2.0
func ListReplicaSetsByDeployment(deployment *appsv1.Deployment, f ReplicaSetListFunc) ([]*appsv1.ReplicaSet, error)
ListReplicaSetsByDeployment returns a slice of RSes the given deployment targets. Note that this does NOT attempt to reconcile ControllerRef (adopt/orphan), because only the controller itself should do that. However, it does filter out anything whose ControllerRef doesn't match.
func NewRequestInfo ¶
func NewRequestInfo(req *http.Request) *apirequest.RequestInfo
NewRequestInfo returns the information from the http request. If error is not nil, RequestInfo holds the information as best it is known before the failure It handles both resource and non-resource requests and fills in all the pertinent information for each. Valid Inputs: Resource paths /apis/{api-group}/{version}/namespaces /api/{version}/namespaces /api/{version}/namespaces/{namespace} /api/{version}/namespaces/{namespace}/{resource} /api/{version}/namespaces/{namespace}/{resource}/{resourceName} /api/{version}/{resource} /api/{version}/{resource}/{resourceName}
Special verbs without subresources: /api/{version}/proxy/{resource}/{resourceName} /api/{version}/proxy/namespaces/{namespace}/{resource}/{resourceName}
Special verbs with subresources: /api/{version}/watch/{resource} /api/{version}/watch/namespaces/{namespace}/{resource}
NonResource paths /apis/{api-group}/{version} /apis/{api-group} /apis /api/{version} /api /healthz /
func NodeSelectorRequirementsAsSelector ¶ added in v1.2.0
func NodeSelectorRequirementsAsSelector(nsm []corev1.NodeSelectorRequirement) (labels.Selector, error)
NodeSelectorRequirementsAsSelector converts the []NodeSelectorRequirement core type into a struct that implements labels.Selector.
func ObjectNeedsUpdate ¶ added in v1.2.0
func ObjectNeedsUpdate(desiredObj, clusterObj *unstructured.Unstructured, recordedVersion string) bool
ObjectNeedsUpdate determines whether the 2 objects provided cluster object needs to be updated according to the desired object and the recorded version.
func ObjectVersion ¶ added in v1.2.0
func ObjectVersion(clusterObj *unstructured.Unstructured) string
ObjectVersion retrieves the field type-prefixed value used for determining currency of the given cluster object.
func ParseTaints ¶ added in v1.2.0
ParseTaints takes a spec which is an array and creates slices for new taints to be added, taints to be deleted. It also validates the spec. For example, the form `<key>` may be used to remove a taint, but not to add one.
func RetainServiceAccountFields ¶ added in v1.2.0
func RetainServiceAccountFields(desired, observed *unstructured.Unstructured) (*unstructured.Unstructured, error)
RetainServiceAccountFields retains the 'secrets' field of a service account if the desired representation does not include a value for the field. This ensures that the sync controller doesn't continually clear a generated secret from a service account, prompting continual regeneration by the service account controller in the member cluster.
func RetainServiceFields ¶ added in v1.2.0
func RetainServiceFields(desired, observed *unstructured.Unstructured) (*unstructured.Unstructured, error)
RetainServiceFields updates the desired service object with values retained from the cluster object.
func ValidateClusterTaints ¶ added in v1.2.0
ValidateClusterTaints tests if given taints have valid data.
func ValidateNonnegativeQuantity ¶ added in v1.2.0
ValidateNonnegativeQuantity Validates that a Quantity is not negative
func ValidateResourceQuantityValue ¶ added in v1.2.0
func ValidateResourceQuantityValue(resource string, value resource.Quantity, fldPath *field.Path) field.ErrorList
ValidateResourceQuantityValue enforces that specified quantity is valid for specified resource
func ValidateResourceQuotaResourceName ¶ added in v1.2.0
ValidateResourceQuotaResourceName Validate resource names that can go in a resource quota Refer to docs/design/resources.md for more details.
func VisitContainers ¶ added in v1.2.0
func VisitContainers(podSpec *corev1.PodSpec, mask ContainerType, visitor ContainerVisitor) bool
VisitContainers invokes the visitor function with a pointer to every container spec in the given pod spec with type set in mask. If visitor returns false, visiting is short-circuited. VisitContainers returns true if visiting completes, false if visiting was short-circuited.
func VisitPodConfigmapNames ¶ added in v1.2.0
VisitPodConfigmapNames invokes the visitor function with the name of every configmap referenced by the pod spec. If visitor returns false, visiting is short-circuited. Transitive references (e.g. pod -> pvc -> pv -> secret) are not visited. Returns true if visiting completed, false if visiting was short-circuited.
func VisitPodSecretNames ¶ added in v1.2.0
VisitPodSecretNames invokes the visitor function with the name of every secret referenced by the pod spec. If visitor returns false, visiting is short-circuited. Transitive references (e.g. pod -> pvc -> pv -> secret) are not visited. Returns true if visiting completed, false if visiting was short-circuited.
Types ¶
type ContainerType ¶ added in v1.2.0
type ContainerType int
ContainerType signifies container type
const ( // Containers is for normal containers Containers ContainerType = 1 << iota // InitContainers is for init containers InitContainers // EphemeralContainers is for ephemeral containers EphemeralContainers )
const AllContainers ContainerType = (InitContainers | Containers | EphemeralContainers)
AllContainers specifies that all containers be visited
type ContainerVisitor ¶ added in v1.2.0
type ContainerVisitor func(container *corev1.Container, containerType ContainerType) (shouldContinue bool)
ContainerVisitor is called with each container spec, and returns true if visiting should continue.
type Parallelizer ¶ added in v1.2.0
type Parallelizer struct {
// contains filtered or unexported fields
}
Parallelizer holds the parallelism for scheduler.
func NewParallelizer ¶ added in v1.2.0
func NewParallelizer(p int) Parallelizer
NewParallelizer returns an object holding the parallelism.
func (Parallelizer) Until ¶ added in v1.2.0
func (p Parallelizer) Until(ctx context.Context, pieces int, doWorkPiece workqueue.DoWorkPieceFunc)
Until is a wrapper around workqueue.ParallelizeUntil to use in scheduling algorithms.
type PodListFunc ¶ added in v1.2.0
PodListFunc returns the Pod slice from the Pod namespace and a selector.
type ReplicaSetListFunc ¶ added in v1.2.0
ReplicaSetListFunc returns the ReplicaSet slice from the ReplicaSet namespace and a selector.
type ReplicaSetsByCreationTimestamp ¶ added in v1.2.0
type ReplicaSetsByCreationTimestamp []*appsv1.ReplicaSet
ReplicaSetsByCreationTimestamp sorts a list of ReplicaSet by creation timestamp, using their names as a tie breaker.
func (ReplicaSetsByCreationTimestamp) Len ¶ added in v1.2.0
func (o ReplicaSetsByCreationTimestamp) Len() int
func (ReplicaSetsByCreationTimestamp) Less ¶ added in v1.2.0
func (o ReplicaSetsByCreationTimestamp) Less(i, j int) bool
func (ReplicaSetsByCreationTimestamp) Swap ¶ added in v1.2.0
func (o ReplicaSetsByCreationTimestamp) Swap(i, j int)