utils

package
v0.0.0-...-e9741b0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControllerNameKey = "controller"
	OperandLabelKey   = "multiarch.openshift.io/operand"
	OperatorName      = "multiarch-tuning-operator"
)
View Source
const (
	ArchitectureAmd64   = "amd64"
	ArchitectureArm64   = "arm64"
	ArchitecturePpc64le = "ppc64le"
	ArchitectureS390x   = "s390x"
)
View Source
const (
	ArchLabel                       = "kubernetes.io/arch"
	NodeAffinityLabel               = "multiarch.openshift.io/node-affinity"
	NodeAffinityLabelValueSet       = "set"
	LabelValueNotSet                = "not-set"
	HostnameLabel                   = "kubernetes.io/hostname"
	SchedulingGateLabel             = "multiarch.openshift.io/scheduling-gate"
	SchedulingGateLabelValueGated   = "gated"
	SchedulingGateLabelValueRemoved = "removed"
	PodPlacementFinalizerName       = "finalizers.multiarch.openshift.io/pod-placement"
	SingleArchLabel                 = "multiarch.openshift.io/single-arch"
	MultiArchLabel                  = "multiarch.openshift.io/multi-arch"
	NoSupportedArchLabel            = "multiarch.openshift.io/no-supported-arch"
	ImageInspectionErrorLabel       = "multiarch.openshift.io/image-inspect-error"
	ImageInspectionErrorCountLabel  = "multiarch.openshift.io/image-inspect-error-count"
	LabelGroup                      = "multiarch.openshift.io"
)
View Source
const (
	// SchedulingGateName is the name of the Scheduling Gate
	SchedulingGateName            = "multiarch.openshift.io/scheduling-gate"
	MasterNodeSelectorLabel       = "node-role.kubernetes.io/master"
	ControlPlaneNodeSelectorLabel = "node-role.kubernetes.io/control-plane"
)
View Source
const (
	PodMutatingWebhookConfigurationName = "pod-placement-mutating-webhook-configuration"
	PodMutatingWebhookName              = "pod-placement-scheduling-gate.multiarch.openshift.io"
	PodPlacementControllerName          = "pod-placement-controller"
	PodPlacementWebhookName             = "pod-placement-web-hook"
)

Variables

Functions

func AllSupportedArchitecturesSet

func AllSupportedArchitecturesSet() sets.Set[string]

func ApplyResource

func ApplyResource(ctx context.Context, clientSet *kubernetes.Clientset, client *dynamic.DynamicClient, recorder events.Recorder,
	obj client.Object) (client.Object, bool, error)

ApplyResource applies the given object to the cluster. It returns the object as it is in the cluster, a boolean indicating if the object was created or updated and an error if any. TODO[integration-tests]: integration tests for this function in a suite dedicated to this package

func ApplyResources

func ApplyResources(ctx context.Context, clientSet *kubernetes.Clientset, client *dynamic.DynamicClient, recorder events.Recorder,
	objs []client.Object) error

ApplyResources applies the given objects to the cluster. It returns an error if any. TODO[integration-tests]: integration tests for this function in a suite dedicated to this package

func ArchLabelValue

func ArchLabelValue(arch string) string

func Buckets

func Buckets() []float64

func DeleteResource

func DeleteResource(ctx context.Context, namespacedTypedClient DeleterInterface, objName string) error

DeleteResource deletes the given object from the cluster. It returns an error if any. TODO[integration-tests]: integration tests for this function in a suite dedicated to this package

func DeleteResources

func DeleteResources(ctx context.Context, toDeleteRefs []ToDeleteRef) error

DeleteResources deletes the given objects from the cluster. It returns an error if any. TODO[integration-tests]: integration tests for this function in a suite dedicated to this package

func ExtractAuthFromSecret

func ExtractAuthFromSecret(secret *v1.Secret) ([]byte, error)

func HistogramObserve

func HistogramObserve(initialTime time.Time, histogram prometheus.Histogram)

func Image

func Image() string

Image returns the image used to run the operator.

func IsResourceAvailable

func IsResourceAvailable(ctx context.Context, client *dynamic.DynamicClient, resource schema.GroupVersionResource) bool

func Namespace

func Namespace() string

Namespace returns the namespace where the operator's pods are running.

func NewPtr

func NewPtr[T any](a T) *T

Types

type DeleterInterface

type DeleterInterface interface {
	Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
}

DeleterInterface abstracts the Delete method of a typed and namespaced client got from a clientset

func NewDynamicDeleter

func NewDynamicDeleter(dynamicClient dynamic.ResourceInterface) DeleterInterface

type ToDeleteRef

type ToDeleteRef struct {
	NamespacedTypedClient DeleterInterface
	ObjName               string
}

Jump to

Keyboard shortcuts

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