99 "time"
1010
1111 "github.com/aws/aws-sdk-go/aws"
12+ "github.com/aws/aws-sdk-go/aws/endpoints"
1213 "github.com/aws/aws-sdk-go/aws/request"
1314 "github.com/aws/aws-sdk-go/service/ec2"
1415 "github.com/aws/aws-sdk-go/service/ec2/ec2iface"
@@ -196,29 +197,36 @@ func (a InfraProvider) Provision(dir string, parents asset.Parents) ([]*asset.Fi
196197 return nil , fmt .Errorf ("failed to create security groups: %w" , err )
197198 }
198199
200+ partitionDNSSuffix := "amazonaws.com"
201+ if ps , found := endpoints .PartitionForRegion (endpoints .DefaultPartitions (), clusterAWSConfig .Region ); found {
202+ partitionDNSSuffix = ps .DNSSuffix ()
203+ }
204+ logger .Debugf ("Using partition DNS suffix: %s" , partitionDNSSuffix )
205+
199206 logger .Infoln ("Creating bootstrap resources" )
200207 bootstrapSubnet := vpcOutput .privateSubnetIDs [0 ]
201208 if usePublicEndpoints {
202209 bootstrapSubnet = vpcOutput .publicSubnetIDs [0 ]
203210 }
204211 bootstrapInput := bootstrapInputOptions {
205212 instanceInputOptions : instanceInputOptions {
206- infraID : clusterConfig .ClusterID ,
207- amiID : amiID ,
208- instanceType : clusterAWSConfig .MasterInstanceType ,
209- iamRole : clusterAWSConfig .MasterIAMRoleName ,
210- volumeType : "gp2" ,
211- volumeSize : 30 ,
212- volumeIOPS : 0 ,
213- isEncrypted : true ,
214- metadataAuth : clusterAWSConfig .BootstrapMetadataAuthentication ,
215- kmsKeyID : clusterAWSConfig .KMSKeyID ,
216- securityGroupIds : []string {sgOutput .bootstrap , sgOutput .controlPlane },
217- targetGroupARNs : lbOutput .targetGroupArns ,
218- subnetID : bootstrapSubnet ,
219- associatePublicIP : usePublicEndpoints ,
220- userData : clusterAWSConfig .BootstrapIgnitionStub ,
221- tags : tags ,
213+ infraID : clusterConfig .ClusterID ,
214+ amiID : amiID ,
215+ instanceType : clusterAWSConfig .MasterInstanceType ,
216+ iamRole : clusterAWSConfig .MasterIAMRoleName ,
217+ volumeType : "gp2" ,
218+ volumeSize : 30 ,
219+ volumeIOPS : 0 ,
220+ isEncrypted : true ,
221+ metadataAuth : clusterAWSConfig .BootstrapMetadataAuthentication ,
222+ kmsKeyID : clusterAWSConfig .KMSKeyID ,
223+ securityGroupIds : []string {sgOutput .bootstrap , sgOutput .controlPlane },
224+ targetGroupARNs : lbOutput .targetGroupArns ,
225+ subnetID : bootstrapSubnet ,
226+ associatePublicIP : usePublicEndpoints ,
227+ userData : clusterAWSConfig .BootstrapIgnitionStub ,
228+ partitionDNSSuffix : partitionDNSSuffix ,
229+ tags : tags ,
222230 },
223231 ignitionBucket : clusterAWSConfig .IgnitionBucket ,
224232 ignitionContent : clusterConfig .IgnitionBootstrap ,
@@ -233,21 +241,22 @@ func (a InfraProvider) Provision(dir string, parents asset.Parents) ([]*asset.Fi
233241 logger .Infoln ("Creating control plane resources" )
234242 controlPlaneInput := controlPlaneInputOptions {
235243 instanceInputOptions : instanceInputOptions {
236- infraID : clusterConfig .ClusterID ,
237- amiID : amiID ,
238- instanceType : clusterAWSConfig .MasterInstanceType ,
239- iamRole : clusterAWSConfig .MasterIAMRoleName ,
240- volumeType : clusterAWSConfig .Type ,
241- volumeSize : clusterAWSConfig .Size ,
242- volumeIOPS : clusterAWSConfig .IOPS ,
243- isEncrypted : clusterAWSConfig .Encrypted ,
244- kmsKeyID : clusterAWSConfig .KMSKeyID ,
245- metadataAuth : clusterAWSConfig .MasterMetadataAuthentication ,
246- securityGroupIds : append (clusterAWSConfig .MasterSecurityGroups , sgOutput .controlPlane ),
247- targetGroupARNs : lbOutput .targetGroupArns ,
248- associatePublicIP : len (os .Getenv ("OPENSHIFT_INSTALL_AWS_PUBLIC_ONLY" )) > 0 ,
249- userData : clusterConfig .IgnitionMaster ,
250- tags : tags ,
244+ infraID : clusterConfig .ClusterID ,
245+ amiID : amiID ,
246+ instanceType : clusterAWSConfig .MasterInstanceType ,
247+ iamRole : clusterAWSConfig .MasterIAMRoleName ,
248+ volumeType : clusterAWSConfig .Type ,
249+ volumeSize : clusterAWSConfig .Size ,
250+ volumeIOPS : clusterAWSConfig .IOPS ,
251+ isEncrypted : clusterAWSConfig .Encrypted ,
252+ kmsKeyID : clusterAWSConfig .KMSKeyID ,
253+ metadataAuth : clusterAWSConfig .MasterMetadataAuthentication ,
254+ securityGroupIds : append (clusterAWSConfig .MasterSecurityGroups , sgOutput .controlPlane ),
255+ targetGroupARNs : lbOutput .targetGroupArns ,
256+ associatePublicIP : len (os .Getenv ("OPENSHIFT_INSTALL_AWS_PUBLIC_ONLY" )) > 0 ,
257+ userData : clusterConfig .IgnitionMaster ,
258+ partitionDNSSuffix : partitionDNSSuffix ,
259+ tags : tags ,
251260 },
252261 nReplicas : clusterConfig .Masters ,
253262 privateSubnetIDs : vpcOutput .privateSubnetIDs ,
@@ -261,8 +270,9 @@ func (a InfraProvider) Provision(dir string, parents asset.Parents) ([]*asset.Fi
261270
262271 logger .Infoln ("Creating compute resources" )
263272 computeInput := computeInputOptions {
264- infraID : clusterConfig .ClusterID ,
265- tags : tags ,
273+ infraID : clusterConfig .ClusterID ,
274+ partitionDNSSuffix : partitionDNSSuffix ,
275+ tags : tags ,
266276 }
267277 err = createComputeResources (ctx , logger , iamClient , & computeInput )
268278 if err != nil {
0 commit comments