From 0ec18596d7602ebe6e623efb4edfbbf4fc289d1e Mon Sep 17 00:00:00 2001 From: Tom Gehrke Date: Tue, 24 Sep 2024 09:27:43 +0200 Subject: [PATCH] inject client into actuator config --- pkg/controller/lifecycle/actuator.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/controller/lifecycle/actuator.go b/pkg/controller/lifecycle/actuator.go index 6b204c79..7d82b7d3 100644 --- a/pkg/controller/lifecycle/actuator.go +++ b/pkg/controller/lifecycle/actuator.go @@ -11,6 +11,7 @@ import ( "github.com/gardener/gardener/extensions/pkg/controller/extension" extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1" + gardenclient "github.com/gardener/gardener/pkg/client/kubernetes" "github.com/gardener/gardener/pkg/extensions" "github.com/liquid-reply/gardener-extension-shoot-kubecost/pkg/constants" @@ -105,3 +106,14 @@ func getKubeCostApiKey(secretData map[string][]byte) (string, error) { func createShootResourceKubeCostInstall(apiKey string) (map[string][]byte, error) { return nil, nil } + +func (a *actuator) InjectClient(client client.Client) error { + a.client = client + clientInterface, err := gardenclient.NewClientFromSecret(context.Background(), a.client, "garden", "gardenlet-kubeconfig") + if err != nil { + return err + } + clientInterface.Start(context.Background()) + a.clientGardenlet = clientInterface.Client() + return nil +}