common

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GPUJob = &batchv1.Job{
	ObjectMeta: metav1.ObjectMeta{
		Name: "gpu-job",
	},
	Spec: batchv1.JobSpec{
		Template: v1.PodTemplateSpec{
			ObjectMeta: metav1.ObjectMeta{
				Name: "gpu-pod",
			},
			Spec: v1.PodSpec{
				RestartPolicy: "Never",
				Containers: []v1.Container{
					{
						Name:  "cuda-container",
						Image: "nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda10.2",
						Resources: v1.ResourceRequirements{
							Limits: v1.ResourceList{
								"nvidia.com/gpu": resource.MustParse("1"),
							},
						},
					},
				},
				Tolerations: []v1.Toleration{
					{
						Key:      "nvidia.com/gpu",
						Operator: "Exists",
						Effect:   "NoSchedule",
					},
				},
			},
		},
	},
}

Define the Job

Functions

func CleanupNFDObjects

func CleanupNFDObjects(ctx context.Context, cli *nfdclient.Clientset, namespace string)

func CleanupNode

func CleanupNode(ctx context.Context, cs clientset.Interface)

CleanupNode deletes all NFD/GFD related metadata from the Node object, i.e. labels and annotations

func DeleteTaint

func DeleteTaint(taints []corev1.Taint, taintToDelete *corev1.Taint) ([]corev1.Taint, bool)

DeleteTaint removes all the taints that have the same key and effect to given taintToDelete.

func GetNode

func GetNode(nodes []corev1.Node, nodeName string) corev1.Node

func GetNonControlPlaneNodes

func GetNonControlPlaneNodes(ctx context.Context, cli clientset.Interface) ([]corev1.Node, error)

GetNonControlPlaneNodes gets the nodes that are not tainted for exclusive control-plane usage

func MustGather

func MustGather(component, namespace, artifactDir string) error

func TaintExists

func TaintExists(taints []corev1.Taint, taintToFind *corev1.Taint) bool

TaintExists checks if the given taint exists in list of taints. Returns true if exists false otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL