Skip to content

Commit c470051

Browse files
committed
OCM-12364 | feat: create/cluster support for HCP shared VPC
1 parent 803505b commit c470051

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

cmd/create/cluster/cmd.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3294,6 +3294,12 @@ func run(cmd *cobra.Command, _ []string) {
32943294
clusterConfig.SharedVPCRoleArn = sharedVPCRoleARN
32953295
clusterConfig.BaseDomain = baseDomain
32963296
}
3297+
if isHcpSharedVpc {
3298+
clusterConfig.PrivateHostedZoneID = privateHostedZoneID
3299+
clusterConfig.SharedVPCRoleArn = sharedVPCRoleARN
3300+
clusterConfig.InternalCommunicationHostedZoneId = hcpInternalCommunicationHostedZoneId
3301+
clusterConfig.VpcEndpointRoleArn = vpcEndpointRoleArn
3302+
}
32973303
if clusterAutoscaler != nil {
32983304
autoscalerConfig, err := clusterautoscaler.CreateAutoscalerConfig(clusterAutoscaler)
32993305
if err != nil {

pkg/ocm/clusters.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ type Spec struct {
166166
SharedVPCRoleArn string
167167
BaseDomain string
168168

169+
// HCP Shared VPC
170+
VpcEndpointRoleArn string
171+
InternalCommunicationHostedZoneId string
172+
169173
// Worker Machine Pool attributes
170174
AdditionalComputeSecurityGroupIds []string
171175

@@ -1012,6 +1016,13 @@ func (c *Client) createClusterSpec(config Spec) (*cmv1.Cluster, error) {
10121016
awsBuilder = awsBuilder.PrivateHostedZoneID(config.PrivateHostedZoneID)
10131017
awsBuilder = awsBuilder.PrivateHostedZoneRoleARN(config.SharedVPCRoleArn)
10141018
}
1019+
// hcp shared vpc
1020+
if config.VpcEndpointRoleArn != "" {
1021+
awsBuilder = awsBuilder.PrivateHostedZoneID(config.PrivateHostedZoneID)
1022+
awsBuilder = awsBuilder.PrivateHostedZoneRoleARN(config.SharedVPCRoleArn)
1023+
awsBuilder = awsBuilder.VpcEndpointRoleArn(config.VpcEndpointRoleArn)
1024+
awsBuilder = awsBuilder.HcpInternalCommunicationHostedZoneId(config.InternalCommunicationHostedZoneId)
1025+
}
10151026
if config.BaseDomain != "" {
10161027
clusterBuilder = clusterBuilder.DNS(v1.NewDNS().BaseDomain(config.BaseDomain))
10171028
}

0 commit comments

Comments
 (0)