From af3f0c9e0ec4ce67493811a2a3bd57eb9bdbdec9 Mon Sep 17 00:00:00 2001 From: Andrei Pavlov Date: Wed, 29 May 2024 19:38:57 +0700 Subject: [PATCH] Remove HMC prefix from all CRDs Signed-off-by: Andrei Pavlov --- PROJECT | 8 +- api/v1alpha1/hmcdeployment_types.go | 26 +-- api/v1alpha1/hmcmanagement_types.go | 26 +-- api/v1alpha1/hmcprovideraws_types.go | 26 +-- api/v1alpha1/hmctemplate_types.go | 24 +-- api/v1alpha1/zz_generated.deepcopy.go | 160 +++++++++--------- cmd/main.go | 16 +- ...is.com.hmc.mirantis.com_awsproviders.yaml} | 18 +- ...tis.com.hmc.mirantis.com_deployments.yaml} | 18 +- ...tis.com.hmc.mirantis.com_managements.yaml} | 18 +- ...antis.com.hmc.mirantis.com_templates.yaml} | 16 +- config/crd/kustomization.yaml | 16 +- config/rbac/hmcdeployment_editor_role.yaml | 8 +- config/rbac/hmcdeployment_viewer_role.yaml | 8 +- config/rbac/hmcmanagement_editor_role.yaml | 8 +- config/rbac/hmcmanagement_viewer_role.yaml | 8 +- config/rbac/hmcprovideraws_editor_role.yaml | 8 +- config/rbac/hmcprovideraws_viewer_role.yaml | 8 +- config/rbac/hmctemplate_editor_role.yaml | 8 +- config/rbac/hmctemplate_viewer_role.yaml | 8 +- config/rbac/kustomization.yaml | 16 +- config/rbac/role.yaml | 24 +-- ...c.mirantis.com_v1alpha1_hmcdeployment.yaml | 4 +- ...c.mirantis.com_v1alpha1_hmcmanagement.yaml | 4 +- ....mirantis.com_v1alpha1_hmcprovideraws.yaml | 4 +- ...hmc.mirantis.com_v1alpha1_hmctemplate.yaml | 4 +- config/samples/kustomization.yaml | 8 +- .../controller/hmcdeployment_controller.go | 18 +- .../hmcdeployment_controller_test.go | 16 +- .../controller/hmcmanagement_controller.go | 18 +- .../hmcmanagement_controller_test.go | 16 +- .../controller/hmcprovideraws_controller.go | 18 +- .../hmcprovideraws_controller_test.go | 16 +- internal/controller/hmctemplate_controller.go | 18 +- .../controller/hmctemplate_controller_test.go | 18 +- 35 files changed, 319 insertions(+), 319 deletions(-) rename config/crd/bases/{hmc.mirantis.com.hmc.mirantis.com_hmcmanagements.yaml => hmc.mirantis.com.hmc.mirantis.com_awsproviders.yaml} (74%) rename config/crd/bases/{hmc.mirantis.com.hmc.mirantis.com_hmcdeployments.yaml => hmc.mirantis.com.hmc.mirantis.com_deployments.yaml} (83%) rename config/crd/bases/{hmc.mirantis.com.hmc.mirantis.com_hmcproviderawses.yaml => hmc.mirantis.com.hmc.mirantis.com_managements.yaml} (73%) rename config/crd/bases/{hmc.mirantis.com.hmc.mirantis.com_hmctemplates.yaml => hmc.mirantis.com.hmc.mirantis.com_templates.yaml} (85%) diff --git a/PROJECT b/PROJECT index fec5387e4..3b9636bbf 100644 --- a/PROJECT +++ b/PROJECT @@ -14,7 +14,7 @@ resources: controller: true domain: hmc.mirantis.com group: hmc.mirantis.com - kind: HMCTemplate + kind: Template path: github.com/Mirantis/hmc/api/v1alpha1 version: v1alpha1 - api: @@ -23,7 +23,7 @@ resources: controller: true domain: hmc.mirantis.com group: hmc.mirantis.com - kind: HMCDeployment + kind: Deployment path: github.com/Mirantis/hmc/api/v1alpha1 version: v1alpha1 - api: @@ -32,7 +32,7 @@ resources: controller: true domain: hmc.mirantis.com group: hmc.mirantis.com - kind: HMCManagement + kind: Management path: github.com/Mirantis/hmc/api/v1alpha1 version: v1alpha1 - api: @@ -41,7 +41,7 @@ resources: controller: true domain: hmc.mirantis.com group: hmc.mirantis.com - kind: HMCProviderAWS + kind: AWSProvider path: github.com/Mirantis/hmc/api/v1alpha1 version: v1alpha1 version: "3" diff --git a/api/v1alpha1/hmcdeployment_types.go b/api/v1alpha1/hmcdeployment_types.go index 0b5012cd6..56b6eb614 100644 --- a/api/v1alpha1/hmcdeployment_types.go +++ b/api/v1alpha1/hmcdeployment_types.go @@ -21,12 +21,12 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// HMCDeploymentSpec defines the desired state of HMCDeployment -type HMCDeploymentSpec struct { +// DeploymentSpec defines the desired state of Deployment +type DeploymentSpec struct { // DryRun specifies whether the template should be applied after validation or only validated. // +kubebuilder:validation:Optional DryRun bool `json:"dryRun"` - // Template is a reference to a HMCTemplate object located in the same namespace. + // Template is a reference to a Template object located in the same namespace. // +kubebuilder:validation:Required Template string `json:"template"` // Configuration allows to provide parameters for template customization. @@ -36,32 +36,32 @@ type HMCDeploymentSpec struct { Configuration apiextensionsv1.JSON `json:"configuration"` } -// HMCDeploymentStatus defines the observed state of HMCDeployment -type HMCDeploymentStatus struct { +// DeploymentStatus defines the observed state of Deployment +type DeploymentStatus struct { TemplateValidationStatus `json:",inline"` } //+kubebuilder:object:root=true //+kubebuilder:subresource:status -// HMCDeployment is the Schema for the hmcdeployments API -type HMCDeployment struct { +// Deployment is the Schema for the deployments API +type Deployment struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec HMCDeploymentSpec `json:"spec,omitempty"` - Status HMCDeploymentStatus `json:"status,omitempty"` + Spec DeploymentSpec `json:"spec,omitempty"` + Status DeploymentStatus `json:"status,omitempty"` } //+kubebuilder:object:root=true -// HMCDeploymentList contains a list of HMCDeployment -type HMCDeploymentList struct { +// DeploymentList contains a list of Deployment +type DeploymentList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []HMCDeployment `json:"items"` + Items []Deployment `json:"items"` } func init() { - SchemeBuilder.Register(&HMCDeployment{}, &HMCDeploymentList{}) + SchemeBuilder.Register(&Deployment{}, &DeploymentList{}) } diff --git a/api/v1alpha1/hmcmanagement_types.go b/api/v1alpha1/hmcmanagement_types.go index e48d3b333..f8fb17c97 100644 --- a/api/v1alpha1/hmcmanagement_types.go +++ b/api/v1alpha1/hmcmanagement_types.go @@ -23,17 +23,17 @@ import ( // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. -// HMCManagementSpec defines the desired state of HMCManagement -type HMCManagementSpec struct { +// ManagementSpec defines the desired state of Management +type ManagementSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file - // Foo is an example field of HMCManagement. Edit hmcmanagement_types.go to remove/update + // Foo is an example field of Management. Edit management_types.go to remove/update Foo string `json:"foo,omitempty"` } -// HMCManagementStatus defines the observed state of HMCManagement -type HMCManagementStatus struct { +// ManagementStatus defines the observed state of Management +type ManagementStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // Important: Run "make" to regenerate code after modifying this file } @@ -41,24 +41,24 @@ type HMCManagementStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status -// HMCManagement is the Schema for the hmcmanagements API -type HMCManagement struct { +// Management is the Schema for the managements API +type Management struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec HMCManagementSpec `json:"spec,omitempty"` - Status HMCManagementStatus `json:"status,omitempty"` + Spec ManagementSpec `json:"spec,omitempty"` + Status ManagementStatus `json:"status,omitempty"` } //+kubebuilder:object:root=true -// HMCManagementList contains a list of HMCManagement -type HMCManagementList struct { +// ManagementList contains a list of Management +type ManagementList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []HMCManagement `json:"items"` + Items []Management `json:"items"` } func init() { - SchemeBuilder.Register(&HMCManagement{}, &HMCManagementList{}) + SchemeBuilder.Register(&Management{}, &ManagementList{}) } diff --git a/api/v1alpha1/hmcprovideraws_types.go b/api/v1alpha1/hmcprovideraws_types.go index e5937e2c9..bb297d475 100644 --- a/api/v1alpha1/hmcprovideraws_types.go +++ b/api/v1alpha1/hmcprovideraws_types.go @@ -23,17 +23,17 @@ import ( // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. -// HMCProviderAWSSpec defines the desired state of HMCProviderAWS -type HMCProviderAWSSpec struct { +// AWSProviderSpec defines the desired state of AWSProvider +type AWSProviderSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file - // Foo is an example field of HMCProviderAWS. Edit hmcprovideraws_types.go to remove/update + // Foo is an example field of AWSProvider. Edit awsprovider_types.go to remove/update Foo string `json:"foo,omitempty"` } -// HMCProviderAWSStatus defines the observed state of HMCProviderAWS -type HMCProviderAWSStatus struct { +// AWSProviderStatus defines the observed state of AWSProvider +type AWSProviderStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // Important: Run "make" to regenerate code after modifying this file } @@ -41,24 +41,24 @@ type HMCProviderAWSStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status -// HMCProviderAWS is the Schema for the hmcprovideraws API -type HMCProviderAWS struct { +// AWSProvider is the Schema for the awsprovider API +type AWSProvider struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec HMCProviderAWSSpec `json:"spec,omitempty"` - Status HMCProviderAWSStatus `json:"status,omitempty"` + Spec AWSProviderSpec `json:"spec,omitempty"` + Status AWSProviderStatus `json:"status,omitempty"` } //+kubebuilder:object:root=true -// HMCProviderAWSList contains a list of HMCProviderAWS -type HMCProviderAWSList struct { +// AWSProviderList contains a list of AWSProvider +type AWSProviderList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []HMCProviderAWS `json:"items"` + Items []AWSProvider `json:"items"` } func init() { - SchemeBuilder.Register(&HMCProviderAWS{}, &HMCProviderAWSList{}) + SchemeBuilder.Register(&AWSProvider{}, &AWSProviderList{}) } diff --git a/api/v1alpha1/hmctemplate_types.go b/api/v1alpha1/hmctemplate_types.go index 2782f5b91..e58d38041 100644 --- a/api/v1alpha1/hmctemplate_types.go +++ b/api/v1alpha1/hmctemplate_types.go @@ -20,8 +20,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// HMCTemplateSpec defines the desired state of HMCTemplate -type HMCTemplateSpec struct { +// TemplateSpec defines the desired state of Template +type TemplateSpec struct { // Provider specifies a CAPI provider associated with the template. // +kubebuilder:validation:Enum=aws // +kubebuilder:validation:Required @@ -31,8 +31,8 @@ type HMCTemplateSpec struct { HelmChartURL string `json:"helmChartURL"` } -// HMCTemplateStatus defines the observed state of HMCTemplate -type HMCTemplateStatus struct { +// TemplateStatus defines the observed state of Template +type TemplateStatus struct { TemplateValidationStatus `json:",inline"` // Descriptions contains information about the template. // +optional @@ -50,24 +50,24 @@ type TemplateValidationStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status -// HMCTemplate is the Schema for the hmctemplates API -type HMCTemplate struct { +// Template is the Schema for the templates API +type Template struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec HMCTemplateSpec `json:"spec,omitempty"` - Status HMCTemplateStatus `json:"status,omitempty"` + Spec TemplateSpec `json:"spec,omitempty"` + Status TemplateStatus `json:"status,omitempty"` } //+kubebuilder:object:root=true -// HMCTemplateList contains a list of HMCTemplate -type HMCTemplateList struct { +// TemplateList contains a list of Template +type TemplateList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []HMCTemplate `json:"items"` + Items []Template `json:"items"` } func init() { - SchemeBuilder.Register(&HMCTemplate{}, &HMCTemplateList{}) + SchemeBuilder.Register(&Template{}, &TemplateList{}) } diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 356351e0a..568d10d69 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -25,26 +25,26 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCDeployment) DeepCopyInto(out *HMCDeployment) { +func (in *AWSProvider) DeepCopyInto(out *AWSProvider) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) + out.Spec = in.Spec out.Status = in.Status } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCDeployment. -func (in *HMCDeployment) DeepCopy() *HMCDeployment { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSProvider. +func (in *AWSProvider) DeepCopy() *AWSProvider { if in == nil { return nil } - out := new(HMCDeployment) + out := new(AWSProvider) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HMCDeployment) DeepCopyObject() runtime.Object { +func (in *AWSProvider) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -52,31 +52,31 @@ func (in *HMCDeployment) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCDeploymentList) DeepCopyInto(out *HMCDeploymentList) { +func (in *AWSProviderList) DeepCopyInto(out *AWSProviderList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]HMCDeployment, len(*in)) + *out = make([]AWSProvider, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCDeploymentList. -func (in *HMCDeploymentList) DeepCopy() *HMCDeploymentList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSProviderList. +func (in *AWSProviderList) DeepCopy() *AWSProviderList { if in == nil { return nil } - out := new(HMCDeploymentList) + out := new(AWSProviderList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HMCDeploymentList) DeepCopyObject() runtime.Object { +func (in *AWSProviderList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -84,58 +84,56 @@ func (in *HMCDeploymentList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCDeploymentSpec) DeepCopyInto(out *HMCDeploymentSpec) { +func (in *AWSProviderSpec) DeepCopyInto(out *AWSProviderSpec) { *out = *in - in.Configuration.DeepCopyInto(&out.Configuration) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCDeploymentSpec. -func (in *HMCDeploymentSpec) DeepCopy() *HMCDeploymentSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSProviderSpec. +func (in *AWSProviderSpec) DeepCopy() *AWSProviderSpec { if in == nil { return nil } - out := new(HMCDeploymentSpec) + out := new(AWSProviderSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCDeploymentStatus) DeepCopyInto(out *HMCDeploymentStatus) { +func (in *AWSProviderStatus) DeepCopyInto(out *AWSProviderStatus) { *out = *in - out.TemplateValidationStatus = in.TemplateValidationStatus } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCDeploymentStatus. -func (in *HMCDeploymentStatus) DeepCopy() *HMCDeploymentStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSProviderStatus. +func (in *AWSProviderStatus) DeepCopy() *AWSProviderStatus { if in == nil { return nil } - out := new(HMCDeploymentStatus) + out := new(AWSProviderStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCManagement) DeepCopyInto(out *HMCManagement) { +func (in *Deployment) DeepCopyInto(out *Deployment) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) out.Status = in.Status } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCManagement. -func (in *HMCManagement) DeepCopy() *HMCManagement { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Deployment. +func (in *Deployment) DeepCopy() *Deployment { if in == nil { return nil } - out := new(HMCManagement) + out := new(Deployment) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HMCManagement) DeepCopyObject() runtime.Object { +func (in *Deployment) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -143,31 +141,31 @@ func (in *HMCManagement) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCManagementList) DeepCopyInto(out *HMCManagementList) { +func (in *DeploymentList) DeepCopyInto(out *DeploymentList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]HMCManagement, len(*in)) + *out = make([]Deployment, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCManagementList. -func (in *HMCManagementList) DeepCopy() *HMCManagementList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentList. +func (in *DeploymentList) DeepCopy() *DeploymentList { if in == nil { return nil } - out := new(HMCManagementList) + out := new(DeploymentList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HMCManagementList) DeepCopyObject() runtime.Object { +func (in *DeploymentList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -175,37 +173,39 @@ func (in *HMCManagementList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCManagementSpec) DeepCopyInto(out *HMCManagementSpec) { +func (in *DeploymentSpec) DeepCopyInto(out *DeploymentSpec) { *out = *in + in.Configuration.DeepCopyInto(&out.Configuration) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCManagementSpec. -func (in *HMCManagementSpec) DeepCopy() *HMCManagementSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentSpec. +func (in *DeploymentSpec) DeepCopy() *DeploymentSpec { if in == nil { return nil } - out := new(HMCManagementSpec) + out := new(DeploymentSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCManagementStatus) DeepCopyInto(out *HMCManagementStatus) { +func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) { *out = *in + out.TemplateValidationStatus = in.TemplateValidationStatus } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCManagementStatus. -func (in *HMCManagementStatus) DeepCopy() *HMCManagementStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentStatus. +func (in *DeploymentStatus) DeepCopy() *DeploymentStatus { if in == nil { return nil } - out := new(HMCManagementStatus) + out := new(DeploymentStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCProviderAWS) DeepCopyInto(out *HMCProviderAWS) { +func (in *Management) DeepCopyInto(out *Management) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -213,18 +213,18 @@ func (in *HMCProviderAWS) DeepCopyInto(out *HMCProviderAWS) { out.Status = in.Status } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCProviderAWS. -func (in *HMCProviderAWS) DeepCopy() *HMCProviderAWS { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Management. +func (in *Management) DeepCopy() *Management { if in == nil { return nil } - out := new(HMCProviderAWS) + out := new(Management) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HMCProviderAWS) DeepCopyObject() runtime.Object { +func (in *Management) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -232,31 +232,31 @@ func (in *HMCProviderAWS) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCProviderAWSList) DeepCopyInto(out *HMCProviderAWSList) { +func (in *ManagementList) DeepCopyInto(out *ManagementList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]HMCProviderAWS, len(*in)) + *out = make([]Management, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCProviderAWSList. -func (in *HMCProviderAWSList) DeepCopy() *HMCProviderAWSList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagementList. +func (in *ManagementList) DeepCopy() *ManagementList { if in == nil { return nil } - out := new(HMCProviderAWSList) + out := new(ManagementList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HMCProviderAWSList) DeepCopyObject() runtime.Object { +func (in *ManagementList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -264,37 +264,37 @@ func (in *HMCProviderAWSList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCProviderAWSSpec) DeepCopyInto(out *HMCProviderAWSSpec) { +func (in *ManagementSpec) DeepCopyInto(out *ManagementSpec) { *out = *in } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCProviderAWSSpec. -func (in *HMCProviderAWSSpec) DeepCopy() *HMCProviderAWSSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagementSpec. +func (in *ManagementSpec) DeepCopy() *ManagementSpec { if in == nil { return nil } - out := new(HMCProviderAWSSpec) + out := new(ManagementSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCProviderAWSStatus) DeepCopyInto(out *HMCProviderAWSStatus) { +func (in *ManagementStatus) DeepCopyInto(out *ManagementStatus) { *out = *in } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCProviderAWSStatus. -func (in *HMCProviderAWSStatus) DeepCopy() *HMCProviderAWSStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagementStatus. +func (in *ManagementStatus) DeepCopy() *ManagementStatus { if in == nil { return nil } - out := new(HMCProviderAWSStatus) + out := new(ManagementStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCTemplate) DeepCopyInto(out *HMCTemplate) { +func (in *Template) DeepCopyInto(out *Template) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -302,18 +302,18 @@ func (in *HMCTemplate) DeepCopyInto(out *HMCTemplate) { out.Status = in.Status } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCTemplate. -func (in *HMCTemplate) DeepCopy() *HMCTemplate { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Template. +func (in *Template) DeepCopy() *Template { if in == nil { return nil } - out := new(HMCTemplate) + out := new(Template) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HMCTemplate) DeepCopyObject() runtime.Object { +func (in *Template) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -321,31 +321,31 @@ func (in *HMCTemplate) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCTemplateList) DeepCopyInto(out *HMCTemplateList) { +func (in *TemplateList) DeepCopyInto(out *TemplateList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]HMCTemplate, len(*in)) + *out = make([]Template, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCTemplateList. -func (in *HMCTemplateList) DeepCopy() *HMCTemplateList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateList. +func (in *TemplateList) DeepCopy() *TemplateList { if in == nil { return nil } - out := new(HMCTemplateList) + out := new(TemplateList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HMCTemplateList) DeepCopyObject() runtime.Object { +func (in *TemplateList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -353,32 +353,32 @@ func (in *HMCTemplateList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCTemplateSpec) DeepCopyInto(out *HMCTemplateSpec) { +func (in *TemplateSpec) DeepCopyInto(out *TemplateSpec) { *out = *in } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCTemplateSpec. -func (in *HMCTemplateSpec) DeepCopy() *HMCTemplateSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateSpec. +func (in *TemplateSpec) DeepCopy() *TemplateSpec { if in == nil { return nil } - out := new(HMCTemplateSpec) + out := new(TemplateSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HMCTemplateStatus) DeepCopyInto(out *HMCTemplateStatus) { +func (in *TemplateStatus) DeepCopyInto(out *TemplateStatus) { *out = *in out.TemplateValidationStatus = in.TemplateValidationStatus } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HMCTemplateStatus. -func (in *HMCTemplateStatus) DeepCopy() *HMCTemplateStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateStatus. +func (in *TemplateStatus) DeepCopy() *TemplateStatus { if in == nil { return nil } - out := new(HMCTemplateStatus) + out := new(TemplateStatus) in.DeepCopyInto(out) return out } diff --git a/cmd/main.go b/cmd/main.go index d631fa3ae..e0b1f3d19 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -122,32 +122,32 @@ func main() { os.Exit(1) } - if err = (&controller.HMCTemplateReconciler{ + if err = (&controller.TemplateReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "HMCTemplate") + setupLog.Error(err, "unable to create controller", "controller", "Template") os.Exit(1) } - if err = (&controller.HMCDeploymentReconciler{ + if err = (&controller.DeploymentReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "HMCDeployment") + setupLog.Error(err, "unable to create controller", "controller", "Deployment") os.Exit(1) } - if err = (&controller.HMCManagementReconciler{ + if err = (&controller.ManagementReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "HMCManagement") + setupLog.Error(err, "unable to create controller", "controller", "Management") os.Exit(1) } - if err = (&controller.HMCProviderAWSReconciler{ + if err = (&controller.AWSProviderReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "HMCProviderAWS") + setupLog.Error(err, "unable to create controller", "controller", "AWSProvider") os.Exit(1) } //+kubebuilder:scaffold:builder diff --git a/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmcmanagements.yaml b/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_awsproviders.yaml similarity index 74% rename from config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmcmanagements.yaml rename to config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_awsproviders.yaml index ad49d31df..28cadee06 100644 --- a/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmcmanagements.yaml +++ b/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_awsproviders.yaml @@ -4,20 +4,20 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 - name: hmcmanagements.hmc.mirantis.com.hmc.mirantis.com + name: awsproviders.hmc.mirantis.com.hmc.mirantis.com spec: group: hmc.mirantis.com.hmc.mirantis.com names: - kind: HMCManagement - listKind: HMCManagementList - plural: hmcmanagements - singular: hmcmanagement + kind: AWSProvider + listKind: AWSProviderList + plural: awsproviders + singular: awsprovider scope: Namespaced versions: - name: v1alpha1 schema: openAPIV3Schema: - description: HMCManagement is the Schema for the hmcmanagements API + description: AWSProvider is the Schema for the awsprovider API properties: apiVersion: description: |- @@ -37,15 +37,15 @@ spec: metadata: type: object spec: - description: HMCManagementSpec defines the desired state of HMCManagement + description: AWSProviderSpec defines the desired state of AWSProvider properties: foo: - description: Foo is an example field of HMCManagement. Edit hmcmanagement_types.go + description: Foo is an example field of AWSProvider. Edit awsprovider_types.go to remove/update type: string type: object status: - description: HMCManagementStatus defines the observed state of HMCManagement + description: AWSProviderStatus defines the observed state of AWSProvider type: object type: object served: true diff --git a/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmcdeployments.yaml b/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_deployments.yaml similarity index 83% rename from config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmcdeployments.yaml rename to config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_deployments.yaml index 0e4f4f545..2dcc251c2 100644 --- a/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmcdeployments.yaml +++ b/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_deployments.yaml @@ -4,20 +4,20 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 - name: hmcdeployments.hmc.mirantis.com.hmc.mirantis.com + name: deployments.hmc.mirantis.com.hmc.mirantis.com spec: group: hmc.mirantis.com.hmc.mirantis.com names: - kind: HMCDeployment - listKind: HMCDeploymentList - plural: hmcdeployments - singular: hmcdeployment + kind: Deployment + listKind: DeploymentList + plural: deployments + singular: deployment scope: Namespaced versions: - name: v1alpha1 schema: openAPIV3Schema: - description: HMCDeployment is the Schema for the hmcdeployments API + description: Deployment is the Schema for the deployments API properties: apiVersion: description: |- @@ -37,7 +37,7 @@ spec: metadata: type: object spec: - description: HMCDeploymentSpec defines the desired state of HMCDeployment + description: DeploymentSpec defines the desired state of Deployment properties: configuration: description: |- @@ -50,14 +50,14 @@ spec: after validation or only validated. type: boolean template: - description: Template is a reference to a HMCTemplate object located + description: Template is a reference to a Template object located in the same namespace. type: string required: - template type: object status: - description: HMCDeploymentStatus defines the observed state of HMCDeployment + description: DeploymentStatus defines the observed state of Deployment properties: valid: description: Valid indicates whether the template passed validation diff --git a/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmcproviderawses.yaml b/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_managements.yaml similarity index 73% rename from config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmcproviderawses.yaml rename to config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_managements.yaml index 12a9ffe75..db2f3d3cd 100644 --- a/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmcproviderawses.yaml +++ b/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_managements.yaml @@ -4,20 +4,20 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 - name: hmcproviderawses.hmc.mirantis.com.hmc.mirantis.com + name: managements.hmc.mirantis.com.hmc.mirantis.com spec: group: hmc.mirantis.com.hmc.mirantis.com names: - kind: HMCProviderAWS - listKind: HMCProviderAWSList - plural: hmcproviderawses - singular: hmcprovideraws + kind: Management + listKind: ManagementList + plural: managements + singular: management scope: Namespaced versions: - name: v1alpha1 schema: openAPIV3Schema: - description: HMCProviderAWS is the Schema for the hmcprovideraws API + description: Management is the Schema for the managements API properties: apiVersion: description: |- @@ -37,15 +37,15 @@ spec: metadata: type: object spec: - description: HMCProviderAWSSpec defines the desired state of HMCProviderAWS + description: ManagementSpec defines the desired state of Management properties: foo: - description: Foo is an example field of HMCProviderAWS. Edit hmcprovideraws_types.go + description: Foo is an example field of Management. Edit management_types.go to remove/update type: string type: object status: - description: HMCProviderAWSStatus defines the observed state of HMCProviderAWS + description: ManagementStatus defines the observed state of Management type: object type: object served: true diff --git a/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmctemplates.yaml b/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_templates.yaml similarity index 85% rename from config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmctemplates.yaml rename to config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_templates.yaml index 14dd8f2d0..6687eb43c 100644 --- a/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_hmctemplates.yaml +++ b/config/crd/bases/hmc.mirantis.com.hmc.mirantis.com_templates.yaml @@ -4,20 +4,20 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.14.0 - name: hmctemplates.hmc.mirantis.com.hmc.mirantis.com + name: templates.hmc.mirantis.com.hmc.mirantis.com spec: group: hmc.mirantis.com.hmc.mirantis.com names: - kind: HMCTemplate - listKind: HMCTemplateList - plural: hmctemplates - singular: hmctemplate + kind: Template + listKind: TemplateList + plural: templates + singular: template scope: Namespaced versions: - name: v1alpha1 schema: openAPIV3Schema: - description: HMCTemplate is the Schema for the hmctemplates API + description: Template is the Schema for the templates API properties: apiVersion: description: |- @@ -37,7 +37,7 @@ spec: metadata: type: object spec: - description: HMCTemplateSpec defines the desired state of HMCTemplate + description: TemplateSpec defines the desired state of Template properties: helmChartURL: description: HelmChartURL is a URL of the helm chart representing @@ -54,7 +54,7 @@ spec: - provider type: object status: - description: HMCTemplateStatus defines the observed state of HMCTemplate + description: TemplateStatus defines the observed state of Template properties: description: description: Descriptions contains information about the template. diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 5acf70a1f..cac0e48de 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -2,10 +2,10 @@ # since it depends on service name and namespace that are out of this kustomize package. # It should be run by config/default resources: -- bases/hmc.mirantis.com.hmc.mirantis.com_hmctemplates.yaml -- bases/hmc.mirantis.com.hmc.mirantis.com_hmcdeployments.yaml -- bases/hmc.mirantis.com.hmc.mirantis.com_hmcmanagements.yaml -- bases/hmc.mirantis.com.hmc.mirantis.com_hmcprovideraws.yaml +- bases/hmc.mirantis.com.hmc.mirantis.com_templates.yaml +- bases/hmc.mirantis.com.hmc.mirantis.com_deployments.yaml +- bases/hmc.mirantis.com.hmc.mirantis.com_managements.yaml +- bases/hmc.mirantis.com.hmc.mirantis.com_awsprovider.yaml #+kubebuilder:scaffold:crdkustomizeresource patches: @@ -15,10 +15,10 @@ patches: # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD -#- path: patches/cainjection_in_hmctemplates.yaml -#- path: patches/cainjection_in_hmcdeployments.yaml -#- path: patches/cainjection_in_hmcmanagements.yaml -#- path: patches/cainjection_in_hmcprovideraws.yaml +#- path: patches/cainjection_in_templates.yaml +#- path: patches/cainjection_in_deployments.yaml +#- path: patches/cainjection_in_managements.yaml +#- path: patches/cainjection_in_awsprovider.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # [WEBHOOK] To enable webhook, uncomment the following section diff --git a/config/rbac/hmcdeployment_editor_role.yaml b/config/rbac/hmcdeployment_editor_role.yaml index d3f833f61..2d144e4ee 100644 --- a/config/rbac/hmcdeployment_editor_role.yaml +++ b/config/rbac/hmcdeployment_editor_role.yaml @@ -1,16 +1,16 @@ -# permissions for end users to edit hmcdeployments. +# permissions for end users to edit deployments. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmcdeployment-editor-role + name: deployment-editor-role rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcdeployments + - deployments verbs: - create - delete @@ -22,6 +22,6 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcdeployments/status + - deployments/status verbs: - get diff --git a/config/rbac/hmcdeployment_viewer_role.yaml b/config/rbac/hmcdeployment_viewer_role.yaml index 9efbd0ba7..288f1bdc1 100644 --- a/config/rbac/hmcdeployment_viewer_role.yaml +++ b/config/rbac/hmcdeployment_viewer_role.yaml @@ -1,16 +1,16 @@ -# permissions for end users to view hmcdeployments. +# permissions for end users to view deployments. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmcdeployment-viewer-role + name: deployment-viewer-role rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcdeployments + - deployments verbs: - get - list @@ -18,6 +18,6 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcdeployments/status + - deployments/status verbs: - get diff --git a/config/rbac/hmcmanagement_editor_role.yaml b/config/rbac/hmcmanagement_editor_role.yaml index 2b6420d0a..7ead123ab 100644 --- a/config/rbac/hmcmanagement_editor_role.yaml +++ b/config/rbac/hmcmanagement_editor_role.yaml @@ -1,16 +1,16 @@ -# permissions for end users to edit hmcmanagements. +# permissions for end users to edit managements. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmcmanagement-editor-role + name: management-editor-role rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcmanagements + - managements verbs: - create - delete @@ -22,6 +22,6 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcmanagements/status + - managements/status verbs: - get diff --git a/config/rbac/hmcmanagement_viewer_role.yaml b/config/rbac/hmcmanagement_viewer_role.yaml index 22737e944..fcf9a131c 100644 --- a/config/rbac/hmcmanagement_viewer_role.yaml +++ b/config/rbac/hmcmanagement_viewer_role.yaml @@ -1,16 +1,16 @@ -# permissions for end users to view hmcmanagements. +# permissions for end users to view managements. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmcmanagement-viewer-role + name: management-viewer-role rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcmanagements + - managements verbs: - get - list @@ -18,6 +18,6 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcmanagements/status + - managements/status verbs: - get diff --git a/config/rbac/hmcprovideraws_editor_role.yaml b/config/rbac/hmcprovideraws_editor_role.yaml index 443b00799..249a58591 100644 --- a/config/rbac/hmcprovideraws_editor_role.yaml +++ b/config/rbac/hmcprovideraws_editor_role.yaml @@ -1,16 +1,16 @@ -# permissions for end users to edit hmcprovideraws. +# permissions for end users to edit awsprovider. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmcprovideraws-editor-role + name: awsprovider-editor-role rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcprovideraws + - awsprovider verbs: - create - delete @@ -22,6 +22,6 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcprovideraws/status + - awsprovider/status verbs: - get diff --git a/config/rbac/hmcprovideraws_viewer_role.yaml b/config/rbac/hmcprovideraws_viewer_role.yaml index 9a0be6958..711b211fc 100644 --- a/config/rbac/hmcprovideraws_viewer_role.yaml +++ b/config/rbac/hmcprovideraws_viewer_role.yaml @@ -1,16 +1,16 @@ -# permissions for end users to view hmcprovideraws. +# permissions for end users to view awsprovider. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmcprovideraws-viewer-role + name: awsprovider-viewer-role rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcprovideraws + - awsprovider verbs: - get - list @@ -18,6 +18,6 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcprovideraws/status + - awsprovider/status verbs: - get diff --git a/config/rbac/hmctemplate_editor_role.yaml b/config/rbac/hmctemplate_editor_role.yaml index cd9b4b697..9d5fef4fe 100644 --- a/config/rbac/hmctemplate_editor_role.yaml +++ b/config/rbac/hmctemplate_editor_role.yaml @@ -1,16 +1,16 @@ -# permissions for end users to edit hmctemplates. +# permissions for end users to edit templates. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmctemplate-editor-role + name: template-editor-role rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmctemplates + - templates verbs: - create - delete @@ -22,6 +22,6 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmctemplates/status + - templates/status verbs: - get diff --git a/config/rbac/hmctemplate_viewer_role.yaml b/config/rbac/hmctemplate_viewer_role.yaml index 5492a6f26..627bd2a80 100644 --- a/config/rbac/hmctemplate_viewer_role.yaml +++ b/config/rbac/hmctemplate_viewer_role.yaml @@ -1,16 +1,16 @@ -# permissions for end users to view hmctemplates. +# permissions for end users to view templates. apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmctemplate-viewer-role + name: template-viewer-role rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmctemplates + - templates verbs: - get - list @@ -18,6 +18,6 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmctemplates/status + - templates/status verbs: - get diff --git a/config/rbac/kustomization.yaml b/config/rbac/kustomization.yaml index 978dfb38e..0b5332b4d 100644 --- a/config/rbac/kustomization.yaml +++ b/config/rbac/kustomization.yaml @@ -14,12 +14,12 @@ resources: # default, aiding admins in cluster management. Those roles are # not used by the Project itself. You can comment the following lines # if you do not want those helpers be installed with your Project. -- hmcprovideraws_editor_role.yaml -- hmcprovideraws_viewer_role.yaml -- hmcmanagement_editor_role.yaml -- hmcmanagement_viewer_role.yaml -- hmcdeployment_editor_role.yaml -- hmcdeployment_viewer_role.yaml -- hmctemplate_editor_role.yaml -- hmctemplate_viewer_role.yaml +- awsprovider_editor_role.yaml +- awsprovider_viewer_role.yaml +- management_editor_role.yaml +- management_viewer_role.yaml +- deployment_editor_role.yaml +- deployment_viewer_role.yaml +- template_editor_role.yaml +- template_viewer_role.yaml diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 04ee1b8fe..05c03c7f4 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -7,7 +7,7 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcdeployments + - awsprovider verbs: - create - delete @@ -19,13 +19,13 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcdeployments/finalizers + - awsprovider/finalizers verbs: - update - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcdeployments/status + - awsprovider/status verbs: - get - patch @@ -33,7 +33,7 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcmanagements + - deployments verbs: - create - delete @@ -45,13 +45,13 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcmanagements/finalizers + - deployments/finalizers verbs: - update - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcmanagements/status + - deployments/status verbs: - get - patch @@ -59,7 +59,7 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcprovideraws + - managements verbs: - create - delete @@ -71,13 +71,13 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcprovideraws/finalizers + - managements/finalizers verbs: - update - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmcprovideraws/status + - managements/status verbs: - get - patch @@ -85,7 +85,7 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmctemplates + - templates verbs: - create - delete @@ -97,13 +97,13 @@ rules: - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmctemplates/finalizers + - templates/finalizers verbs: - update - apiGroups: - hmc.mirantis.com.hmc.mirantis.com resources: - - hmctemplates/status + - templates/status verbs: - get - patch diff --git a/config/samples/hmc.mirantis.com_v1alpha1_hmcdeployment.yaml b/config/samples/hmc.mirantis.com_v1alpha1_hmcdeployment.yaml index 6a8a58268..bf6bd4521 100644 --- a/config/samples/hmc.mirantis.com_v1alpha1_hmcdeployment.yaml +++ b/config/samples/hmc.mirantis.com_v1alpha1_hmcdeployment.yaml @@ -1,9 +1,9 @@ apiVersion: hmc.mirantis.com.hmc.mirantis.com/v1alpha1 -kind: HMCDeployment +kind: Deployment metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmcdeployment-sample + name: deployment-sample spec: # TODO(user): Add fields here diff --git a/config/samples/hmc.mirantis.com_v1alpha1_hmcmanagement.yaml b/config/samples/hmc.mirantis.com_v1alpha1_hmcmanagement.yaml index 3b964d542..1041a08fa 100644 --- a/config/samples/hmc.mirantis.com_v1alpha1_hmcmanagement.yaml +++ b/config/samples/hmc.mirantis.com_v1alpha1_hmcmanagement.yaml @@ -1,9 +1,9 @@ apiVersion: hmc.mirantis.com.hmc.mirantis.com/v1alpha1 -kind: HMCManagement +kind: Management metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmcmanagement-sample + name: management-sample spec: # TODO(user): Add fields here diff --git a/config/samples/hmc.mirantis.com_v1alpha1_hmcprovideraws.yaml b/config/samples/hmc.mirantis.com_v1alpha1_hmcprovideraws.yaml index 97fc7d49c..f0fef4ddf 100644 --- a/config/samples/hmc.mirantis.com_v1alpha1_hmcprovideraws.yaml +++ b/config/samples/hmc.mirantis.com_v1alpha1_hmcprovideraws.yaml @@ -1,9 +1,9 @@ apiVersion: hmc.mirantis.com.hmc.mirantis.com/v1alpha1 -kind: HMCProviderAWS +kind: AWSProvider metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmcprovideraws-sample + name: awsprovider-sample spec: # TODO(user): Add fields here diff --git a/config/samples/hmc.mirantis.com_v1alpha1_hmctemplate.yaml b/config/samples/hmc.mirantis.com_v1alpha1_hmctemplate.yaml index c9e699ddd..95aa485a8 100644 --- a/config/samples/hmc.mirantis.com_v1alpha1_hmctemplate.yaml +++ b/config/samples/hmc.mirantis.com_v1alpha1_hmctemplate.yaml @@ -1,9 +1,9 @@ apiVersion: hmc.mirantis.com.hmc.mirantis.com/v1alpha1 -kind: HMCTemplate +kind: Template metadata: labels: app.kubernetes.io/name: hmc app.kubernetes.io/managed-by: kustomize - name: hmctemplate-sample + name: template-sample spec: # TODO(user): Add fields here diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml index 5213ca4ae..c3af2d1f9 100644 --- a/config/samples/kustomization.yaml +++ b/config/samples/kustomization.yaml @@ -1,7 +1,7 @@ ## Append samples of your project ## resources: -- hmc.mirantis.com_v1alpha1_hmctemplate.yaml -- hmc.mirantis.com_v1alpha1_hmcdeployment.yaml -- hmc.mirantis.com_v1alpha1_hmcmanagement.yaml -- hmc.mirantis.com_v1alpha1_hmcprovideraws.yaml +- hmc.mirantis.com_v1alpha1_template.yaml +- hmc.mirantis.com_v1alpha1_deployment.yaml +- hmc.mirantis.com_v1alpha1_management.yaml +- hmc.mirantis.com_v1alpha1_awsprovider.yaml #+kubebuilder:scaffold:manifestskustomizesamples diff --git a/internal/controller/hmcdeployment_controller.go b/internal/controller/hmcdeployment_controller.go index 4d014f129..eeabf0b02 100644 --- a/internal/controller/hmcdeployment_controller.go +++ b/internal/controller/hmcdeployment_controller.go @@ -27,26 +27,26 @@ import ( hmcmirantiscomv1alpha1 "github.com/Mirantis/hmc/api/v1alpha1" ) -// HMCDeploymentReconciler reconciles a HMCDeployment object -type HMCDeploymentReconciler struct { +// DeploymentReconciler reconciles a Deployment object +type DeploymentReconciler struct { client.Client Scheme *runtime.Scheme } -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmcdeployments,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmcdeployments/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmcdeployments/finalizers,verbs=update +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=deployments,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=deployments/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=deployments/finalizers,verbs=update // 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 HMCDeployment object against the actual cluster state, and then +// the Deployment 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.17.3/pkg/reconcile -func (r *HMCDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { +func (r *DeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { _ = log.FromContext(ctx) // TODO(user): your logic here @@ -55,8 +55,8 @@ func (r *HMCDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Reques } // SetupWithManager sets up the controller with the Manager. -func (r *HMCDeploymentReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *DeploymentReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&hmcmirantiscomv1alpha1.HMCDeployment{}). + For(&hmcmirantiscomv1alpha1.Deployment{}). Complete(r) } diff --git a/internal/controller/hmcdeployment_controller_test.go b/internal/controller/hmcdeployment_controller_test.go index ba5a97d3a..1fba0573e 100644 --- a/internal/controller/hmcdeployment_controller_test.go +++ b/internal/controller/hmcdeployment_controller_test.go @@ -30,7 +30,7 @@ import ( hmcmirantiscomv1alpha1 "github.com/Mirantis/hmc/api/v1alpha1" ) -var _ = Describe("HMCDeployment Controller", func() { +var _ = Describe("Deployment Controller", func() { Context("When reconciling a resource", func() { const resourceName = "test-resource" @@ -40,13 +40,13 @@ var _ = Describe("HMCDeployment Controller", func() { Name: resourceName, Namespace: "default", // TODO(user):Modify as needed } - hmcdeployment := &hmcmirantiscomv1alpha1.HMCDeployment{} + deployment := &hmcmirantiscomv1alpha1.Deployment{} BeforeEach(func() { - By("creating the custom resource for the Kind HMCDeployment") - err := k8sClient.Get(ctx, typeNamespacedName, hmcdeployment) + By("creating the custom resource for the Kind Deployment") + err := k8sClient.Get(ctx, typeNamespacedName, deployment) if err != nil && errors.IsNotFound(err) { - resource := &hmcmirantiscomv1alpha1.HMCDeployment{ + resource := &hmcmirantiscomv1alpha1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Name: resourceName, Namespace: "default", @@ -59,16 +59,16 @@ var _ = Describe("HMCDeployment Controller", func() { AfterEach(func() { // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &hmcmirantiscomv1alpha1.HMCDeployment{} + resource := &hmcmirantiscomv1alpha1.Deployment{} err := k8sClient.Get(ctx, typeNamespacedName, resource) Expect(err).NotTo(HaveOccurred()) - By("Cleanup the specific resource instance HMCDeployment") + By("Cleanup the specific resource instance Deployment") Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) }) It("should successfully reconcile the resource", func() { By("Reconciling the created resource") - controllerReconciler := &HMCDeploymentReconciler{ + controllerReconciler := &DeploymentReconciler{ Client: k8sClient, Scheme: k8sClient.Scheme(), } diff --git a/internal/controller/hmcmanagement_controller.go b/internal/controller/hmcmanagement_controller.go index 8fb4ac944..c3f8f5a37 100644 --- a/internal/controller/hmcmanagement_controller.go +++ b/internal/controller/hmcmanagement_controller.go @@ -27,26 +27,26 @@ import ( hmcmirantiscomv1alpha1 "github.com/Mirantis/hmc/api/v1alpha1" ) -// HMCManagementReconciler reconciles a HMCManagement object -type HMCManagementReconciler struct { +// ManagementReconciler reconciles a Management object +type ManagementReconciler struct { client.Client Scheme *runtime.Scheme } -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmcmanagements,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmcmanagements/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmcmanagements/finalizers,verbs=update +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=managements,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=managements/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=managements/finalizers,verbs=update // 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 HMCManagement object against the actual cluster state, and then +// the Management 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.17.3/pkg/reconcile -func (r *HMCManagementReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { +func (r *ManagementReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { _ = log.FromContext(ctx) // TODO(user): your logic here @@ -55,8 +55,8 @@ func (r *HMCManagementReconciler) Reconcile(ctx context.Context, req ctrl.Reques } // SetupWithManager sets up the controller with the Manager. -func (r *HMCManagementReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *ManagementReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&hmcmirantiscomv1alpha1.HMCManagement{}). + For(&hmcmirantiscomv1alpha1.Management{}). Complete(r) } diff --git a/internal/controller/hmcmanagement_controller_test.go b/internal/controller/hmcmanagement_controller_test.go index e698e4fa0..bf0fc66da 100644 --- a/internal/controller/hmcmanagement_controller_test.go +++ b/internal/controller/hmcmanagement_controller_test.go @@ -30,7 +30,7 @@ import ( hmcmirantiscomv1alpha1 "github.com/Mirantis/hmc/api/v1alpha1" ) -var _ = Describe("HMCManagement Controller", func() { +var _ = Describe("Management Controller", func() { Context("When reconciling a resource", func() { const resourceName = "test-resource" @@ -40,13 +40,13 @@ var _ = Describe("HMCManagement Controller", func() { Name: resourceName, Namespace: "default", // TODO(user):Modify as needed } - hmcmanagement := &hmcmirantiscomv1alpha1.HMCManagement{} + management := &hmcmirantiscomv1alpha1.Management{} BeforeEach(func() { - By("creating the custom resource for the Kind HMCManagement") - err := k8sClient.Get(ctx, typeNamespacedName, hmcmanagement) + By("creating the custom resource for the Kind Management") + err := k8sClient.Get(ctx, typeNamespacedName, management) if err != nil && errors.IsNotFound(err) { - resource := &hmcmirantiscomv1alpha1.HMCManagement{ + resource := &hmcmirantiscomv1alpha1.Management{ ObjectMeta: metav1.ObjectMeta{ Name: resourceName, Namespace: "default", @@ -59,16 +59,16 @@ var _ = Describe("HMCManagement Controller", func() { AfterEach(func() { // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &hmcmirantiscomv1alpha1.HMCManagement{} + resource := &hmcmirantiscomv1alpha1.Management{} err := k8sClient.Get(ctx, typeNamespacedName, resource) Expect(err).NotTo(HaveOccurred()) - By("Cleanup the specific resource instance HMCManagement") + By("Cleanup the specific resource instance Management") Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) }) It("should successfully reconcile the resource", func() { By("Reconciling the created resource") - controllerReconciler := &HMCManagementReconciler{ + controllerReconciler := &ManagementReconciler{ Client: k8sClient, Scheme: k8sClient.Scheme(), } diff --git a/internal/controller/hmcprovideraws_controller.go b/internal/controller/hmcprovideraws_controller.go index 9b9613595..c4d4be34d 100644 --- a/internal/controller/hmcprovideraws_controller.go +++ b/internal/controller/hmcprovideraws_controller.go @@ -27,26 +27,26 @@ import ( hmcmirantiscomv1alpha1 "github.com/Mirantis/hmc/api/v1alpha1" ) -// HMCProviderAWSReconciler reconciles a HMCProviderAWS object -type HMCProviderAWSReconciler struct { +// AWSProviderReconciler reconciles a AWSProvider object +type AWSProviderReconciler struct { client.Client Scheme *runtime.Scheme } -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmcprovideraws,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmcprovideraws/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmcprovideraws/finalizers,verbs=update +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=awsprovider,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=awsprovider/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=awsprovider/finalizers,verbs=update // 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 HMCProviderAWS object against the actual cluster state, and then +// the AWSProvider 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.17.3/pkg/reconcile -func (r *HMCProviderAWSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { +func (r *AWSProviderReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { _ = log.FromContext(ctx) // TODO(user): your logic here @@ -55,8 +55,8 @@ func (r *HMCProviderAWSReconciler) Reconcile(ctx context.Context, req ctrl.Reque } // SetupWithManager sets up the controller with the Manager. -func (r *HMCProviderAWSReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *AWSProviderReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&hmcmirantiscomv1alpha1.HMCProviderAWS{}). + For(&hmcmirantiscomv1alpha1.AWSProvider{}). Complete(r) } diff --git a/internal/controller/hmcprovideraws_controller_test.go b/internal/controller/hmcprovideraws_controller_test.go index a05db8d5a..65f631602 100644 --- a/internal/controller/hmcprovideraws_controller_test.go +++ b/internal/controller/hmcprovideraws_controller_test.go @@ -30,7 +30,7 @@ import ( hmcmirantiscomv1alpha1 "github.com/Mirantis/hmc/api/v1alpha1" ) -var _ = Describe("HMCProviderAWS Controller", func() { +var _ = Describe("AWSProvider Controller", func() { Context("When reconciling a resource", func() { const resourceName = "test-resource" @@ -40,13 +40,13 @@ var _ = Describe("HMCProviderAWS Controller", func() { Name: resourceName, Namespace: "default", // TODO(user):Modify as needed } - hmcprovideraws := &hmcmirantiscomv1alpha1.HMCProviderAWS{} + awsprovider := &hmcmirantiscomv1alpha1.AWSProvider{} BeforeEach(func() { - By("creating the custom resource for the Kind HMCProviderAWS") - err := k8sClient.Get(ctx, typeNamespacedName, hmcprovideraws) + By("creating the custom resource for the Kind AWSProvider") + err := k8sClient.Get(ctx, typeNamespacedName, awsprovider) if err != nil && errors.IsNotFound(err) { - resource := &hmcmirantiscomv1alpha1.HMCProviderAWS{ + resource := &hmcmirantiscomv1alpha1.AWSProvider{ ObjectMeta: metav1.ObjectMeta{ Name: resourceName, Namespace: "default", @@ -59,16 +59,16 @@ var _ = Describe("HMCProviderAWS Controller", func() { AfterEach(func() { // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &hmcmirantiscomv1alpha1.HMCProviderAWS{} + resource := &hmcmirantiscomv1alpha1.AWSProvider{} err := k8sClient.Get(ctx, typeNamespacedName, resource) Expect(err).NotTo(HaveOccurred()) - By("Cleanup the specific resource instance HMCProviderAWS") + By("Cleanup the specific resource instance AWSProvider") Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) }) It("should successfully reconcile the resource", func() { By("Reconciling the created resource") - controllerReconciler := &HMCProviderAWSReconciler{ + controllerReconciler := &AWSProviderReconciler{ Client: k8sClient, Scheme: k8sClient.Scheme(), } diff --git a/internal/controller/hmctemplate_controller.go b/internal/controller/hmctemplate_controller.go index e05ab9cfc..c49f942d5 100644 --- a/internal/controller/hmctemplate_controller.go +++ b/internal/controller/hmctemplate_controller.go @@ -27,26 +27,26 @@ import ( hmcmirantiscomv1alpha1 "github.com/Mirantis/hmc/api/v1alpha1" ) -// HMCTemplateReconciler reconciles a HMCTemplate object -type HMCTemplateReconciler struct { +// TemplateReconciler reconciles a Template object +type TemplateReconciler struct { client.Client Scheme *runtime.Scheme } -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmctemplates,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmctemplates/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=hmctemplates/finalizers,verbs=update +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=templates,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=templates/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=hmc.mirantis.com.hmc.mirantis.com,resources=templates/finalizers,verbs=update // 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 HMCTemplate object against the actual cluster state, and then +// the Template 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.17.3/pkg/reconcile -func (r *HMCTemplateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { +func (r *TemplateReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { _ = log.FromContext(ctx) // TODO(user): your logic here @@ -55,8 +55,8 @@ func (r *HMCTemplateReconciler) Reconcile(ctx context.Context, req ctrl.Request) } // SetupWithManager sets up the controller with the Manager. -func (r *HMCTemplateReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *TemplateReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&hmcmirantiscomv1alpha1.HMCTemplate{}). + For(&hmcmirantiscomv1alpha1.Template{}). Complete(r) } diff --git a/internal/controller/hmctemplate_controller_test.go b/internal/controller/hmctemplate_controller_test.go index f7c783b19..b6303dbfb 100644 --- a/internal/controller/hmctemplate_controller_test.go +++ b/internal/controller/hmctemplate_controller_test.go @@ -30,7 +30,7 @@ import ( hmcmirantiscomv1alpha1 "github.com/Mirantis/hmc/api/v1alpha1" ) -var _ = Describe("HMCTemplate Controller", func() { +var _ = Describe("Template Controller", func() { Context("When reconciling a resource", func() { const resourceName = "test-resource" @@ -40,18 +40,18 @@ var _ = Describe("HMCTemplate Controller", func() { Name: resourceName, Namespace: "default", // TODO(user):Modify as needed } - hmctemplate := &hmcmirantiscomv1alpha1.HMCTemplate{} + template := &hmcmirantiscomv1alpha1.Template{} BeforeEach(func() { - By("creating the custom resource for the Kind HMCTemplate") - err := k8sClient.Get(ctx, typeNamespacedName, hmctemplate) + By("creating the custom resource for the Kind Template") + err := k8sClient.Get(ctx, typeNamespacedName, template) if err != nil && errors.IsNotFound(err) { - resource := &hmcmirantiscomv1alpha1.HMCTemplate{ + resource := &hmcmirantiscomv1alpha1.Template{ ObjectMeta: metav1.ObjectMeta{ Name: resourceName, Namespace: "default", }, - Spec: hmcmirantiscomv1alpha1.HMCTemplateSpec{ + Spec: hmcmirantiscomv1alpha1.TemplateSpec{ Provider: "aws", HelmChartURL: "oci://ghcr.io/Mirantis/hmc/charts/aws-template-example", }, @@ -63,16 +63,16 @@ var _ = Describe("HMCTemplate Controller", func() { AfterEach(func() { // TODO(user): Cleanup logic after each test, like removing the resource instance. - resource := &hmcmirantiscomv1alpha1.HMCTemplate{} + resource := &hmcmirantiscomv1alpha1.Template{} err := k8sClient.Get(ctx, typeNamespacedName, resource) Expect(err).NotTo(HaveOccurred()) - By("Cleanup the specific resource instance HMCTemplate") + By("Cleanup the specific resource instance Template") Expect(k8sClient.Delete(ctx, resource)).To(Succeed()) }) It("should successfully reconcile the resource", func() { By("Reconciling the created resource") - controllerReconciler := &HMCTemplateReconciler{ + controllerReconciler := &TemplateReconciler{ Client: k8sClient, Scheme: k8sClient.Scheme(), }