resources

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Index

Constants

View Source
const (
	LabelKeyNvidia    = "accelerator"
	LabelValueNvidia  = "nvidia"
	CapacityNvidiaGPU = "nvidia.com/gpu"
)

Variables

This section is empty.

Functions

func CheckNvidiaPlugin

func CheckNvidiaPlugin(ctx context.Context, nodeObj *corev1.Node) bool

func CheckResourceStatus

func CheckResourceStatus(obj client.Object, kubeClient client.Client, timeoutDuration time.Duration) error

func CreateResource

func CreateResource(ctx context.Context, resource client.Object, kubeClient client.Client) error

func EnsureConfigOrCopyFromDefault added in v0.4.1

func EnsureConfigOrCopyFromDefault(ctx context.Context, kubeClient client.Client,
	userProvided, systemDefault client.ObjectKey,
) (*corev1.ConfigMap, error)

EnsureConfigOrCopyFromDefault handles two scenarios: 1. User provided config:

  • Check if it exists in the target namespace
  • If not found, return error as this is user-specified

2. No user config specified:

  • Use the default config template
  • Check if it exists in the target namespace
  • If not, copy from release namespace to target namespace

func ExtractObjFields

func ExtractObjFields(obj interface{}) (instanceType, namespace, name string, labelSelector *metav1.LabelSelector,
	nameLabel, namespaceLabel string, err error)

func GetNode

func GetNode(ctx context.Context, nodeName string, kubeClient client.Client) (*corev1.Node, error)

GetNode get kubernetes node object with a provided name

func GetResource

func GetResource(ctx context.Context, name, namespace string, kubeClient client.Client, resource client.Object) error

func ListNodes

func ListNodes(ctx context.Context, kubeClient client.Client, labelSelector client.MatchingLabels) (*corev1.NodeList, error)

ListNodes get list of kubernetes nodes

func UpdateNodeWithLabel

func UpdateNodeWithLabel(ctx context.Context, nodeName, labelKey, labelValue string, kubeClient client.Client) error

UpdateNodeWithLabel update the node object with the label key/value

Types

This section is empty.

Jump to

Keyboard shortcuts

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