From 10f4066d42584b24f749f7fb6c2bff05fdcd9803 Mon Sep 17 00:00:00 2001 From: Andrei Pavlov Date: Fri, 21 Jun 2024 08:30:56 +0700 Subject: [PATCH] Remove separate core status for now Signed-off-by: Andrei Pavlov --- api/v1alpha1/management_types.go | 17 ++---- api/v1alpha1/zz_generated.deepcopy.go | 23 +------- .../bases/hmc.mirantis.com_managements.yaml | 54 +++---------------- internal/controller/management_controller.go | 2 +- templates/hmc/templates/management-crd.yaml | 54 +++---------------- 5 files changed, 20 insertions(+), 130 deletions(-) diff --git a/api/v1alpha1/management_types.go b/api/v1alpha1/management_types.go index 2b8cadbf4..2b9137867 100644 --- a/api/v1alpha1/management_types.go +++ b/api/v1alpha1/management_types.go @@ -69,7 +69,7 @@ func (in *Component) HelmValues() (values map[string]interface{}, err error) { func (m ManagementSpec) SetDefaults() { // TODO: Uncomment when Templates will be ready /* - m.Providers = []Component{ + m.Components = []Component{ { Template: "cluster-api", }, @@ -90,10 +90,8 @@ type ManagementStatus struct { ObservedGeneration int64 `json:"observedGeneration,omitempty"` // AvailableProviders holds all CAPI providers available on the Management cluster. AvailableProviders Providers `json:"availableProviders,omitempty"` - // Core indicates the status of installed core components. - Core CoreStatus `json:"core,omitempty"` - // Providers indicates the status of installed CAPI providers. - Providers map[string]ComponentStatus `json:"providers,omitempty"` + // Components indicates the status of installed HMC components and CAPI providers. + Components map[string]ComponentStatus `json:"components,omitempty"` } // ComponentStatus is the status of Management component installation @@ -104,15 +102,6 @@ type ComponentStatus struct { Error string `json:"error,omitempty"` } -type CoreStatus struct { - // HMC indicates the status of the installed HMC component. - HMC ComponentStatus `json:"HMC,omitempty"` - // CAPI indicates the status of the installed CAPI component. - CAPI ComponentStatus `json:"CAPI,omitempty"` - // CertManager indicates the status of the installed CertManager component. - CertManager ComponentStatus `json:"certManager,omitempty"` -} - //+kubebuilder:object:root=true //+kubebuilder:subresource:status // +kubebuilder:resource:shortName=hmc-mgmt;mgmt diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index dc66b428e..03c952055 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -168,24 +168,6 @@ func (in *Core) DeepCopy() *Core { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CoreStatus) DeepCopyInto(out *CoreStatus) { - *out = *in - out.HMC = in.HMC - out.CAPI = in.CAPI - out.CertManager = in.CertManager -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CoreStatus. -func (in *CoreStatus) DeepCopy() *CoreStatus { - if in == nil { - return nil - } - out := new(CoreStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Deployment) DeepCopyInto(out *Deployment) { *out = *in @@ -391,9 +373,8 @@ func (in *ManagementSpec) DeepCopy() *ManagementSpec { func (in *ManagementStatus) DeepCopyInto(out *ManagementStatus) { *out = *in in.AvailableProviders.DeepCopyInto(&out.AvailableProviders) - out.Core = in.Core - if in.Providers != nil { - in, out := &in.Providers, &out.Providers + if in.Components != nil { + in, out := &in.Components, &out.Components *out = make(map[string]ComponentStatus, len(*in)) for key, val := range *in { (*out)[key] = val diff --git a/config/crd/bases/hmc.mirantis.com_managements.yaml b/config/crd/bases/hmc.mirantis.com_managements.yaml index 0d798a64c..a35bf804b 100644 --- a/config/crd/bases/hmc.mirantis.com_managements.yaml +++ b/config/crd/bases/hmc.mirantis.com_managements.yaml @@ -149,52 +149,7 @@ spec: type: string type: array type: object - core: - description: Core indicates the status of installed core components. - properties: - CAPI: - description: CAPI indicates the status of the installed CAPI component. - properties: - error: - description: Error stores as error message in case of failed - installation - type: string - success: - description: Success represents if a component installation - was successful - type: boolean - type: object - HMC: - description: HMC indicates the status of the installed HMC component. - properties: - error: - description: Error stores as error message in case of failed - installation - type: string - success: - description: Success represents if a component installation - was successful - type: boolean - type: object - certManager: - description: CertManager indicates the status of the installed - CertManager component. - properties: - error: - description: Error stores as error message in case of failed - installation - type: string - success: - description: Success represents if a component installation - was successful - type: boolean - type: object - type: object - observedGeneration: - description: ObservedGeneration is the last observed generation. - format: int64 - type: integer - providers: + components: additionalProperties: description: ComponentStatus is the status of Management component installation @@ -208,8 +163,13 @@ spec: was successful type: boolean type: object - description: Providers indicates the status of installed CAPI providers. + description: Components indicates the status of installed HMC components + and CAPI providers. type: object + observedGeneration: + description: ObservedGeneration is the last observed generation. + format: int64 + type: integer type: object type: object served: true diff --git a/internal/controller/management_controller.go b/internal/controller/management_controller.go index 13d62cbb3..ab73603c1 100644 --- a/internal/controller/management_controller.go +++ b/internal/controller/management_controller.go @@ -116,7 +116,7 @@ func (r *ManagementReconciler) Reconcile(ctx context.Context, req ctrl.Request) management.Status.ObservedGeneration = management.Generation management.Status.AvailableProviders = detectedProviders - management.Status.Providers = detectedComponents + management.Status.Components = detectedComponents if err := r.Status().Update(ctx, management); err != nil { errs = errors.Join(fmt.Errorf("failed to update status for Management %s/%s: %w", management.Namespace, management.Name, err)) } diff --git a/templates/hmc/templates/management-crd.yaml b/templates/hmc/templates/management-crd.yaml index ee50bfda5..701f9ab74 100644 --- a/templates/hmc/templates/management-crd.yaml +++ b/templates/hmc/templates/management-crd.yaml @@ -149,52 +149,7 @@ spec: type: string type: array type: object - core: - description: Core indicates the status of installed core components. - properties: - CAPI: - description: CAPI indicates the status of the installed CAPI component. - properties: - error: - description: Error stores as error message in case of failed - installation - type: string - success: - description: Success represents if a component installation - was successful - type: boolean - type: object - HMC: - description: HMC indicates the status of the installed HMC component. - properties: - error: - description: Error stores as error message in case of failed - installation - type: string - success: - description: Success represents if a component installation - was successful - type: boolean - type: object - certManager: - description: CertManager indicates the status of the installed CertManager - component. - properties: - error: - description: Error stores as error message in case of failed - installation - type: string - success: - description: Success represents if a component installation - was successful - type: boolean - type: object - type: object - observedGeneration: - description: ObservedGeneration is the last observed generation. - format: int64 - type: integer - providers: + components: additionalProperties: description: ComponentStatus is the status of Management component installation @@ -207,8 +162,13 @@ spec: successful type: boolean type: object - description: Providers indicates the status of installed CAPI providers. + description: Components indicates the status of installed HMC components + and CAPI providers. type: object + observedGeneration: + description: ObservedGeneration is the last observed generation. + format: int64 + type: integer type: object type: object served: true