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 +}