From fdf94e39ee0226b152b6739a0dad848a005a5c26 Mon Sep 17 00:00:00 2001 From: Abhinav Dahiya Date: Tue, 16 Jul 2019 11:09:42 -0700 Subject: [PATCH] pkg/types/aws: allow specifying AMI ID for machines ref: https://jira.coreos.com/browse/CORS-1103 for aws the new order for osImage is: - env OPENSHIFT_INSTALL_OS_IMAGE_OVERRIDE - platform.aws.amiID - embedded ami for the region --- pkg/asset/rhcos/image.go | 4 ++++ pkg/types/aws/platform.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pkg/asset/rhcos/image.go b/pkg/asset/rhcos/image.go index 81a8f8ceb0e..a56de04a684 100644 --- a/pkg/asset/rhcos/image.go +++ b/pkg/asset/rhcos/image.go @@ -58,6 +58,10 @@ func (i *Image) Generate(p asset.Parents) error { defer cancel() switch config.Platform.Name() { case aws.Name: + if len(config.Platform.AWS.AMIID) > 0 { + osimage = config.Platform.AWS.AMIID + break + } osimage, err = rhcos.AMI(ctx, config.Platform.AWS.Region) case gcp.Name: case libvirt.Name: diff --git a/pkg/types/aws/platform.go b/pkg/types/aws/platform.go index f1d5042c255..5ecf153a5bb 100644 --- a/pkg/types/aws/platform.go +++ b/pkg/types/aws/platform.go @@ -3,6 +3,10 @@ package aws // Platform stores all the global configuration that all machinesets // use. type Platform struct { + // AMIID is the AMI that should be used to boot machines for the cluster. + // If set, the AMI should belong to the same region as the cluster. + AMIID string `json:"amiID,omitempty"` + // Region specifies the AWS region where the cluster will be created. Region string `json:"region"`