Skip to content

Commit 345e4e5

Browse files
authored
fix: revert "feat: add option to use connect gateway (#155)" (#164)
1 parent 65106af commit 345e4e5

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

modules/kubectl-wrapper/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ module "kubectl" {
4040
| service\_account\_key\_file | Path to service account key file to auth as for running `gcloud container clusters get-credentials`. | `string` | `""` | no |
4141
| skip\_download | Whether to skip downloading gcloud (assumes gcloud and kubectl is already available outside the module) | `bool` | `true` | no |
4242
| upgrade | Whether to upgrade gcloud at runtime | `bool` | `true` | no |
43-
| use\_connect\_gateway | Use Connect Gateway to obtain credentials. The provided cluster\_name will be used as the fleet membership name. | `bool` | `false` | no |
4443
| use\_existing\_context | Use existing kubecontext to auth kube-api. | `bool` | `false` | no |
4544
| use\_tf\_google\_credentials\_env\_var | Use `GOOGLE_CREDENTIALS` environment variable to run `gcloud auth activate-service-account` with. Optional. | `bool` | `false` | no |
4645

modules/kubectl-wrapper/main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2020-2023 Google LLC
2+
* Copyright 2020 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,8 +15,7 @@
1515
*/
1616

1717
locals {
18-
connect_cmd = var.use_connect_gateway ? "fleet memberships" : "clusters"
19-
base_cmd = "${var.cluster_name} ${var.cluster_location} ${var.project_id} ${var.internal_ip} ${var.use_existing_context} ${local.connect_cmd}"
18+
base_cmd = "${var.cluster_name} ${var.cluster_location} ${var.project_id} ${var.internal_ip} ${var.use_existing_context}"
2019
}
2120

2221
module "gcloud_kubectl" {

modules/kubectl-wrapper/scripts/kubectl_wrapper.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Copyright 2020-2023 Google LLC
2+
# Copyright 2020 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616

1717
set -xeo pipefail
1818

19-
if [ "$#" -lt 6 ]; then
19+
if [ "$#" -lt 5 ]; then
2020
>&2 echo "Not all expected arguments set."
2121
exit 1
2222
fi
@@ -26,11 +26,10 @@ LOCATION=$2
2626
PROJECT_ID=$3
2727
INTERNAL=$4
2828
USE_EXISTING_CONTEXT=$5
29-
CONNECT_CMD=$6
30-
ENABLE_IMPERSONATE_SERVICE_ACCOUNT=$7
31-
IMPERSONATE_SERVICE_ACCOUNT=$8
29+
ENABLE_IMPERSONATE_SERVICE_ACCOUNT=$6
30+
IMPERSONATE_SERVICE_ACCOUNT=$7
3231

33-
shift 6
32+
shift 5
3433

3534
if $USE_EXISTING_CONTEXT ;then
3635

@@ -52,7 +51,7 @@ else
5251

5352
LOCATION_TYPE=$(grep -o "-" <<< "${LOCATION}" | wc -l)
5453

55-
CMD="gcloud container ${CONNECT_CMD} get-credentials ${CLUSTER_NAME} --project ${PROJECT_ID}"
54+
CMD="gcloud container clusters get-credentials ${CLUSTER_NAME} --project ${PROJECT_ID}"
5655
if [[ "${ENABLE_IMPERSONATE_SERVICE_ACCOUNT}" == true ]]; then
5756
CMD+=" --impersonate-service-account ${IMPERSONATE_SERVICE_ACCOUNT}"
5857
shift 2

modules/kubectl-wrapper/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,3 @@ variable "impersonate_service_account" {
113113
description = "An optional service account to impersonate for gcloud commands. If this service account is not specified, the module will use Application Default Credentials."
114114
default = ""
115115
}
116-
117-
variable "use_connect_gateway" {
118-
type = bool
119-
description = "Use Connect Gateway to obtain credentials. The provided cluster_name will be used as the fleet membership name."
120-
default = false
121-
}

0 commit comments

Comments
 (0)