Documentation
¶
Index ¶
- Constants
- func AddFinalizer(obj client.Object)
- func AppendUniqueImagePullSecrets(existing, additional []corev1.LocalObjectReference) []corev1.LocalObjectReference
- func ContainsFinalizer(obj client.Object) bool
- func CopySpec(source, destination client.Object) error
- func DetectDRAAvailability(ctx context.Context, mgr ctrl.Manager) bool
- func DetectGroveAvailability(ctx context.Context, mgr ctrl.Manager) bool
- func DetectInferencePoolAvailability(ctx context.Context, mgr ctrl.Manager) bool
- func DetectIstioAvailability(ctx context.Context, mgr ctrl.Manager) bool
- func DetectKaiSchedulerAvailability(ctx context.Context, mgr ctrl.Manager) bool
- func DetectLWSAvailability(ctx context.Context, mgr ctrl.Manager) bool
- func DetectVolcanoAvailability(ctx context.Context, mgr ctrl.Manager) bool
- func EphemeralDeploymentEventFilter(config *configv1alpha1.OperatorConfiguration, runtimeConfig *RuntimeConfig) predicate.Predicate
- func GetDiscoveryBackend(discoveryBackend configv1alpha1.DiscoveryBackend, ...) configv1alpha1.DiscoveryBackend
- func GetKubeDiscoveryMode(annotations map[string]string) configv1alpha1.KubeDiscoveryMode
- func GetResourceHash(obj any) (string, error)
- func GetResourcesConfig(resources *v1alpha1.Resources) (*corev1.ResourceRequirements, error)
- func GetSpecHash(obj client.Object) (string, error)
- func HandleFinalizer[T client.Object](ctx context.Context, obj T, writer client.Writer, finalizer Finalizer[T]) (bool, error)
- func IsK8sDiscoveryEnabled(discoveryBackend configv1alpha1.DiscoveryBackend, ...) bool
- func RemoveFinalizer(obj client.Object)
- func ScaleResource(ctx context.Context, scaleClient scale.ScalesGetter, ...) error
- func SortKeys(obj interface{}) interface{}
- func SyncResource[T client.Object](ctx context.Context, r Reconciler, parentResource client.Object, ...) (modified bool, res T, err error)
- type ExcludedNamespacesInterface
- type Finalizer
- type Reconciler
- type Resource
- type ResourceGenerator
- type RuntimeConfig
- type SpecChangeResult
Constants ¶
const ( // NvidiaAnnotationHashKey indicates annotation name for last applied hash by the operator NvidiaAnnotationHashKey = "nvidia.com/last-applied-hash" // NvidiaAnnotationGenerationKey indicates annotation name for last applied generation by the operator // This is used to detect manual changes to resources NvidiaAnnotationGenerationKey = "nvidia.com/last-applied-generation" )
Variables ¶
This section is empty.
Functions ¶
func AddFinalizer ¶
func AppendUniqueImagePullSecrets ¶
func AppendUniqueImagePullSecrets(existing, additional []corev1.LocalObjectReference) []corev1.LocalObjectReference
AppendUniqueImagePullSecrets appends secrets to existing, skipping any that already exist by name.
func ContainsFinalizer ¶
func DetectDRAAvailability ¶
DetectDRAAvailability checks if Dynamic Resource Allocation is available by checking if the resource.k8s.io API group is registered (Kubernetes 1.32+)
func DetectGroveAvailability ¶
DetectGroveAvailability checks if Grove is available by checking if the Grove API group is registered
func DetectInferencePoolAvailability ¶
DetectInferencePoolAvailability checks if the Gateway API Inference Extension is available by checking if the inference.networking.k8s.io API group is registered
func DetectIstioAvailability ¶
DetectIstioAvailability checks if Istio is available by checking if the networking.istio.io API group is registered. Used to guard DestinationRule reconciliation so the operator doesn't error on clusters without Istio CRDs.
func DetectKaiSchedulerAvailability ¶
DetectKaiSchedulerAvailability checks if Kai-scheduler is available by checking if the scheduling.run.ai API group is registered
func DetectLWSAvailability ¶
DetectLWSAvailability checks if LWS is available by checking if the LWS API group is registered
func DetectVolcanoAvailability ¶
DetectVolcanoAvailability checks if Volcano is available by checking if the Volcano API group is registered
func EphemeralDeploymentEventFilter ¶
func EphemeralDeploymentEventFilter(config *configv1alpha1.OperatorConfiguration, runtimeConfig *RuntimeConfig) predicate.Predicate
EphemeralDeploymentEventFilter returns a predicate that filters events based on namespace configuration.
func GetDiscoveryBackend ¶
func GetDiscoveryBackend(discoveryBackend configv1alpha1.DiscoveryBackend, annotations map[string]string) configv1alpha1.DiscoveryBackend
GetDiscoveryBackend returns the discovery backend for the given annotations, falling back to the configured default. For DGD, pass in the meta annotations; for DCD, pass in the spec annotations.
func GetKubeDiscoveryMode ¶
func GetKubeDiscoveryMode(annotations map[string]string) configv1alpha1.KubeDiscoveryMode
GetKubeDiscoveryMode returns the kube discovery mode from annotations, defaulting to pod mode.
func GetResourceHash ¶
GetResourceHash returns a consistent hash for the given object spec
func GetResourcesConfig ¶
func GetResourcesConfig(resources *v1alpha1.Resources) (*corev1.ResourceRequirements, error)
func HandleFinalizer ¶
func IsK8sDiscoveryEnabled ¶
func IsK8sDiscoveryEnabled(discoveryBackend configv1alpha1.DiscoveryBackend, annotations map[string]string) bool
IsK8sDiscoveryEnabled returns whether Kubernetes discovery is enabled for the given annotations.
func RemoveFinalizer ¶
func ScaleResource ¶
func ScaleResource(ctx context.Context, scaleClient scale.ScalesGetter, gvr schema.GroupVersionResource, namespace, name string, replicas int32) error
ScaleResource scales any Kubernetes resource using the Scale subresource
func SortKeys ¶
func SortKeys(obj interface{}) interface{}
SortKeys recursively sorts the keys of a map to ensure consistent serialization
func SyncResource ¶
func SyncResource[T client.Object](ctx context.Context, r Reconciler, parentResource client.Object, generateResource ResourceGenerator[T]) (modified bool, res T, err error)
Types ¶
type ExcludedNamespacesInterface ¶
ExcludedNamespacesInterface defines the interface for checking namespace exclusions
type Reconciler ¶
type Reconciler interface {
client.Client
GetRecorder() record.EventRecorder
}
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func NewResource ¶
func (*Resource) GetServiceStatuses ¶
func (r *Resource) GetServiceStatuses() map[string]v1alpha1.ServiceReplicaStatus
type ResourceGenerator ¶
ResourceGenerator is a function that generates a resource. it must return the resource, a boolean indicating if the resource should be deleted, and an error if the resource should be deleted, the returned resource must contain the necessary information to delete it (name and namespace)
type RuntimeConfig ¶
type RuntimeConfig struct {
// GroveEnabled is the resolved Grove availability (config override merged with auto-detection)
GroveEnabled bool
// LWSEnabled is the resolved LWS availability (config override merged with auto-detection)
LWSEnabled bool
// KaiSchedulerEnabled is the resolved Kai-scheduler availability (config override merged with auto-detection)
KaiSchedulerEnabled bool
// DRAEnabled indicates whether Dynamic Resource Allocation (resource.k8s.io) is available
DRAEnabled bool
// IstioAvailable indicates whether the networking.istio.io CRDs are installed.
// When false the operator skips DestinationRule reconciliation to avoid errors
// on clusters without Istio.
IstioAvailable bool
// ExcludedNamespaces for cluster-wide mode namespace filtering
ExcludedNamespaces ExcludedNamespacesInterface
}
RuntimeConfig holds runtime state that is resolved after startup (e.g., auto-detection results). This is separate from the static OperatorConfiguration loaded from config files.
type SpecChangeResult ¶
type SpecChangeResult struct {
// NewHash is the hash to set in the annotation (nil if no update needed)
NewHash *string
// NewGeneration is the generation to set in the annotation
NewGeneration int64
// NeedsUpdate indicates whether the resource needs to be updated
NeedsUpdate bool
// ManualChangeDetected indicates whether a manual change was detected
ManualChangeDetected bool
}
SpecChangeResult contains the result of spec change detection
func GetSpecChangeResult ¶
GetSpecChangeResult determines if a resource needs to be updated by comparing the desired spec hash with the last applied hash annotation. It also tracks generation to detect manual changes.
Returns:
- SpecChangeResult with update information
- error if hash computation fails