Conversation
📝 WalkthroughWalkthroughA refactoring that extracts endpoint derivation logic from the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
cmd/ctrlc/root/sync/azure/aks/aks.go (1)
384-406: Port detection logic is fragile.The check
!strings.Contains(endpoint, ":443")would produce an invalid URL if the endpoint already contains a different port (e.g.,https://example.com:8443would becomehttps://example.com:8443:443).While AKS API servers typically use port 443, a more robust approach would parse the URL to check for any existing port:
♻️ Suggested improvement using URL parsing
+import "net/url" + func getEndpoint(cluster *armcontainerservice.ManagedCluster) string { endpoint := "" if cluster.Properties.PrivateFQDN != nil { endpoint = *cluster.Properties.PrivateFQDN } else if cluster.Properties.Fqdn != nil { endpoint = *cluster.Properties.Fqdn } if endpoint == "" { return "" } if !strings.HasPrefix(endpoint, "http://") && !strings.HasPrefix(endpoint, "https://") { endpoint = fmt.Sprintf("https://%s", endpoint) } // AKS kubeconfig includes :443, and ArgoCD uses the exact server URL as identifier - if !strings.Contains(endpoint, ":443") { - endpoint = fmt.Sprintf("%s:443", endpoint) + u, err := url.Parse(endpoint) + if err != nil { + return endpoint + } + if u.Port() == "" { + u.Host = u.Host + ":443" } - return endpoint + return u.String() }
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
cmd/ctrlc/root/sync/azure/aks/aks.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: docker (linux/amd64)
🔇 Additional comments (1)
cmd/ctrlc/root/sync/azure/aks/aks.go (1)
234-237: LGTM - Endpoint extraction centralized.The refactoring to use
getEndpoint(cluster)here correctly centralizes the endpoint derivation logic, ensuring consistency with the metadata at line 287.
This fixes the azure endpoint to reflect what is returned by
kubectl cluster-info.Summary by CodeRabbit
Bug Fixes
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.