Skip to content

Commit

Permalink
ServiceEndpoint overrides saved and used correctly for ignition URL (#…
Browse files Browse the repository at this point in the history
…1972)

Signed-off-by: Hiro Miyamoto <miyamotoh@us.ibm.com>
  • Loading branch information
miyamotoh authored Oct 9, 2024
1 parent c78ba01 commit b02f786
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cloud/scope/powervs_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ func NewPowerVSMachineScope(params PowerVSMachineScopeParams) (scope *PowerVSMac

scope.IBMVPCClient = vpcClient
scope.ResourceClient = rc
scope.ServiceEndpoint = params.ServiceEndpoint
return scope, nil
}

Expand Down Expand Up @@ -426,13 +427,19 @@ func (m *PowerVSMachineScope) createIgnitionData(data []byte) (string, error) {
cosServiceEndpoint := endpoints.FetchEndpoints(string(endpoints.COS), m.ServiceEndpoint)
if cosServiceEndpoint != "" {
m.Logger.V(3).Info("Overriding the default COS endpoint in ignition URL", "cosEndpoint", cosServiceEndpoint)
objHost = fmt.Sprintf("%s.%s", bucket, cosServiceEndpoint)
cosURL, _ := url.Parse(cosServiceEndpoint)
if cosURL.Scheme != "" {
objHost = fmt.Sprintf("%s.%s", bucket, cosURL.Host)
} else {
objHost = fmt.Sprintf("%s.%s", bucket, cosServiceEndpoint)
}
}
objectURL := &url.URL{
Scheme: "https",
Host: objHost,
Path: key,
}
m.Logger.V(3).Info("Generated Ignition URL", "objectURL", objectURL.String())

return objectURL.String(), nil
}
Expand Down

0 comments on commit b02f786

Please sign in to comment.