controller

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectionPolicyReconciler

type CollectionPolicyReconciler struct {
	client.Client
	Scheme            *runtime.Scheme
	Log               logr.Logger
	KEDAClient        *kedaclient.Clientset
	K8sClient         *kubernetes.Clientset
	DynamicClient     *dynamic.DynamicClient
	MetadataClient    metadata.Interface
	DiscoveryClient   *discovery.DiscoveryClient
	DakrClient        transport.DakrClient
	ApiExtensions     *apiextensionsclientset.Clientset
	CollectionManager *collector.CollectionManager
	MpaServer         *server.MpaServer
	Sender            transport.DirectSender
	TelemetrySender   *transport.TelemetrySender
	TelemetryMetrics  *collector.TelemetryMetrics
	TelemetryLogger   telemetry_logger.Logger
	ZapLogger         *zap.Logger
	IsRunning         bool
	CurrentPolicyHash string
	CurrentConfig     *PolicyConfig
	RestartInProgress bool
	MpaServerPort     int
	HealthManager     *health.HealthManager
	// contains filtered or unexported fields
}

CollectionPolicyReconciler reconciles a CollectionPolicy object

func (*CollectionPolicyReconciler) Reconcile

func (r *CollectionPolicyReconciler) Reconcile(
	ctx context.Context,
	req ctrl.Request,
) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

func (*CollectionPolicyReconciler) SetupWithManager

func (r *CollectionPolicyReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type EnvBasedController

type EnvBasedController struct {
	client.Client
	Scheme          *runtime.Scheme
	Log             logr.Logger
	K8sClient       kubernetes.Interface
	DynamicClient   *dynamic.DynamicClient
	DiscoveryClient *discovery.DiscoveryClient
	ApiExtensions   *apiextensionsclientset.Clientset
	Reconciler      *CollectionPolicyReconciler
	// contains filtered or unexported fields
}

EnvBasedController is a controller that uses environment variables instead of CRDs

func NewEnvBasedController

func NewEnvBasedController(
	mgr ctrl.Manager,
	healthManager *health.HealthManager,
	reconcileInterval time.Duration,
	mpaServerPort int,
) (*EnvBasedController, error)

NewEnvBasedController creates a new environment-based controller

func (*EnvBasedController) NeedLeaderElection

func (c *EnvBasedController) NeedLeaderElection() bool

NeedLeaderElection implements the LeaderElectionRunnable interface

func (*EnvBasedController) Start

func (c *EnvBasedController) Start(ctx context.Context) error

Start implements the Runnable interface for manager.Add

type GPURuntimeResolver added in v0.1.0

type GPURuntimeResolver struct {
	// contains filtered or unexported fields
}

GPURuntimeResolver keeps the managed GPU DaemonSet's RuntimeClass in sync with the RuntimeClass API when the DaemonSet opts into auto mode.

func NewGPURuntimeResolver added in v0.1.0

func NewGPURuntimeResolver(
	c client.Client,
	apiReader client.Reader,
	namespace string,
	interval time.Duration,
	healthManager *health.HealthManager,
) *GPURuntimeResolver

NewGPURuntimeResolver builds the resolver. apiReader must be an uncached reader (mgr.GetAPIReader()): the RuntimeClass read is served by a direct GET, which the narrow get-on-resourceName RBAC allows. The manager's cached client would instead back the read with a cluster-wide LIST+WATCH informer, which the resolver's RBAC intentionally forbids, so a cached read blocks forever on a cache that can never sync. client is used for the DaemonSet patch (and its already-permitted cached read).

func (*GPURuntimeResolver) NeedLeaderElection added in v0.1.0

func (r *GPURuntimeResolver) NeedLeaderElection() bool

NeedLeaderElection makes the resolver run only on the elected manager.

func (*GPURuntimeResolver) ReconcileOnce added in v0.1.0

func (r *GPURuntimeResolver) ReconcileOnce(ctx context.Context) error

ReconcileOnce resolves and, when necessary, merge-patches the managed GPU DaemonSet. Conflicts retry the entire transaction so every attempt computes desired state from a fresh DaemonSet read.

func (*GPURuntimeResolver) Start added in v0.1.0

func (r *GPURuntimeResolver) Start(ctx context.Context) error

Start implements the controller-manager Runnable interface.

type PolicyConfig

type PolicyConfig struct {
	TargetNamespaces                   []string
	ExcludedNamespaces                 []string
	ExcludedPods                       []collector.ExcludedPod
	ExcludedDeployments                []collector.ExcludedDeployment
	ExcludedStatefulSets               []collector.ExcludedStatefulSet
	ExcludedDaemonSets                 []collector.ExcludedDaemonSet
	ExcludedServices                   []collector.ExcludedService
	ExcludedPVCs                       []collector.ExcludedPVC
	ExcludedEvents                     []collector.ExcludedEvent
	ExcludedJobs                       []collector.ExcludedJob
	ExcludedCronJobs                   []collector.ExcludedCronJob
	ExcludedReplicationControllers     []collector.ExcludedReplicationController
	ExcludedIngresses                  []collector.ExcludedIngress
	ExcludedNetworkPolicies            []collector.ExcludedNetworkPolicy
	ExcludedEndpoints                  []collector.ExcludedEndpoint
	ExcludedServiceAccounts            []collector.ExcludedServiceAccount
	ExcludedLimitRanges                []collector.ExcludedLimitRange
	ExcludedResourceQuotas             []collector.ExcludedResourceQuota
	ExcludedHPAs                       []collector.ExcludedHPA
	ExcludedVPAs                       []collector.ExcludedVPA
	ExcludedRoles                      []collector.ExcludedRole
	ExcludedRoleBindings               []collector.ExcludedRoleBinding
	ExcludedClusterRoles               []string
	ExcludedClusterRoleBindings        []string
	ExcludedPDBs                       []collector.ExcludedPDB
	ExcludedPSPs                       []string
	ExcludedCRDs                       []string
	ExcludedReplicaSet                 []collector.ExcludedReplicaSet
	ExcludedStorageClasses             []string
	ExcludedPVs                        []string
	ExcludedIngressClasses             []string
	ExcludedNodes                      []string
	ExcludedCRDGroups                  []string
	WatchedCRDs                        []string
	ExcludedCSINodes                   []string
	ExcludedDatadogReplicaSets         []collector.ExcludedDatadogExtendedDaemonSetReplicaSet
	ExcludedArgoRollouts               []collector.ExcludedArgoRollout
	ExcludedKedaScaledJobs             []collector.ExcludedScaledJob
	ExcludedKedaScaledObjects          []collector.ExcludedScaledObject
	ExcludedCSIDrivers                 []string
	ExcludedCSIStorageCapacities       []collector.ExcludedCSIStorageCapacity
	ExcludedVolumeAttachments          []string
	ExcludedKubeflowNotebooks          []collector.ExcludedKubeflowNotebook
	ExcludedVolcanoJobs                []collector.ExcludedVolcanoJob
	ExcludedSparkApplications          []collector.ExcludedSparkApplication
	ExcludedScheduledSparkApplications []collector.ExcludedScheduledSparkApplication
	ExcludedCNPGClusters               []collector.ExcludedCNPGCluster

	DisabledCollectors []string

	// MigPartedConfigMapName/Namespace locate the NVIDIA mig-parted ConfigMap;
	// empty values fall back to the GPU operator defaults.
	MigPartedConfigMapName      string
	MigPartedConfigMapNamespace string

	KubeContextName         string
	DakrURL                 string
	ClusterToken            string
	DisableGPUMetrics       bool
	UpdateInterval          time.Duration
	NodeMetricsInterval     time.Duration
	ClusterSnapshotInterval time.Duration
	BufferSize              int
	MaskSecretData          bool
	NumResourceProcessors   int
	NodeMetricsConcurrency  int
	NodemonRequestTimeout   time.Duration
	KubeletFallbackTimeout  time.Duration
}

PolicyConfig holds the current configuration

Jump to

Keyboard shortcuts

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