Skip to content

Commit

Permalink
ibm-powervs: Fix incorrect assignment of ImageId
Browse files Browse the repository at this point in the history
The image specified in the annotation was incorrectly overriding the
default cluster wide config.

Drive-by fix: fix var name for ConfigVerifier

Fixes: #2284

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
  • Loading branch information
bpradipt committed Feb 10, 2025
1 parent b9de6a8 commit 93f8ab2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cloud-providers/ibmcloud-powervs/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ func (p *ibmcloudPowerVSProvider) CreateInstance(ctx context.Context, podName, s
return nil, err
}

imageId := p.serviceConfig.ImageId

if spec.Image != "" {
logger.Printf("Choosing %s from annotation as the Power VS image for the PodVM image", spec.Image)
p.serviceConfig.ImageId = spec.Image
imageId = spec.Image
}

body := &models.PVMInstanceCreate{
ServerName: &instanceName,
ImageID: &p.serviceConfig.ImageId,
ImageID: &imageId,
KeyPairName: p.serviceConfig.SSHKey,
Networks: []*models.PVMInstanceAddNetwork{
{
Expand Down Expand Up @@ -148,8 +150,8 @@ func (p *ibmcloudPowerVSProvider) Teardown() error {
}

func (p *ibmcloudPowerVSProvider) ConfigVerifier() error {
ImageId := p.serviceConfig.ImageId
if len(ImageId) == 0 {
imageId := p.serviceConfig.ImageId
if len(imageId) == 0 {
return fmt.Errorf("ImageId is empty")
}
return nil
Expand Down

0 comments on commit 93f8ab2

Please sign in to comment.