Documentation ¶
Index ¶
- Variables
- func GetDiscoveryConfig() types.NamespacedName
- type DiscoveredClusterReconciler
- func (r *DiscoveredClusterReconciler) CreateAutoImportSecret(nn types.NamespacedName, clusterID, apiToken string) *corev1.Secret
- func (r *DiscoveredClusterReconciler) CreateKlusterletAddonConfig(nn types.NamespacedName) *agentv1.KlusterletAddonConfig
- func (r *DiscoveredClusterReconciler) CreateManagedCluster(nn types.NamespacedName) *clusterapiv1.ManagedCluster
- func (r *DiscoveredClusterReconciler) CreateNamespaceForDiscoveredCluster(dc discovery.DiscoveredCluster) *corev1.Namespace
- func (r *DiscoveredClusterReconciler) EnsureAutoImportSecret(ctx context.Context, dc discovery.DiscoveredCluster, ...) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) EnsureCRDExist(ctx context.Context, crdName string) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) EnsureFinalizerRemovedFromManagedCluster(ctx context.Context, dc discovery.DiscoveredCluster) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) EnsureKlusterletAddonConfig(ctx context.Context, dc discovery.DiscoveredCluster) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) EnsureManagedCluster(ctx context.Context, dc discovery.DiscoveredCluster) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) EnsureNamespaceForDiscoveredCluster(ctx context.Context, dc discovery.DiscoveredCluster) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *DiscoveredClusterReconciler) ShouldReconcile(obj metav1.Object) bool
- type DiscoveryConfigReconciler
- type ManagedClusterReconciler
Constants ¶
This section is empty.
Variables ¶
var (
DiscoveryConfig types.NamespacedName
)
var ErrBadFormat = errors.New("bad format")
Functions ¶
func GetDiscoveryConfig ¶
func GetDiscoveryConfig() types.NamespacedName
Types ¶
type DiscoveredClusterReconciler ¶
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 ¶
func (r *DiscoveredClusterReconciler) CreateManagedCluster(nn types.NamespacedName) *clusterapiv1.ManagedCluster
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 ¶
func (r *DiscoveredClusterReconciler) EnsureAutoImportSecret(ctx context.Context, dc discovery.DiscoveredCluster, config discovery.DiscoveryConfig) (ctrl.Result, error)
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 ¶
func (r *DiscoveredClusterReconciler) EnsureManagedCluster(ctx context.Context, dc discovery.DiscoveredCluster) ( ctrl.Result, error)
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) SetupWithManager ¶
func (r *DiscoveredClusterReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager ...
func (*DiscoveredClusterReconciler) ShouldReconcile ¶
func (r *DiscoveredClusterReconciler) ShouldReconcile(obj metav1.Object) bool
ShouldReconcile ...
type DiscoveryConfigReconciler ¶
DiscoveryConfigReconciler reconciles a DiscoveryConfig object
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) SetupWithManager ¶
func (r *ManagedClusterReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager ...