Skip to content

Commit

Permalink
Add support to define a separate image name for a specified version
Browse files Browse the repository at this point in the history
  • Loading branch information
NotTheEvilOne committed Jun 16, 2021
1 parent b55d1ad commit 8589b60
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/hcloud/apis/transcoder/cloud_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ func DecodeMachineImageNameFromCloudProfile(cpConfig *apis.CloudProfileConfig, i
}
for _, version := range machineImage.Versions {
if imageVersion == version.Version {
return fmt.Sprintf("%s-%s", imageName, imageVersion), nil
imageName := version.ImageName
if "" == imageName {
imageName = fmt.Sprintf("%s-%s", imageName, imageVersion)
}

return imageName, nil
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/hcloud/apis/types_cloudprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ type MachineImages struct {
type MachineImageVersion struct {
// Version is the version of the image.
Version string
// ImageName is the Hetzner Cloud image name if not matching name + "-" + version.
ImageName string `json:"imageName,omitempty"`
}

// MachineTypeOptions defines additional VM options for an machine type given by name
Expand Down
2 changes: 2 additions & 0 deletions pkg/hcloud/apis/v1alpha1/types_cloudprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ type MachineImages struct {
type MachineImageVersion struct {
// Version is the version of the image.
Version string `json:"version"`
// ImageName is the Hetzner Cloud image name if not matching name + "-" + version.
ImageName string `json:"imageName,omitempty"`
}

// MachineTypeOptions defines additional VM options for an machine type given by name
Expand Down
2 changes: 2 additions & 0 deletions pkg/hcloud/apis/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8589b60

Please sign in to comment.