-
Notifications
You must be signed in to change notification settings - Fork 1
Add AKS and EKS cluster support #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,8 @@ import ( | |
| "golang.org/x/term" | ||
| ) | ||
|
|
||
| const infraAWSAccountID = "051999192406" | ||
|
|
||
| var ( | ||
| RunningInRoxieContainer bool | ||
| RunningInteractively bool | ||
|
|
@@ -73,7 +75,7 @@ func ensureInitialized(log *logger.Logger) error { | |
| if err != nil { | ||
| return err | ||
| } | ||
| currentClusterType = DetectClusterType(kubeConfig, apiResources) | ||
| currentClusterType = DetectClusterType(log, kubeConfig, apiResources) | ||
| initialized = true | ||
| } | ||
| return nil | ||
|
|
@@ -136,7 +138,13 @@ func Initialize(log *logger.Logger) error { | |
|
|
||
| // DetectClusterType implements the cluster type detection logic | ||
| // This function is pure and testable - it doesn't invoke kubectl itself | ||
| func DetectClusterType(config KubeConfig, apiResources []string) types.ClusterType { | ||
| func DetectClusterType(log *logger.Logger, config KubeConfig, apiResources []string) types.ClusterType { | ||
| serverURL := getServerURL(config) | ||
| parsedURL, err := url.Parse(serverURL) | ||
| if err != nil && log != nil { | ||
| log.Warningf("Failed to parse cluster server URL %q: %v", serverURL, err) | ||
| } | ||
|
|
||
| if config.CurrentContext == "" { | ||
| return types.ClusterTypeUnknown | ||
| } | ||
|
|
@@ -151,6 +159,22 @@ func DetectClusterType(config KubeConfig, apiResources []string) types.ClusterTy | |
| return types.ClusterTypeGKE | ||
| } | ||
|
|
||
| // AKS clusters have server hostnames ending in .azmk8s.io | ||
| if parsedURL != nil && strings.HasSuffix(parsedURL.Hostname(), ".azmk8s.io") { | ||
| if strings.Contains(parsedURL.Hostname(), "srox-temp-dev") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extract |
||
| return types.ClusterTypeInfraAKS | ||
| } | ||
| return types.ClusterTypeAKS | ||
| } | ||
|
|
||
| // EKS clusters have server hostnames ending in .eks.amazonaws.com | ||
| if parsedURL != nil && strings.HasSuffix(parsedURL.Hostname(), ".eks.amazonaws.com") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Recognize EKS dual-stack cluster endpoints. EKS IPv6 clusters created after October 2024 use Kubernetes API endpoints ending in With a standard EKS ARN context and ordinary Kubernetes API resources, detection then returns Extend detection to the documented EKS endpoint formats. Use an EKS-specific signal for 🤖 Prompt for AI Agents |
||
| if strings.Contains(config.CurrentContext, ":"+infraAWSAccountID+":") { | ||
| return types.ClusterTypeInfraEKS | ||
| } | ||
| return types.ClusterTypeEKS | ||
| } | ||
|
|
||
| // Minikube clusters typically have context name "minikube". | ||
| if contextLower == "minikube" || strings.HasPrefix(contextLower, "minikube-") { | ||
| return types.ClusterTypeMinikube | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we notice if this changes? 😟
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I'm not sure if account IDs are not considered confidential. I'm not seeing this in the logs for this old run, which suggests that either this ID is wrong, or it's redacted (in which case we probably shouldn't be publishing it here either).