Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion pkg/cloud/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,34 @@ func NewProvider(info *provider.Info) (*awsProvider, error) {
return nil, err
}

cloudPrepare := cpaws.NewCloud(awsClient, info.InfraID, info.Region)
var cloudOptions []cpaws.CloudOption

if info.SubmarinerConfigAnnotations != nil {
annotations := info.SubmarinerConfigAnnotations

if vpcID, exists := annotations["submariner.io/vpc-id"]; exists {
cloudOptions = append(cloudOptions, cpaws.WithVPCName(vpcID))
}

if subnetIDList, exists := annotations["submariner.io/subnet-id-list"]; exists {
subnetIDs := strings.Split(subnetIDList, ",")
for i := range subnetIDs {
subnetIDs[i] = strings.TrimSpace(subnetIDs[i])
}

cloudOptions = append(cloudOptions, cpaws.WithPublicSubnetList(subnetIDs))
}

if controlPlaneSGID, exists := annotations["submariner.io/control-plane-sg-id"]; exists {
cloudOptions = append(cloudOptions, cpaws.WithControlPlaneSecurityGroup(controlPlaneSGID))
}

if workerSGID, exists := annotations["submariner.io/worker-sg-id"]; exists {
cloudOptions = append(cloudOptions, cpaws.WithWorkerSecurityGroup(workerSGID))
}
}

cloudPrepare := cpaws.NewCloud(awsClient, info.InfraID, info.Region, cloudOptions...)

machineSetDeployer := ocp.NewK8sMachinesetDeployer(info.RestMapper, info.DynamicClient)
gwDeployer, err := cpaws.NewOcpGatewayDeployer(cloudPrepare, machineSetDeployer, instanceType)
Expand Down
2 changes: 2 additions & 0 deletions pkg/cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ func (f *providerFactory) Get(config *configv1alpha1.SubmarinerConfig, eventsRec
return nil, true, err
}

info.SubmarinerConfigAnnotations = config.Annotations

instance, err := providerFn(info)

return instance, true, err
Expand Down
1 change: 1 addition & 0 deletions pkg/cloud/provider/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ type Info struct {
CredentialsSecret *corev1.Secret
configv1alpha1.SubmarinerConfigSpec
configv1alpha1.ManagedClusterInfo
SubmarinerConfigAnnotations map[string]string
}