Documentation ¶
Index ¶
- Constants
- func AppendKurlLabels(labels map[string]string) map[string]string
- func ExecContainer(ctx context.Context, opts ExecOptions, ...) (int, error)
- func IsDeploymentReady(dep appsv1.Deployment, desiredReplication int32) bool
- func IsPodReady(pod corev1.Pod) bool
- func KubectlApply(ctx context.Context, cli client.Client, resources embed.FS, overlay string, ...) error
- func KubectlDelete(ctx context.Context, b []byte, args ...string) ([]byte, error)
- func ListPodsBySelector(ctx context.Context, clientset kubernetes.Interface, namespace string, ...) (*corev1.PodList, error)
- func NodeInternalIP(node corev1.Node) (string, error)
- func NodeInternalIPByNodeName(nodes []corev1.Node, nodeName string) (string, error)
- func PVCSForPVs(ctx context.Context, cli kubernetes.Interface, ...) (map[string]corev1.PersistentVolumeClaim, error)
- func PVSByStorageClass(ctx context.Context, cli kubernetes.Interface, scname string) (map[string]corev1.PersistentVolume, error)
- func PVSReservationPerNode(ctx context.Context, cli kubernetes.Interface, scname string) (map[string]int64, int64, error)
- func PodHasPVC(pod corev1.Pod, pvcNamespace, pvcName string) bool
- func RunJob(ctx context.Context, cli kubernetes.Interface, logger *log.Logger, ...) (map[string][]byte, map[string]corev1.ContainerState, error)
- func SyncExec(coreClient corev1client.CoreV1Interface, clientConfig *restclient.Config, ...) (int, string, string, error)
- func TolerationsForAllNodes(ctx context.Context, cli kubernetes.Interface) ([]corev1.Toleration, error)
- func TolerationsForNode(node corev1.Node) []corev1.Toleration
- func WaitForDaemonsetRollout(ctx context.Context, cli kubernetes.Interface, ds *appsv1.DaemonSet, ...) error
- func WaitForDeploymentReady(ctx context.Context, clientset kubernetes.Interface, namespace, name string, ...) error
- func WaitForJob(ctx context.Context, cli kubernetes.Interface, job *batchv1.Job, ...) (bool, error)
- func WaitForPodReady(ctx context.Context, clientset kubernetes.Interface, namespace, name string) error
- type ExecOptions
- type StreamOptions
Constants ¶
const ( // LabelKeyKurlshManaged is the metadata label key for kurl.sh managed resources LabelKeyKurlshManaged = "kurl.sh/managed" // LabelKeyKurlshVersion is the metadata label key for kurl.sh version LabelKeyKurlshVersion = "kurl.sh/version" )
Variables ¶
This section is empty.
Functions ¶
func AppendKurlLabels ¶
AppendKurlLabels appends kurl.sh managed labels to the given map
func ExecContainer ¶
func ExecContainer(ctx context.Context, opts ExecOptions, terminalSizeQueue remotecommand.TerminalSizeQueue) (int, error)
ExecContainer executes a remote execution against a pod. Returns exit code and error. The error will be non-nil if exit code is not 0.
func IsDeploymentReady ¶
func IsDeploymentReady(dep appsv1.Deployment, desiredReplication int32) bool
IsDeploymentReady returns true if the provided deployment is ready and up-to-date.
func IsPodReady ¶
IsPodReady returns true if provided pod is ready.
func KubectlApply ¶
func KubectlDelete ¶
func ListPodsBySelector ¶
func ListPodsBySelector(ctx context.Context, clientset kubernetes.Interface, namespace string, selector string) (*corev1.PodList, error)
ListPodsBySelector returns a list of pods matching the provided selector.
func NodeInternalIP ¶
NodeInternalIP returns the node internal ip address for the provided node.
func NodeInternalIPByNodeName ¶
NodeInternalIPByNodeName returns the node internal ip address for the provided node name.
func PVCSForPVs ¶
func PVCSForPVs(ctx context.Context, cli kubernetes.Interface, pvs map[string]corev1.PersistentVolume) (map[string]corev1.PersistentVolumeClaim, error)
PVCSForPVs returns a pv to pvc mapping. the returned map is indexed by the pv name.
func PVSByStorageClass ¶
func PVSByStorageClass(ctx context.Context, cli kubernetes.Interface, scname string) (map[string]corev1.PersistentVolume, error)
PVSByStorageClass returns a map of persistent volumes using the provided storage class name. returned pvs map is indexed by pv's name.
func PVSReservationPerNode ¶
func PVSReservationPerNode(ctx context.Context, cli kubernetes.Interface, scname string) (map[string]int64, int64, error)
PVSReservationPerNode return the sum of space of all pvs being served per node. this function also returns sum of space in pvs that exist bur are not in attached to any pod.
func RunJob ¶
func RunJob(ctx context.Context, cli kubernetes.Interface, logger *log.Logger, job *batchv1.Job, timeout time.Duration) (map[string][]byte, map[string]corev1.ContainerState, error)
RunJob runs the provided job and waits until it finishes or the timeout is reached. returns the job's pod logs (indexed by container name) and the state of each of the containers (also indexed by container name).
func SyncExec ¶
func SyncExec(coreClient corev1client.CoreV1Interface, clientConfig *restclient.Config, ns, pod, container string, command ...string) (int, string, string, error)
SyncExec returns exitcode, stdout, stderr. A non-zero exit code from the command is not considered an error.
func TolerationsForAllNodes ¶
func TolerationsForAllNodes(ctx context.Context, cli kubernetes.Interface) ([]corev1.Toleration, error)
func TolerationsForNode ¶
func TolerationsForNode(node corev1.Node) []corev1.Toleration
TolerationsForNode returns a list of tolerations that matches the provided node.
func WaitForDaemonsetRollout ¶
func WaitForDaemonsetRollout(ctx context.Context, cli kubernetes.Interface, ds *appsv1.DaemonSet, timeout time.Duration) error
WaitForDaemonsetRollout waits for a daemonset to rollout.
func WaitForDeploymentReady ¶
func WaitForDeploymentReady(ctx context.Context, clientset kubernetes.Interface, namespace, name string, desiredReplication int32) error
WaitForDeploymentReady polls every 5 seconds until either the provided deployment is ready and up-to-date or the context is closed.
func WaitForJob ¶
func WaitForJob(ctx context.Context, cli kubernetes.Interface, job *batchv1.Job, timeout time.Duration) (bool, error)
WaitForJob waits for a job to finish. returns a boolean indicating if the job succeeded.
func WaitForPodReady ¶
func WaitForPodReady(ctx context.Context, clientset kubernetes.Interface, namespace, name string) error
WaitForPodReady polls every 5 seconds until either the provided pof is ready or the context is closed.
Types ¶
type ExecOptions ¶
type ExecOptions struct { StreamOptions Command []string CoreClient corev1client.CoreV1Interface Config *restclient.Config }