Skip to content

Commit 2f938a3

Browse files
authored
Only print API Gateway url in cluster info if enabled (#1290)
1 parent 0418225 commit 2f938a3

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

cli/cmd/cluster.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ var _upCmd = &cobra.Command{
160160
}
161161
}
162162

163-
out, exitCode, err := runManagerUpdateCommand("/root/install.sh", clusterConfig, awsCreds, _flagClusterEnv)
163+
out, exitCode, err := runManagerWithClusterConfig("/root/install.sh", clusterConfig, awsCreds, _flagClusterEnv)
164164
if err != nil {
165165
if clusterConfig.APIGatewaySetting == clusterconfig.EnabledAPIGatewaySetting {
166166
awsClient.DeleteAPIGatewayByTag(clusterconfig.ClusterNameTag, clusterConfig.ClusterName) // best effort deletion
@@ -234,7 +234,7 @@ var _configureCmd = &cobra.Command{
234234
exit.Error(err)
235235
}
236236

237-
out, exitCode, err := runManagerUpdateCommand("/root/install.sh --update", clusterConfig, awsCreds, _flagClusterEnv)
237+
out, exitCode, err := runManagerWithClusterConfig("/root/install.sh --update", clusterConfig, awsCreds, _flagClusterEnv)
238238
if err != nil {
239239
exit.Error(err)
240240
}
@@ -438,7 +438,7 @@ func cmdInfo(awsCreds AWSCredentials, accessConfig *clusterconfig.AccessConfig,
438438

439439
clusterConfig := refreshCachedClusterConfig(awsCreds, accessConfig, disallowPrompt)
440440

441-
out, exitCode, err := runManagerAccessCommand("/root/info.sh", *accessConfig, awsCreds, _flagClusterEnv)
441+
out, exitCode, err := runManagerWithClusterConfig("/root/info.sh", &clusterConfig, awsCreds, _flagClusterEnv)
442442
if err != nil {
443443
exit.Error(err)
444444
}

cli/cmd/lib_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func runManager(containerConfig *container.Config, addNewLineAfterPull bool) (st
137137
return output, &info.State.ExitCode, nil
138138
}
139139

140-
func runManagerUpdateCommand(entrypoint string, clusterConfig *clusterconfig.Config, awsCreds AWSCredentials, envName string) (string, *int, error) {
140+
func runManagerWithClusterConfig(entrypoint string, clusterConfig *clusterconfig.Config, awsCreds AWSCredentials, envName string) (string, *int, error) {
141141
clusterConfigBytes, err := yaml.Marshal(clusterConfig)
142142
if err != nil {
143143
return "", nil, errors.WithStack(err)

manager/info.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ eksctl utils write-kubeconfig --cluster=$CORTEX_CLUSTER_NAME --region=$CORTEX_RE
3737

3838
operator_endpoint=$(get_operator_endpoint)
3939
api_load_balancer_endpoint=$(get_api_load_balancer_endpoint)
40-
api_gateway_endpoint=$(get_api_gateway_endpoint)
40+
if [ "$CORTEX_API_GATEWAY" == "enabled" ]; then
41+
api_gateway_endpoint=$(get_api_gateway_endpoint)
42+
fi
4143

4244
echo -e "\033[1mendpoints:\033[0m"
4345
echo "operator: $operator_endpoint" # before modifying this, search for this prefix
4446
echo "api load balancer: $api_load_balancer_endpoint"
45-
echo "api gateway: $api_gateway_endpoint"
47+
if [ "$CORTEX_API_GATEWAY" == "enabled" ]; then
48+
echo "api gateway: $api_gateway_endpoint"
49+
fi

0 commit comments

Comments
 (0)