Skip to content

Commit

Permalink
Fix API Server url for Managed EKS (#1375)
Browse files Browse the repository at this point in the history
Signed-off-by: QuentinBisson <[email protected]>
  • Loading branch information
QuentinBisson authored Sep 20, 2023
1 parent 75f55c2 commit 36bc06c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion service/key/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"math"
"strings"

"github.com/giantswarm/k8sclient/v7/pkg/k8sclient"
"github.com/giantswarm/microerror"
Expand Down Expand Up @@ -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())
}
Expand Down

0 comments on commit 36bc06c

Please sign in to comment.