Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
Use in-cluster shoot API-server urls for health-checks
Browse files Browse the repository at this point in the history
  • Loading branch information
zanetworker committed Feb 19, 2020
1 parent 34828bf commit 9814705
Show file tree
Hide file tree
Showing 15 changed files with 177 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.13
require (
github.com/Masterminds/semver v1.4.2
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
github.com/gardener/gardener v1.0.1
github.com/gardener/gardener v1.0.1-0.20200213093126-7a6123b6ae21
github.com/gardener/gardener-resource-manager v0.10.0
github.com/gardener/machine-controller-manager v0.25.1-0.20200115123605-0510de7ddfca // master
github.com/go-logr/logr v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ github.com/gardener/controller-manager-library v0.1.1-0.20191212112146-917449ad7
github.com/gardener/controller-manager-library v0.1.1-0.20191212112146-917449ad760c/go.mod h1:v6cbldxmpL2fYBEB2lSnq3LSEPwIHus9En6iIhwNE1k=
github.com/gardener/external-dns-management v0.7.3 h1:SAW9ur2mjZ+x89xbmcplJgqNUmFGYIZLI2E+PaBhhG0=
github.com/gardener/external-dns-management v0.7.3/go.mod h1:Y3om11E865x4aQ7cmcHjknb8RMgCO153huRb/SvP+9o=
github.com/gardener/gardener v1.0.1 h1:ta6JH/dg2RS0ffZtLm9zOSneMeUC1wEmSaSpVKJBhkQ=
github.com/gardener/gardener v1.0.1/go.mod h1:CP9I0tCDVXTLPkJv/jUtXVUh948kSNKEGUg0haLz9gk=
github.com/gardener/gardener v1.0.1-0.20200213093126-7a6123b6ae21 h1:RuGhuc4SdfS6q20u2slVPofigoto36i1b5LHRKTkqgo=
github.com/gardener/gardener v1.0.1-0.20200213093126-7a6123b6ae21/go.mod h1:CP9I0tCDVXTLPkJv/jUtXVUh948kSNKEGUg0haLz9gk=
github.com/gardener/gardener-resource-manager v0.10.0 h1:6OUKoWI3oha42F0oJN8OEo3UR+D3onOCel4Th+zgotU=
github.com/gardener/gardener-resource-manager v0.10.0/go.mod h1:0pKTHOhvU91eQB0EYr/6Ymd7lXc/5Hi8P8tF/gpV0VQ=
github.com/gardener/hvpa-controller v0.0.0-20191014062307-fad3bdf06a25 h1:nOFITmV7vt4fcYPEXgj66Qs83FdDEMvL/LQcR0diRRE=
Expand Down
14 changes: 12 additions & 2 deletions pkg/util/shoot_clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package util
import (
"context"

apierrors "k8s.io/apimachinery/pkg/api/errors"

v1beta1constants "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants"
"github.com/gardener/gardener/pkg/chartrenderer"
gardener "github.com/gardener/gardener/pkg/client/kubernetes"
Expand Down Expand Up @@ -68,10 +70,18 @@ func NewShootClients(c client.Client, clientset kubernetes.Interface, gardenerCl

// NewClientForShoot returns the rest config and the client for the given shoot namespace.
func NewClientForShoot(ctx context.Context, c client.Client, namespace string, opts client.Options) (*rest.Config, client.Client, error) {
gardenerSecret := &corev1.Secret{}
if err := c.Get(ctx, kutil.Key(namespace, v1beta1constants.SecretNameGardener), gardenerSecret); err != nil {
var (
gardenerSecret = &corev1.Secret{}
err error
)

if err = c.Get(ctx, kutil.Key(namespace, v1beta1constants.SecretNameGardenerInternal), gardenerSecret); err != nil && apierrors.IsNotFound(err) {
err = c.Get(ctx, kutil.Key(namespace, v1beta1constants.SecretNameGardener), gardenerSecret)
}
if err != nil {
return nil, nil, err
}

shootRESTConfig, err := NewRESTConfigFromKubeconfig(gardenerSecret.Data[secrets.DataKeyKubeconfig])
if err != nil {
return nil, nil, err
Expand Down
12 changes: 10 additions & 2 deletions vendor/github.com/gardener/gardener/pkg/apis/core/types_shoot.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9814705

Please sign in to comment.