Skip to content

[Bug-Fix] Invalid gcloud get-credentials argument order may break GKE kubeconfig setup - #265

Open
ChiragSW wants to merge 1 commit into
keras-team:mainfrom
ChiragSW:issue#264
Open

[Bug-Fix] Invalid gcloud get-credentials argument order may break GKE kubeconfig setup#265
ChiragSW wants to merge 1 commit into
keras-team:mainfrom
ChiragSW:issue#264

Conversation

@ChiragSW

@ChiragSW ChiragSW commented Jun 11, 2026

Copy link
Copy Markdown

Description

Fixes: #264
Made the small args order fix in both calls and updated the tests that were locking in the delimiter. Removed the delimeter from the command order.
I still cannot setup the cloud setup as there are more issues I am currently facing. Will update with it after a successful setup.

Contributor Agreement

Please check all boxes below before submitting your PR for review:

  • I am a human, and not a bot.
  • I will be responsible for responding to review comments in a timely manner.
  • I will work with the maintainers to push this PR forward until submission.
  • I will test the changes on my cloud setup and provide proof of successful validation.

Note: Failing to adhere to this agreement may result in your future PRs no longer being reviewed.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the unnecessary "--" delimiter from the "gcloud container clusters get-credentials" command in both "post_deploy.py" and "credentials.py", updating the corresponding unit tests to match. The review feedback suggests simplifying the tests by asserting the exact list of command arguments directly rather than manually checking indices and relative order, which improves readability and robustness.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +17 to +22
self.assertNotIn("--", args)
idx_get = args.index("get-credentials")
idx_delim = args.index("--")
idx_cluster = args.index("my-cluster")
self.assertLess(idx_get, idx_delim)
self.assertLess(idx_delim, idx_cluster)
self.assertEqual(idx_cluster, idx_get + 1)
self.assertGreater(args.index("--zone=us-central1-a"), idx_cluster)
self.assertGreater(args.index("--project=my-proj"), idx_cluster)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Instead of manually finding indices and asserting their relative order, you can assert the exact list of arguments directly. This is much more readable, concise, and robustly verifies the entire command structure.

Suggested change
self.assertNotIn("--", args)
idx_get = args.index("get-credentials")
idx_delim = args.index("--")
idx_cluster = args.index("my-cluster")
self.assertLess(idx_get, idx_delim)
self.assertLess(idx_delim, idx_cluster)
self.assertEqual(idx_cluster, idx_get + 1)
self.assertGreater(args.index("--zone=us-central1-a"), idx_cluster)
self.assertGreater(args.index("--project=my-proj"), idx_cluster)
self.assertEqual(
args,
[
"gcloud",
"container",
"clusters",
"get-credentials",
"my-cluster",
"--zone=us-central1-a",
"--project=my-proj",
],
)

Comment on lines +241 to +246
self.assertNotIn("--", args)
idx_get = args.index("get-credentials")
idx_delim = args.index("--")
idx_cluster = args.index("my-cluster")
self.assertLess(idx_get, idx_delim)
self.assertLess(idx_delim, idx_cluster)
self.assertEqual(idx_cluster, idx_get + 1)
self.assertGreater(args.index("--zone=us-central1-a"), idx_cluster)
self.assertGreater(args.index("--project=my-proj"), idx_cluster)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Instead of manually finding indices and asserting their relative order, you can assert the exact list of arguments directly. This is much more readable, concise, and robustly verifies the entire command structure.

Suggested change
self.assertNotIn("--", args)
idx_get = args.index("get-credentials")
idx_delim = args.index("--")
idx_cluster = args.index("my-cluster")
self.assertLess(idx_get, idx_delim)
self.assertLess(idx_delim, idx_cluster)
self.assertEqual(idx_cluster, idx_get + 1)
self.assertGreater(args.index("--zone=us-central1-a"), idx_cluster)
self.assertGreater(args.index("--project=my-proj"), idx_cluster)
self.assertEqual(
args,
[
"gcloud",
"container",
"clusters",
"get-credentials",
"my-cluster",
"--zone=us-central1-a",
"--project=my-proj",
],
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Critical issue] Invalid gcloud get-credentials argument order may break GKE kubeconfig setup

1 participant