Documentation ¶
Index ¶
- func EnsureNamespaceExistsAndIsReady(namespace *corev1api.Namespace, client corev1client.NamespaceInterface, ...) (bool, bool, error)
- func GetClusterClient() (*kubernetes.Clientset, *apiextensionsclientset.Clientset, error)
- func GetSecret(client kbclient.Client, namespace, name string) (*corev1api.Secret, error)
- func GetSecretKey(client kbclient.Client, namespace string, ...) ([]byte, error)
- func GetVolumeDirectory(pod *corev1api.Pod, volumeName string, ...) (string, error)
- func IsCRDReady(crd *apiextv1beta1.CustomResourceDefinition) bool
- func IsUnstructuredCRDReady(crd *unstructured.Unstructured) (bool, error)
- 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)
Constants ¶
This section is empty.
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 GetClusterClient ¶ added in v1.6.0
func GetClusterClient() (*kubernetes.Clientset, *apiextensionsclientset.Clientset, error)
GetClusterClient instantiates and returns a client for the cluster.
func GetSecretKey ¶ added in v1.6.0
func GetVolumeDirectory ¶ added in v0.9.0
func GetVolumeDirectory(pod *corev1api.Pod, volumeName string, pvcLister corev1listers.PersistentVolumeClaimLister, pvLister corev1listers.PersistentVolumeLister) (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 *apiextv1beta1.CustomResourceDefinition) bool
IsCRDReady checks a CRD to see if it's ready, with both the Established and NamesAccepted conditions.
func IsUnstructuredCRDReady ¶ added in v1.3.0
func IsUnstructuredCRDReady(crd *unstructured.Unstructured) (bool, error)
IsUnstructuredCRDReady checks an unstructured CRD to see if it's ready, with both the Established and NamesAccepted conditions. TODO: Delete this function and use IsCRDReady when the upstream runtime.FromUnstructured function properly handles int64 field conversions. Duplicated function because the velero install package uses IsCRDReady with the beta types. See https://github.com/kubernetes/kubernetes/issues/87675 This is different from the fix for https://github.com/vmware-tanzu/velero/issues/2319 because here, we need to account for *both* v1beta1 and v1 CRDs, so doing marshalling into JSON to convert to a Go type may not be as useful here, unless we do type switching.
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
Types ¶
This section is empty.