Skip to content

Commit 4c519fe

Browse files
Merge pull request #8306 from r4f4/capi-aws-custom-endpoints
CORS-3470: capi/aws: add custom endpoint support.
2 parents 6c65de6 + 394893e commit 4c519fe

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

pkg/clusterapi/system.go

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,27 @@ func (c *system) Run(ctx context.Context, installConfig *installconfig.InstallCo
125125
// Only add the controllers for the platform we are deploying to.
126126
switch platform := installConfig.Config.Platform.Name(); platform {
127127
case aws.Name:
128-
controllers = append(controllers,
129-
c.getInfrastructureController(
130-
&AWS,
131-
[]string{
132-
"-v=4",
133-
"--diagnostics-address=0",
134-
"--health-addr={{suggestHealthHostPort}}",
135-
"--webhook-port={{.WebhookPort}}",
136-
"--webhook-cert-dir={{.WebhookCertDir}}",
137-
"--feature-gates=BootstrapFormatIgnition=true,ExternalResourceGC=true",
138-
},
139-
map[string]string{},
140-
),
128+
controller := c.getInfrastructureController(
129+
&AWS,
130+
[]string{
131+
"-v=4",
132+
"--diagnostics-address=0",
133+
"--health-addr={{suggestHealthHostPort}}",
134+
"--webhook-port={{.WebhookPort}}",
135+
"--webhook-cert-dir={{.WebhookCertDir}}",
136+
"--feature-gates=BootstrapFormatIgnition=true,ExternalResourceGC=true",
137+
},
138+
map[string]string{},
141139
)
140+
if cfg := installConfig.Config.AWS; cfg != nil && len(cfg.ServiceEndpoints) > 0 {
141+
endpoints := make([]string, 0, len(cfg.ServiceEndpoints))
142+
// CAPA expects name=url pairs of service endpoints
143+
for _, endpoint := range cfg.ServiceEndpoints {
144+
endpoints = append(endpoints, fmt.Sprintf("%s=%s", endpoint.Name, endpoint.URL))
145+
}
146+
controller.Args = append(controller.Args, fmt.Sprintf("--service-endpoints=%s:%s", cfg.Region, strings.Join(endpoints, ",")))
147+
}
148+
controllers = append(controllers, controller)
142149
case azure.Name:
143150
session, err := installConfig.Azure.Session()
144151
if err != nil {

0 commit comments

Comments
 (0)