Skip to content

refactor(k8s/cluster): extract common provider utilities#14

Open
rafeegnash wants to merge 1 commit intok8-gcp-supportfrom
issue-74-common-provider-utilities
Open

refactor(k8s/cluster): extract common provider utilities#14
rafeegnash wants to merge 1 commit intok8-gcp-supportfrom
issue-74-common-provider-utilities

Conversation

@rafeegnash
Copy link
Copy Markdown

Summary

  • Extracts duplicated getNodesViaKubectl logic into shared utility
  • Reduces code duplication between EKS and GKE providers by 136 lines
  • Adds helper functions for node readiness checking

New Shared Utilities

Function Description
GetNodesViaKubectl Retrieves node info using kubectl
CountReadyNodes Counts ready nodes in a list
AllNodesReady Checks if all nodes are ready

Files Changed

  • common.go: New shared utilities file
  • common_test.go: Tests for shared utilities
  • eks.go: Delegates to shared GetNodesViaKubectl
  • gke.go: Delegates to shared GetNodesViaKubectl

Test Plan

  • Build passes
  • All cluster tests pass
  • New utility function tests pass

Closes bgdnvk#74

Extract duplicated getNodesViaKubectl logic into a shared utility
function in common.go. This reduces code duplication between EKS and
GKE providers by 136 lines.

New shared utilities:
- GetNodesViaKubectl: Retrieves node info using kubectl
- CountReadyNodes: Counts ready nodes in a list
- AllNodesReady: Checks if all nodes are ready

Both EKS and GKE providers now delegate to the shared implementation.
Adds comprehensive tests for the new utility functions.

Refs bgdnvk#74

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant