From 76f3eb954e01125cc769687c12e64c27744097ce Mon Sep 17 00:00:00 2001 From: Alexander Chuzhoy Date: Fri, 12 Apr 2024 15:06:51 -0400 Subject: [PATCH] IBU can only be named upgrade No support for multiple IBU CRs Signed-off-by: Alexander Chuzhoy --- pkg/lca/imagebasedupgrade.go | 44 ++++-------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-) diff --git a/pkg/lca/imagebasedupgrade.go b/pkg/lca/imagebasedupgrade.go index 8e850670f..b1839c653 100644 --- a/pkg/lca/imagebasedupgrade.go +++ b/pkg/lca/imagebasedupgrade.go @@ -23,6 +23,7 @@ const ( isTrue = "True" isFalse = "False" isComplete = "Completed" + ibuName = "upgrade" ) // ImageBasedUpgradeBuilder provides struct for the imagebasedupgrade object containing connection to @@ -42,35 +43,6 @@ type ImageBasedUpgradeBuilder struct { // AdditionalOptions additional options for imagebasedupgrade object. type AdditionalOptions func(builder *ImageBasedUpgradeBuilder) (*ImageBasedUpgradeBuilder, error) -// NewImageBasedUpgradeBuilder creates a new instance of ImageBasedUpgrade. -func NewImageBasedUpgradeBuilder( - apiClient *clients.Settings, - name string, -) *ImageBasedUpgradeBuilder { - if apiClient == nil { - glog.V(100).Infof("The apiClient cannot be nil") - - return nil - } - - builder := ImageBasedUpgradeBuilder{ - apiClient: apiClient.Client, - Definition: &lcav1alpha1.ImageBasedUpgrade{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - }, - }, - } - - if name == "" { - glog.V(100).Infof("The name of the imagebasedupgrade is empty") - - builder.errorMsg = "ImageBasedUpgrade name cannot be empty" - } - - return &builder -} - // WithOptions creates imagebasedupgrade with generic mutation options. func (builder *ImageBasedUpgradeBuilder) WithOptions(options ...AdditionalOptions) *ImageBasedUpgradeBuilder { if valid, _ := builder.validate(); !valid { @@ -97,8 +69,8 @@ func (builder *ImageBasedUpgradeBuilder) WithOptions(options ...AdditionalOption } // PullImageBasedUpgrade pulls existing imagebasedupgrade from cluster. -func PullImageBasedUpgrade(apiClient *clients.Settings, name string) (*ImageBasedUpgradeBuilder, error) { - glog.V(100).Infof("Pulling existing imagebasedupgrade name %s from cluster", name) +func PullImageBasedUpgrade(apiClient *clients.Settings) (*ImageBasedUpgradeBuilder, error) { + glog.V(100).Infof("Pulling existing imagebasedupgrade name %s from cluster", ibuName) if apiClient == nil { glog.V(100).Infof("The apiClient cannot be nil") @@ -110,19 +82,13 @@ func PullImageBasedUpgrade(apiClient *clients.Settings, name string) (*ImageBase apiClient: apiClient.Client, Definition: &lcav1alpha1.ImageBasedUpgrade{ ObjectMeta: metav1.ObjectMeta{ - Name: name, + Name: ibuName, }, }, } - if name == "" { - glog.V(100).Infof("The name of the imagebasedupgrade is empty") - - builder.errorMsg = "imagebasedupgrade 'name' cannot be empty" - } - if !builder.Exists() { - return nil, fmt.Errorf("imagebasedupgrade object %s doesn't exist", name) + return nil, fmt.Errorf("imagebasedupgrade object %s doesn't exist", ibuName) } builder.Definition = builder.Object