Documentation ¶
Index ¶
- Constants
- Variables
- type DiscoveredClusterReconciler
- func (r *DiscoveredClusterReconciler) AddPlacementToClusterManagementAddOn(ctx context.Context, name string) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) CreateAddOnDeploymentConfig(nn types.NamespacedName) *addonv1alpha1.AddOnDeploymentConfig
- func (r *DiscoveredClusterReconciler) CreateAutoImportSecretOfflineToken(nn types.NamespacedName, clusterID, apiToken string) *corev1.Secret
- func (r *DiscoveredClusterReconciler) CreateAutoImportSecretServiceAccount(nn types.NamespacedName, clusterID, clientID, clientSecret string) *corev1.Secret
- func (r *DiscoveredClusterReconciler) CreateKlusterletAddonConfig(nn types.NamespacedName) *agentv1.KlusterletAddonConfig
- func (r *DiscoveredClusterReconciler) CreateManagedCluster(nn types.NamespacedName, clusterType string) *clusterapiv1.ManagedCluster
- func (r *DiscoveredClusterReconciler) CreateManagedClusterSetBinding(nn types.NamespacedName) *clusterapiv1beta2.ManagedClusterSetBinding
- func (r *DiscoveredClusterReconciler) CreateNamespaceForDiscoveredCluster(dc discovery.DiscoveredCluster) *corev1.Namespace
- func (r *DiscoveredClusterReconciler) CreatePlacement(nn types.NamespacedName) *clusterapiv1beta1.Placement
- func (r *DiscoveredClusterReconciler) EnsureAddOnDeploymentConfig(ctx context.Context) (ctrl.Result, error)
- 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) EnsureCommonResources(ctx context.Context, dc *discovery.DiscoveredCluster, isHCP bool) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) EnsureDiscoveredClusterCredentialExists(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) EnsureManagedClusterSetBinding(ctx context.Context) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) EnsureMultiClusterEngineHCP(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) EnsurePlacement(ctx context.Context) (ctrl.Result, error)
- func (r *DiscoveredClusterReconciler) EnsureROSA(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
- func (r *DiscoveryConfigReconciler) AddDefaultAuthMethodToSecret(ctx context.Context, secret *corev1.Secret) error
- func (r *DiscoveryConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *DiscoveryConfigReconciler) SetupWithManager(mgr ctrl.Manager) (controller.Controller, error)
- type ManagedClusterReconciler
Constants ¶
const ( AddOnDeploymentConfigName = "addon-ns-config" DefaultName = "default" )
const (
DefaultDiscoveryConfigName = "discovery"
)
Variables ¶
var ErrBadFormat = errors.New("bad format")
Functions ¶
This section is empty.
Types ¶
type DiscoveredClusterReconciler ¶
DiscoveredClusterReconciler reconciles a DiscoveredCluster object
func (*DiscoveredClusterReconciler) AddPlacementToClusterManagementAddOn ¶
func (r *DiscoveredClusterReconciler) AddPlacementToClusterManagementAddOn(ctx context.Context, name string) ( ctrl.Result, error)
EnsurePlacementAddedToClusterManagementAddOn
func (*DiscoveredClusterReconciler) CreateAddOnDeploymentConfig ¶
func (r *DiscoveredClusterReconciler) CreateAddOnDeploymentConfig(nn types.NamespacedName, ) *addonv1alpha1.AddOnDeploymentConfig
CreateAddOnDeploymentConfig creates a AddOnDeploymentConfig object with the specified NamespacedName. It sets the basic configuration for the AddOnDeploymentConfig, including metadata and spec fields. It also initializes the AgentInstallNamespace with a default value.
func (*DiscoveredClusterReconciler) CreateAutoImportSecretOfflineToken ¶
func (r *DiscoveredClusterReconciler) CreateAutoImportSecretOfflineToken(nn types.NamespacedName, clusterID, apiToken string, ) *corev1.Secret
CreateAutoImportSecretOfflineToken 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) CreateAutoImportSecretServiceAccount ¶
func (r *DiscoveredClusterReconciler) CreateAutoImportSecretServiceAccount(nn types.NamespacedName, clusterID, clientID, clientSecret string, ) *corev1.Secret
CreateAutoImportSecretServiceAccount 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, clusterType string) *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) CreateManagedClusterSetBinding ¶
func (r *DiscoveredClusterReconciler) CreateManagedClusterSetBinding(nn types.NamespacedName, ) *clusterapiv1beta2.ManagedClusterSetBinding
CreateManagedClusterSetBinding ...
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) CreatePlacement ¶
func (r *DiscoveredClusterReconciler) CreatePlacement(nn types.NamespacedName) *clusterapiv1beta1.Placement
CreatePlacement creates a Placement object for the ClusterManagementAddOn.
func (*DiscoveredClusterReconciler) EnsureAddOnDeploymentConfig ¶
func (r *DiscoveredClusterReconciler) EnsureAddOnDeploymentConfig(ctx context.Context) ( ctrl.Result, error)
EnsureAddOnDeploymentConfig ensures the existence of a AddOnDeploymentConfig resource for the given DiscoveredCluster. It checks if a AddOnDeploymentConfig with the specified name exists. If not found, it creates a new AddOnDeploymentConfig with the name and default configurations. If creation fails, it logs an error and returns with a requeue signal. If the AddOnDeploymentConfig already exists or if an error occurs during retrieval, it logs an error and returns with a requeue signal.
func (*DiscoveredClusterReconciler) EnsureAutoImportSecret ¶
func (r *DiscoveredClusterReconciler) EnsureAutoImportSecret(ctx context.Context, dc discovery.DiscoveredCluster) ( 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) EnsureCommonResources ¶
func (r *DiscoveredClusterReconciler) EnsureCommonResources(ctx context.Context, dc *discovery.DiscoveredCluster, isHCP bool) (ctrl.Result, error)
EnsureCommonResources ...
func (*DiscoveredClusterReconciler) EnsureDiscoveredClusterCredentialExists ¶
func (r *DiscoveredClusterReconciler) EnsureDiscoveredClusterCredentialExists( ctx context.Context, dc discovery.DiscoveredCluster) (ctrl.Result, error)
EnsureDiscoveredClusterCredentialExists ...
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) EnsureManagedClusterSetBinding ¶
func (r *DiscoveredClusterReconciler) EnsureManagedClusterSetBinding(ctx context.Context) (ctrl.Result, error)
EnsureManagedClusterSetBinding ensures the existence of a ManagedClusterSetBinding. It checks if a ManagedClusterSetBinding with the specified display name exists. If not found, it creates a new ManagedClusterSetBinding with the display name and default configurations. If creation fails, it logs an error and returns with a requeue signal. If the ManagedClusterSetBinding already exists or if an error occurs during retrieval, it logs an error and returns with a requeue signal.
func (*DiscoveredClusterReconciler) EnsureMultiClusterEngineHCP ¶
func (r *DiscoveredClusterReconciler) EnsureMultiClusterEngineHCP(ctx context.Context, dc *discovery.DiscoveredCluster, ) (ctrl.Result, error)
EnsureMultiClusterEngineHCP ...
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) EnsurePlacement ¶
EnsurePlacement ...
func (*DiscoveredClusterReconciler) EnsureROSA ¶
func (r *DiscoveredClusterReconciler) EnsureROSA(ctx context.Context, dc *discovery.DiscoveredCluster) ( ctrl.Result, error)
EnsureROSA ...
func (*DiscoveredClusterReconciler) Reconcile ¶
func (r *DiscoveredClusterReconciler) 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. TODO(user): Modify the Reconcile function to compare the state specified by the DiscoveredCluster object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.4/pkg/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 ¶
DiscoveryConfigReconciler reconciles a DiscoveryConfig object
func (*DiscoveryConfigReconciler) AddDefaultAuthMethodToSecret ¶
func (*DiscoveryConfigReconciler) SetupWithManager ¶
func (r *DiscoveryConfigReconciler) SetupWithManager(mgr ctrl.Manager) (controller.Controller, 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 ...