Skip to content

Commit

Permalink
Modified ova template name to use failure domain name
Browse files Browse the repository at this point in the history
  • Loading branch information
vr4manta committed Dec 10, 2024
1 parent 4b3b314 commit 75c25dc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/infrastructure/vsphere/clusterapi/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,17 @@ func checkOvaSecureBoot(ovfEnvelope *ovf.Envelope) bool {
}

func importRhcosOva(ctx context.Context, session *session.Session, folder *object.Folder, cachedImage, clusterID, tagID, diskProvisioningType string, failureDomain vsphere.FailureDomain) error {
name := fmt.Sprintf("%s-rhcos-%s-%s", clusterID, failureDomain.Region, failureDomain.Zone)
// Name originally was cluster id + fd.region + fd.zone. This could cause length of ova to be longer than max allowed.
// So for now, we are going to make cluster id + fd.name
name := fmt.Sprintf("%s-rhcos-%s", clusterID, failureDomain.Name)
logrus.Infof("Importing OVA %v into failure domain %v.", name, failureDomain.Name)

// OVA name must not exceed 80 characters
if len(name) > 80 {
logrus.Warningf("Unable to generate ova template name due to exceeding 80 characters. Cluster=\"%v\" Failure Domain=\"%v\" results in \"%v\"", clusterID, failureDomain.Name, name)
return fmt.Errorf("ova name length exceeed 80 characters. %v has length %d. ")
}

archive := &importer.TapeArchive{Path: cachedImage}

ovfDescriptor, err := importer.ReadOvf("*.ovf", archive)
Expand Down

0 comments on commit 75c25dc

Please sign in to comment.