Skip to content
Open
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
24 changes: 16 additions & 8 deletions app/deployer/connector/astra_connect_natless.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func (d *AstraConnectDeployer) GetDeploymentObjects(m *v1.AstraConnector, ctx co
var imageRegistry string
var containerImage string
var connectorImage string
var clusterId string
var cloudId string
if m.Spec.ImageRegistry.Name != "" {
imageRegistry = m.Spec.ImageRegistry.Name
} else {
Expand All @@ -52,15 +54,21 @@ func (d *AstraConnectDeployer) GetDeploymentObjects(m *v1.AstraConnector, ctx co
containerImage = common.ConnectorImageTag
}

connectorImage = fmt.Sprintf("%s/astra-connector:%s", imageRegistry, containerImage)
log.Info("Using AstraConnector image", "image", connectorImage)
if m.Spec.Astra.CloudId != "" {
cloudId = m.Spec.Astra.CloudId
} else {
cloudId = m.Status.CloudId
}

if m.Spec.Astra.ClusterId == "" && m.Spec.Astra.ClusterName == "" {
err := fmt.Errorf("clusterID and clusterName both cannot be empty")
log.Error(err, "Bad config")
return nil, nil, err
if m.Spec.Astra.ClusterId != "" {
clusterId = m.Spec.Astra.ClusterId
} else {
clusterId = m.Status.ClusterId
}

connectorImage = fmt.Sprintf("%s/astra-connector:%s", imageRegistry, containerImage)
log.Info("Using AstraConnector image", "image", connectorImage)

dep := &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: common.AstraConnectName,
Expand Down Expand Up @@ -106,11 +114,11 @@ func (d *AstraConnectDeployer) GetDeploymentObjects(m *v1.AstraConnector, ctx co
},
{
Name: "CLOUD_ID",
Value: m.Spec.Astra.CloudId,
Value: cloudId,
},
{
Name: "CLUSTER_ID",
Value: m.Spec.Astra.ClusterId,
Value: clusterId,
},
{
Name: "HOST_ALIAS_IP",
Expand Down
6 changes: 3 additions & 3 deletions app/deployer/connector/astra_connect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ func TestAstraConnect_ClusterIDAndNameEmpty(t *testing.T) {
}

objects, f, err := deployer.GetDeploymentObjects(astraConnector, ctx)
assert.Error(t, err)
assert.Nil(t, objects)
assert.Nil(t, f)
assert.NoError(t, err)
assert.NotNil(t, objects)
assert.NotNil(t, f)
}

func DummyAstraConnector() v1.AstraConnector {
Expand Down
Loading