Skip to content

Commit

Permalink
pass region param to connection
Browse files Browse the repository at this point in the history
pass region to update external connection

Signed-off-by: shirady <[email protected]>
  • Loading branch information
shirady committed Aug 14, 2023
1 parent c4143c2 commit e8eeb75
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 26 deletions.
28 changes: 15 additions & 13 deletions pkg/backingstore/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,10 +639,11 @@ func (r *Reconciler) ReadSystemInfo() error {
pool.CloudInfo.Identity != conn.Identity {
r.Logger.Warnf("using existing pool but connection mismatch %+v pool %+v %+v", conn, pool, pool.CloudInfo)
r.UpdateExternalConnectionParams = &nb.UpdateExternalConnectionParams{
Name: conn.Name,
Identity: conn.Identity,
Secret: conn.Secret,
Name: conn.Name,
Identity: conn.Identity,
Secret: conn.Secret,
AzureLogAccessKeys: conn.AzureLogAccessKeys,
Region: conn.Region,
}
}
}
Expand Down Expand Up @@ -820,9 +821,9 @@ func (r *Reconciler) MakeExternalConnectionParams() (*nb.AddExternalConnectionPa

if tenantID != "" && appID != "" && appSecret != "" && logsAnalyticsWorkspaceID != "" {
conn.AzureLogAccessKeys = &nb.AzureLogAccessKeysParams{
AzureTenantID: tenantID,
AzureClientID: appID,
AzureClientSecret: appSecret,
AzureTenantID: tenantID,
AzureClientID: appID,
AzureClientSecret: appSecret,
AzureLogsAnalyticsWorkspaceID: logsAnalyticsWorkspaceID,
}
}
Expand Down Expand Up @@ -883,13 +884,14 @@ func (r *Reconciler) ReconcileExternalConnection() error {
}

checkConnectionParams := &nb.CheckExternalConnectionParams{
Name: r.AddExternalConnectionParams.Name,
EndpointType: r.AddExternalConnectionParams.EndpointType,
Endpoint: r.AddExternalConnectionParams.Endpoint,
Identity: r.AddExternalConnectionParams.Identity,
Secret: r.AddExternalConnectionParams.Secret,
AuthMethod: r.AddExternalConnectionParams.AuthMethod,
AWSSTSARN: r.AddExternalConnectionParams.AWSSTSARN,
Name: r.AddExternalConnectionParams.Name,
EndpointType: r.AddExternalConnectionParams.EndpointType,
Endpoint: r.AddExternalConnectionParams.Endpoint,
Region: r.AddExternalConnectionParams.Region,
Identity: r.AddExternalConnectionParams.Identity,
Secret: r.AddExternalConnectionParams.Secret,
AuthMethod: r.AddExternalConnectionParams.AuthMethod,
AWSSTSARN: r.AddExternalConnectionParams.AWSSTSARN,
AzureLogAccessKeys: r.AddExternalConnectionParams.AzureLogAccessKeys,
}

Expand Down
29 changes: 16 additions & 13 deletions pkg/namespacestore/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,11 @@ func (r *Reconciler) ReadSystemInfo() error {
nsr.Identity != conn.Identity {
r.Logger.Warnf("using existing namespace resource but connection mismatch %+v namespace store %+v", conn, nsr)
r.UpdateExternalConnectionParams = &nb.UpdateExternalConnectionParams{
Name: conn.Name,
Identity: conn.Identity,
Secret: conn.Secret,
Name: conn.Name,
Identity: conn.Identity,
Secret: conn.Secret,
AzureLogAccessKeys: conn.AzureLogAccessKeys,
Region: conn.Region,
}
}
}
Expand Down Expand Up @@ -608,6 +609,7 @@ func (r *Reconciler) MakeExternalConnectionParams() (*nb.AddExternalConnectionPa
}
if awsS3.Region != "" {
u.Host = fmt.Sprintf("s3.%s.amazonaws.com", awsS3.Region)
conn.Region = awsS3.Region
}
conn.Endpoint = u.String()

Expand Down Expand Up @@ -647,9 +649,9 @@ func (r *Reconciler) MakeExternalConnectionParams() (*nb.AddExternalConnectionPa

if tenantID != "" && appID != "" && appSecret != "" && logsAnalyticsWorkspaceID != "" {
conn.AzureLogAccessKeys = &nb.AzureLogAccessKeysParams{
AzureTenantID: tenantID,
AzureClientID: appID,
AzureClientSecret: appSecret,
AzureTenantID: tenantID,
AzureClientID: appID,
AzureClientSecret: appSecret,
AzureLogsAnalyticsWorkspaceID: logsAnalyticsWorkspaceID,
}
}
Expand Down Expand Up @@ -721,14 +723,15 @@ func (r *Reconciler) ReconcileExternalConnection() error {
}

checkConnectionParams := &nb.CheckExternalConnectionParams{
Name: r.AddExternalConnectionParams.Name,
EndpointType: r.AddExternalConnectionParams.EndpointType,
Endpoint: r.AddExternalConnectionParams.Endpoint,
Identity: r.AddExternalConnectionParams.Identity,
Secret: r.AddExternalConnectionParams.Secret,
AuthMethod: r.AddExternalConnectionParams.AuthMethod,
AWSSTSARN: r.AddExternalConnectionParams.AWSSTSARN,
Name: r.AddExternalConnectionParams.Name,
EndpointType: r.AddExternalConnectionParams.EndpointType,
Endpoint: r.AddExternalConnectionParams.Endpoint,
Identity: r.AddExternalConnectionParams.Identity,
Secret: r.AddExternalConnectionParams.Secret,
AuthMethod: r.AddExternalConnectionParams.AuthMethod,
AWSSTSARN: r.AddExternalConnectionParams.AWSSTSARN,
AzureLogAccessKeys: r.AddExternalConnectionParams.AzureLogAccessKeys,
Region: r.AddExternalConnectionParams.Region,
}

if r.UpdateExternalConnectionParams != nil {
Expand Down
2 changes: 2 additions & 0 deletions pkg/nb/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ type CheckExternalConnectionParams struct {
AWSSTSARN string `json:"aws_sts_arn,omitempty"`
IgnoreNameAlreadyExist bool `json:"ignore_name_already_exist,omitempty"`
AzureLogAccessKeys *AzureLogAccessKeysParams `json:"azure_log_access_keys,omitempty"`
Region string `json:"region,omitempty"`
}

// CheckExternalConnectionReply is the reply of account_api.check_external_connection()
Expand All @@ -720,6 +721,7 @@ type UpdateExternalConnectionParams struct {
Identity string `json:"identity"`
Secret string `json:"secret"`
AzureLogAccessKeys *AzureLogAccessKeysParams `json:"azure_log_access_keys,omitempty"`
Region string `json:"region,omitempty"`
}

// DeleteExternalConnectionParams is the params of account_api.delete_external_connection()
Expand Down

0 comments on commit e8eeb75

Please sign in to comment.