Documentation ¶
Index ¶
- Constants
- func EnsureNamespaceExistsAndIsReady(namespace *corev1api.Namespace, client corev1client.NamespaceInterface, ...) (bool, bool, error)
- func GetSecret(client kbclient.Client, namespace, name string) (*corev1api.Secret, error)
- func GetSecretKey(client kbclient.Client, namespace string, ...) ([]byte, error)
- func GetVolumeDirectory(ctx context.Context, log logrus.FieldLogger, pod *corev1api.Pod, ...) (string, error)
- func IsCRDReady(crd *unstructured.Unstructured) (bool, error)
- func IsV1Beta1CRDReady(crd *apiextv1beta1.CustomResourceDefinition) bool
- func IsV1CRDReady(crd *apiextv1.CustomResourceDefinition) bool
- func NamespaceAndName(objMeta metav1.Object) string
- func ParseResourceRequirements(cpuRequest, memRequest, cpuLimit, memLimit string) (corev1.ResourceRequirements, error)
- func ParseSecurityContext(runAsUser string, runAsGroup string, allowPrivilegeEscalation string, ...) (corev1.SecurityContext, error)
- func SinglePathMatch(path string, fs filesystem.Interface, log logrus.FieldLogger) (string, error)
- type PeriodicalEnqueueSource
- type SpecChangePredicate
Constants ¶
const ( KubeAnnBindCompleted = "pv.kubernetes.io/bind-completed" KubeAnnBoundByController = "pv.kubernetes.io/bound-by-controller" KubeAnnDynamicallyProvisioned = "pv.kubernetes.io/provisioned-by" KubeAnnMigratedTo = "pv.kubernetes.io/migrated-to" )
These annotations are taken from the Kubernetes persistent volume/persistent volume claim controller. They cannot be directly importing because they are part of the kubernetes/kubernetes package, and importing that package is unsupported. Their values are well-known and slow changing. They're duplicated here as constants to provide compile-time checking. Originals can be found in kubernetes/kubernetes/pkg/controller/volume/persistentvolume/util/util.go.
Variables ¶
This section is empty.
Functions ¶
func EnsureNamespaceExistsAndIsReady ¶ added in v0.11.0
func EnsureNamespaceExistsAndIsReady(namespace *corev1api.Namespace, client corev1client.NamespaceInterface, timeout time.Duration) (bool, bool, error)
EnsureNamespaceExistsAndIsReady attempts to create the provided Kubernetes namespace. It returns three values: a bool indicating whether or not the namespace is ready, a bool indicating whether or not the namespace was created and an error if the creation failed for a reason other than that the namespace already exists. Note that in the case where the namespace already exists and is not ready, this function will return (false, false, nil). If the namespace exists and is marked for deletion, this function will wait up to the timeout for it to fully delete.
func GetSecretKey ¶ added in v1.6.0
func GetVolumeDirectory ¶ added in v0.9.0
func GetVolumeDirectory(ctx context.Context, log logrus.FieldLogger, pod *corev1api.Pod, volumeName string, cli client.Client) (string, error)
GetVolumeDirectory gets the name of the directory on the host, under /var/lib/kubelet/pods/<podUID>/volumes/, where the specified volume lives. For volumes with a CSIVolumeSource, append "/mount" to the directory name.
func IsCRDReady ¶ added in v1.3.0
func IsCRDReady(crd *unstructured.Unstructured) (bool, error)
IsCRDReady triggers IsV1Beta1CRDReady/IsV1CRDReady according to the version of the input param
func IsV1Beta1CRDReady ¶ added in v1.6.3
func IsV1Beta1CRDReady(crd *apiextv1beta1.CustomResourceDefinition) bool
IsV1Beta1CRDReady checks a v1beta1 CRD to see if it's ready, with both the Established and NamesAccepted conditions.
func IsV1CRDReady ¶ added in v1.6.3
func IsV1CRDReady(crd *apiextv1.CustomResourceDefinition) bool
IsV1CRDReady checks a v1 CRD to see if it's ready, with both the Established and NamesAccepted conditions.
func NamespaceAndName ¶ added in v0.4.0
NamespaceAndName returns a string in the format <namespace>/<name>
func ParseResourceRequirements ¶ added in v1.0.1
func ParseResourceRequirements(cpuRequest, memRequest, cpuLimit, memLimit string) (corev1.ResourceRequirements, error)
ParseResourceRequirements takes a set of CPU and memory requests and limit string values and returns a ResourceRequirements struct to be used in a Container. An error is returned if we cannot parse the request/limit.
func ParseSecurityContext ¶ added in v1.5.0
func SinglePathMatch ¶ added in v1.9.1
func SinglePathMatch(path string, fs filesystem.Interface, log logrus.FieldLogger) (string, error)
SinglePathMatch function will be called by PVB and PVR controller to check whether pass-in volume path is valid. Check whether there is only one match by the path's pattern (/host_pods/%s/volumes/*/volume_name/[mount|]).
Types ¶
type PeriodicalEnqueueSource ¶ added in v1.9.0
PeriodicalEnqueueSource is an implementation of interface sigs.k8s.io/controller-runtime/pkg/source/Source It reads the specific resources from Kubernetes/cache and enqueues them into the queue to trigger the reconcile logic periodically
func NewPeriodicalEnqueueSource ¶ added in v1.9.0
func NewPeriodicalEnqueueSource(logger logrus.FieldLogger, client client.Client, objList client.ObjectList, period time.Duration, filters ...func(object client.Object) bool) *PeriodicalEnqueueSource
func (*PeriodicalEnqueueSource) Start ¶ added in v1.9.0
func (p *PeriodicalEnqueueSource) Start(ctx context.Context, h handler.EventHandler, q workqueue.RateLimitingInterface, pre ...predicate.Predicate) error
func (*PeriodicalEnqueueSource) String ¶ added in v1.9.3
func (p *PeriodicalEnqueueSource) String() string
type SpecChangePredicate ¶ added in v1.9.1
SpecChangePredicate implements a default update predicate function on Spec change As Velero doesn't enable subresource in CRDs, we cannot use the object's metadata.generation field to check the spec change More details about the generation field refer to https://github.com/kubernetes-sigs/controller-runtime/blob/v0.12.2/pkg/predicate/predicate.go#L156
func (SpecChangePredicate) Update ¶ added in v1.9.1
func (SpecChangePredicate) Update(e event.UpdateEvent) bool