diff --git a/README.md b/README.md index 0c5660eaa..85df32ebe 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ or install using `helm` helm install hmc oci://ghcr.io/mirantis/hmc/charts/hmc --version 0.0.5 -n hmc-system --create-namespace ``` -Then follow the [Deploy a managed cluster](#deploy-a-managed-cluster) guide to -create a managed cluster. +Then follow the [Deploy a cluster deployment](#deploy-a-cluster-deployment) guide to +create a cluster deployment. > [!NOTE] > The HMC installation using Kubernetes manifests does not allow @@ -51,7 +51,7 @@ Mirantis Hybrid Container Cloud requires the following: Optionally, the following CLIs may be helpful: 1. `helm` (required only when installing HMC using `helm`). -2. `clusterctl` (to handle the lifecycle of the managed clusters). +2. `clusterctl` (to handle the lifecycle of the cluster deployments). ### Providers configuration @@ -109,9 +109,9 @@ own `Management` configuration: `kubectl --kubeconfig create -f management.yaml` -## Deploy a managed cluster +## Deploy a cluster deployment -To deploy a managed cluster: +To deploy a cluster deployment: 1. Create `Credential` object with all credentials required. @@ -173,7 +173,7 @@ kubectl -n get cluster -o > cluster -n --show-conditions > all ``` -6. Retrieve the `kubeconfig` of your managed cluster: +6. Retrieve the `kubeconfig` of your cluster deployment: ``` kubectl get secret -n hmc-system -kubeconfig -o=jsonpath={.data.value} | base64 -d > kubeconfig diff --git a/api/v1alpha1/managedcluster_types.go b/api/v1alpha1/clusterdeployment_types.go similarity index 99% rename from api/v1alpha1/managedcluster_types.go rename to api/v1alpha1/clusterdeployment_types.go index 9e1434f03..e811b9801 100644 --- a/api/v1alpha1/managedcluster_types.go +++ b/api/v1alpha1/clusterdeployment_types.go @@ -106,7 +106,7 @@ type ClusterDeploymentStatus struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status -// +kubebuilder:resource:shortName=mcluster;mcl +// +kubebuilder:resource:shortName=clusterd;cld // +kubebuilder:printcolumn:name="ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description="Ready",priority=0 // +kubebuilder:printcolumn:name="status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description="Status",priority=0 // +kubebuilder:printcolumn:name="dryRun",type="string",JSONPath=".spec.dryRun",description="Dry Run",priority=1 diff --git a/api/v1alpha1/indexers.go b/api/v1alpha1/indexers.go index f1d87733e..6dd068925 100644 --- a/api/v1alpha1/indexers.go +++ b/api/v1alpha1/indexers.go @@ -89,12 +89,12 @@ func ExtractServiceTemplateNamesFromClusterDeployment(rawObj client.Object) []st const ClusterDeploymentCredentialIndexKey = ".spec.credential" func setupClusterDeploymentCredentialIndexer(ctx context.Context, mgr ctrl.Manager) error { - return mgr.GetFieldIndexer().IndexField(ctx, &ClusterDeployment{}, ClusterDeploymentCredentialIndexKey, ExtractCredentialNameFromClusterDeployment) + return mgr.GetFieldIndexer().IndexField(ctx, &ClusterDeployment{}, ClusterDeploymentCredentialIndexKey, extractCredentialNameFromClusterDeployment) } -// ExtractCredentialNameFromClusterDeployment returns referenced Credential name +// extractCredentialNameFromClusterDeployment returns referenced Credential name // declared in a ClusterDeployment object. -func ExtractCredentialNameFromClusterDeployment(rawObj client.Object) []string { +func extractCredentialNameFromClusterDeployment(rawObj client.Object) []string { cluster, ok := rawObj.(*ClusterDeployment) if !ok { return nil diff --git a/config/dev/adopted-clusterdeployment.yaml b/config/dev/adopted-clusterdeployment.yaml index 36afd93aa..026bf9853 100644 --- a/config/dev/adopted-clusterdeployment.yaml +++ b/config/dev/adopted-clusterdeployment.yaml @@ -1,7 +1,7 @@ apiVersion: hmc.mirantis.com/v1alpha1 kind: ClusterDeployment metadata: - name: aws-dev + name: adopted-dev namespace: ${NAMESPACE} spec: template: adopted-cluster-0-0-4 diff --git a/internal/controller/clusterdeployment_controller.go b/internal/controller/clusterdeployment_controller.go index 1cc7b3c08..4d2c3f938 100644 --- a/internal/controller/clusterdeployment_controller.go +++ b/internal/controller/clusterdeployment_controller.go @@ -104,9 +104,7 @@ func (r *ClusterDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Re return r.reconcileUpdate(ctx, clusterDeployment) } -func (r *ClusterDeploymentReconciler) setStatusFromChildObjects( - ctx context.Context, clusterDeployment *hmc.ClusterDeployment, gvr schema.GroupVersionResource, conditions []string, -) (requeue bool, _ error) { +func (r *ClusterDeploymentReconciler) setStatusFromChildObjects(ctx context.Context, clusterDeployment *hmc.ClusterDeployment, gvr schema.GroupVersionResource, conditions []string) (requeue bool, _ error) { l := ctrl.LoggerFrom(ctx) resourceConditions, err := status.GetResourceConditions(ctx, clusterDeployment.Namespace, r.DynamicClient, gvr, diff --git a/internal/controller/management_controller.go b/internal/controller/management_controller.go index 89be1667c..102cad860 100644 --- a/internal/controller/management_controller.go +++ b/internal/controller/management_controller.go @@ -116,7 +116,7 @@ func (r *ManagementReconciler) Update(ctx context.Context, management *hmc.Manag errs error statusAccumulator = &mgmtStatusAccumulator{ - providers: hmc.Providers{}, + providers: hmc.Providers{"infrastructure-internal"}, components: make(map[string]hmc.ComponentStatus), compatibilityContracts: make(map[string]hmc.CompatibilityContracts), } @@ -124,8 +124,6 @@ func (r *ManagementReconciler) Update(ctx context.Context, management *hmc.Manag requeue bool ) - statusAccumulator.providers = append(statusAccumulator.providers, "infrastructure-internal") - for _, component := range components { l.V(1).Info("reconciling components", "component", component) template := new(hmc.ProviderTemplate) diff --git a/templates/provider/hmc/templates/crds/hmc.mirantis.com_clusterdeployments.yaml b/templates/provider/hmc/templates/crds/hmc.mirantis.com_clusterdeployments.yaml index 1c76d3062..44b90107f 100644 --- a/templates/provider/hmc/templates/crds/hmc.mirantis.com_clusterdeployments.yaml +++ b/templates/provider/hmc/templates/crds/hmc.mirantis.com_clusterdeployments.yaml @@ -12,8 +12,8 @@ spec: listKind: ClusterDeploymentList plural: clusterdeployments shortNames: - - mcluster - - mcl + - clusterd + - cld singular: clusterdeployment scope: Namespaced versions: diff --git a/templates/provider/hmc/templates/deployment.yaml b/templates/provider/hmc/templates/deployment.yaml index e95b1cd95..31ae1004a 100644 --- a/templates/provider/hmc/templates/deployment.yaml +++ b/templates/provider/hmc/templates/deployment.yaml @@ -54,7 +54,6 @@ spec: port: 8081 initialDelaySeconds: 15 periodSeconds: 20 - timeoutSeconds: 6000 name: manager readinessProbe: httpGet: @@ -62,7 +61,6 @@ spec: port: 8081 initialDelaySeconds: 5 periodSeconds: 10 - timeoutSeconds: 6000 resources: {{- toYaml .Values.resources | nindent 10 }} securityContext: {{- toYaml .Values.containerSecurityContext diff --git a/test/objects/clusterdeployment/clusterdeployment.go b/test/objects/clusterdeployment/clusterdeployment.go index 2fcfb134f..777572d86 100644 --- a/test/objects/clusterdeployment/clusterdeployment.go +++ b/test/objects/clusterdeployment/clusterdeployment.go @@ -26,7 +26,7 @@ const ( DefaultNamespace = metav1.NamespaceDefault ) -type Opt func(ClusterDeployment *v1alpha1.ClusterDeployment) +type Opt func(clusterDeployment *v1alpha1.ClusterDeployment) func NewClusterDeployment(opts ...Opt) *v1alpha1.ClusterDeployment { p := &v1alpha1.ClusterDeployment{