diff --git a/CHANGELOG.md b/CHANGELOG.md index 570ee5fc2..c178f6780 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix api server url in case the CAPI provider sets https prefix in the CAPI CR status. + ## [4.48.0] - 2023-09-19 ### Changed diff --git a/service/key/key.go b/service/key/key.go index 743cbed29..3b1f0781d 100644 --- a/service/key/key.go +++ b/service/key/key.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "math" + "strings" "github.com/giantswarm/k8sclient/v7/pkg/k8sclient" "github.com/giantswarm/microerror" @@ -272,7 +273,8 @@ func APIUrl(obj interface{}) string { case *v1.Service: return "kubernetes.default:443" case *capi.Cluster: - return fmt.Sprintf("%s:%d", v.Spec.ControlPlaneEndpoint.Host, v.Spec.ControlPlaneEndpoint.Port) + // We remove any https:// prefix from the api-server host due to a bug in CAPA Managed EKS clusters (cf. https://gigantic.slack.com/archives/C02HLSDH3DZ/p1695213116360889) + return fmt.Sprintf("%s:%d", strings.TrimPrefix(v.Spec.ControlPlaneEndpoint.Host, "https://"), v.Spec.ControlPlaneEndpoint.Port) case metav1.Object: return fmt.Sprintf("master.%s:443", v.GetName()) }