controllers

package
v0.0.0-...-fb1850d Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DiscoveryConfig types.NamespacedName
)
View Source
var ErrBadFormat = errors.New("bad format")

Functions

func GetDiscoveryConfig

func GetDiscoveryConfig() types.NamespacedName

Types

type DiscoveredClusterReconciler

type DiscoveredClusterReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

DiscoveredClusterReconciler reconciles a DiscoveredCluster object

func (*DiscoveredClusterReconciler) CreateAutoImportSecret

func (r *DiscoveredClusterReconciler) CreateAutoImportSecret(nn types.NamespacedName, clusterID, apiToken string,
) *corev1.Secret

CreateAutoImportSecret creates an auto-import secret for the given NamespacedName and DiscoveryConfig. It constructs a Secret object with the specified name, namespace, and credential from the DiscoveryConfig. Other fields like api_url, token_url, and cluster_id are left empty. It sets the retry_times field to a default value of "2". The secret type is set to "auto-import/rosa".

func (*DiscoveredClusterReconciler) CreateKlusterletAddonConfig

func (r *DiscoveredClusterReconciler) CreateKlusterletAddonConfig(nn types.NamespacedName,
) *agentv1.KlusterletAddonConfig

createKlusterletAddonConfig creates a KlusterletAddonConfig object with the specified NamespacedName. It sets the basic configuration for the KlusterletAddonConfig, including metadata and spec fields. It also initializes the ClusterLabels with default values and enables various addon configurations.

func (*DiscoveredClusterReconciler) CreateManagedCluster

CreateManagedCluster creates a ManagedCluster object with the specified NamespacedName. It sets default labels and annotations for the ManagedCluster. It also adds a finalizer for cleanup.

func (*DiscoveredClusterReconciler) CreateNamespaceForDiscoveredCluster

func (r *DiscoveredClusterReconciler) CreateNamespaceForDiscoveredCluster(dc discovery.DiscoveredCluster,
) *corev1.Namespace

CreateNamespaceForDiscoveredCluster creates a Namespace object for the specified DiscoveredCluster. It sets the Namespace's metadata including Name and Labels. The Namespace is labeled for cluster monitoring with a label indicating its purpose.

func (*DiscoveredClusterReconciler) EnsureAutoImportSecret

EnsureAutoImportSecret ensures the existence of an auto-import secret for the given DiscoveredCluster and DiscoveryConfig. It checks if an auto-import secret with the specified name and namespace exists. If not found, it creates a new auto-import secret with the name "auto-import-secret" and the DiscoveredCluster's namespace. It sets a controller reference to the DiscoveredCluster for ownership management. If creation fails, it logs an error and returns with a requeue signal. If the auto-import secret already exists or if an error occurs during retrieval, it logs an error and returns with a requeue signal.

func (*DiscoveredClusterReconciler) EnsureCRDExist

func (r *DiscoveredClusterReconciler) EnsureCRDExist(ctx context.Context, crdName string) (ctrl.Result, error)

EnsureCRDExist checks if a Custom Resource Definition (CRD) with the specified name exists in the cluster. If the CRD exists, it returns indicating that the reconciliation should continue without requeueing. If the CRD doesn't exist, it logs a message indicating that the CRD was not found and returns. If an error occurs while getting the CRD (other than IsNotFound), it logs an error message and returns an error.

func (*DiscoveredClusterReconciler) EnsureFinalizerRemovedFromManagedCluster

func (r *DiscoveredClusterReconciler) EnsureFinalizerRemovedFromManagedCluster(ctx context.Context,
	dc discovery.DiscoveredCluster) (ctrl.Result, error)

EnsureFinalizerRemovedFromManagedCluster ...

func (*DiscoveredClusterReconciler) EnsureKlusterletAddonConfig

func (r *DiscoveredClusterReconciler) EnsureKlusterletAddonConfig(ctx context.Context, dc discovery.DiscoveredCluster) (
	ctrl.Result, error)

EnsureKlusterletAddonConfig ensures the existence of a KlusterletAddonConfig resource for the given DiscoveredCluster. It checks if a KlusterletAddonConfig with the specified display name exists. If not found, it creates a new KlusterletAddonConfig with the display name and default configurations. It sets a controller reference to the DiscoveredCluster for ownership management. If creation fails, it logs an error and returns with a requeue signal. If the KlusterletAddonConfig already exists or if an error occurs during retrieval, it logs an error and returns with a requeue signal.

func (*DiscoveredClusterReconciler) EnsureManagedCluster

EnsureManagedCluster ensures the existence of a ManagedCluster resource for the given DiscoveredCluster. It checks if a ManagedCluster with the specified display name exists. If not found, it creates a new ManagedCluster with the display name and default configurations. It sets a controller reference to the DiscoveredCluster for ownership management. If creation fails, it logs an error and returns with a requeue signal. If the ManagedCluster already exists or if an error occurs during retrieval, it logs an error and returns with a requeue signal.

func (*DiscoveredClusterReconciler) EnsureNamespaceForDiscoveredCluster

func (r *DiscoveredClusterReconciler) EnsureNamespaceForDiscoveredCluster(ctx context.Context,
	dc discovery.DiscoveredCluster) (ctrl.Result, error)

EnsureNamespaceForDiscoveredCluster ensures the existence of a Namespace for the given DiscoveredCluster. It checks if a Namespace with the specified display name exists. If not found, it creates a new Namespace with the display name. It sets a controller reference to the DiscoveredCluster for ownership management. If creation fails, it returns with a requeue signal. If an error occurs during retrieval or creation, it logs an error and returns with a requeue signal.

func (*DiscoveredClusterReconciler) Reconcile

func (*DiscoveredClusterReconciler) SetupWithManager

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

SetupWithManager ...

func (*DiscoveredClusterReconciler) ShouldReconcile

func (r *DiscoveredClusterReconciler) ShouldReconcile(obj metav1.Object) bool

ShouldReconcile ...

type DiscoveryConfigReconciler

type DiscoveryConfigReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

DiscoveryConfigReconciler reconciles a DiscoveryConfig object

func (*DiscoveryConfigReconciler) Reconcile

func (*DiscoveryConfigReconciler) SetupWithManager

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

SetupWithManager ...

type ManagedClusterReconciler

type ManagedClusterReconciler struct {
	client.Client
	Scheme  *runtime.Scheme
	Trigger chan event.GenericEvent
	Log     logr.Logger
}

ManagedClusterReconciler reconciles a ManagedCluster object

func (*ManagedClusterReconciler) Reconcile

func (*ManagedClusterReconciler) SetupWithManager

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

SetupWithManager ...

Jump to

Keyboard shortcuts

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