Documentation
¶
Index ¶
- Constants
- Variables
- func AllSupportedArchitecturesSet() sets.Set[string]
- func ApplyResource(ctx context.Context, clientSet *kubernetes.Clientset, ...) (client.Object, bool, error)
- func ApplyResources(ctx context.Context, clientSet *kubernetes.Clientset, ...) error
- func ArchLabelValue(arch string) string
- func Buckets() []float64
- func DeleteResource(ctx context.Context, namespacedTypedClient DeleterInterface, objName string) error
- func DeleteResources(ctx context.Context, toDeleteRefs []ToDeleteRef) error
- func ExecFormatErrorEventMessage(containerName, nodeArch string) string
- func ExtractAuthFromSecret(secret *v1.Secret) ([]byte, error)
- func HistogramObserve(initialTime time.Time, histogram prometheus.Histogram)
- func Image() string
- func IsResourceAvailable(ctx context.Context, client *dynamic.DynamicClient, ...) bool
- func Namespace() string
- func NewPtr[T any](a T) *T
- func ShouldStdErr(fn func() error)
- func ToZapLevel(level int) (zapcore.Level, error)
- type DeleterInterface
- type ToDeleteRef
Constants ¶
const ( ControllerNameKey = "controller" OperandLabelKey = "multiarch.openshift.io/operand" OperatorName = "multiarch-tuning-operator" )
const ( ArchitectureAmd64 = "amd64" ArchitectureArm64 = "arm64" ArchitecturePpc64le = "ppc64le" ArchitectureS390x = "s390x" )
const ( ArchLabel = "kubernetes.io/arch" NodeAffinityLabel = "multiarch.openshift.io/node-affinity" PreferredNodeAffinityLabel = "multiarch.openshift.io/preferred-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" )
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" )
const ( PodMutatingWebhookConfigurationName = "pod-placement-mutating-webhook-configuration" PodMutatingWebhookName = "pod-placement-scheduling-gate.multiarch.openshift.io" PodPlacementControllerName = "pod-placement-controller" PodPlacementWebhookName = "pod-placement-web-hook" )
const ( ExecFormatErrorFinalizerName = "finalizers.multiarch.openshift.io/enoexec-events" ExecFormatErrorLabelKey = "multiarch.openshift.io/exec-format-error" True = "true" False = "false" ExecFormatErrorsDetected = "ExecFormatErrorsDetected" ExecFormatErrorEventReason = "ExecFormatError" UnknownContainer = "unknown-container" // Used when the container name is not known or not provided EnoexecControllerName = "enoexec-event-handler-controller" EnoexecDaemonSet = "enoexec-event-daemon" )
Variables ¶
var AtomicLevel zap.AtomicLevel = zap.NewAtomicLevelAt(-5)
Functions ¶
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 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 ExecFormatErrorEventMessage ¶ added in v1.2.0
func HistogramObserve ¶
func HistogramObserve(initialTime time.Time, histogram prometheus.Histogram)
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 ShouldStdErr ¶ added in v1.2.0
func ShouldStdErr(fn func() error)
func ToZapLevel ¶ added in v1.2.2
ToZapLevel converts an int log level to zapcore.Level with overflow validation. The input is negated before conversion (positive values become negative for zap). Returns an error if the value would overflow int8 range (-128 to 127).
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
}