From 9f051e465a19d9e81083a7138e009af69b9f9984 Mon Sep 17 00:00:00 2001 From: Kostiantyn Kalynovskyi Date: Tue, 9 Feb 2021 18:18:45 +0000 Subject: [PATCH] Integrate clusterctl client into phases This will make sure that phases have access to kubeconfgs generated by cluster-api for the managed clusters. Change-Id: Iabecced78192969d7a2ee5a48e75fc3adb0af092 --- pkg/phase/client.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/phase/client.go b/pkg/phase/client.go index 14820816b..d96a37b3a 100644 --- a/pkg/phase/client.go +++ b/pkg/phase/client.go @@ -22,6 +22,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" "opendev.org/airship/airshipctl/pkg/api/v1alpha1" + cctlclient "opendev.org/airship/airshipctl/pkg/clusterctl/client" "opendev.org/airship/airshipctl/pkg/document" "opendev.org/airship/airshipctl/pkg/events" "opendev.org/airship/airshipctl/pkg/k8s/kubeconfig" @@ -89,12 +90,22 @@ func (p *phase) Executor() (ifc.Executor, error) { if err != nil { return nil, err } + + cctlClient, err := cctlclient.NewClient( + p.helper.PhaseBundleRoot(), + log.DebugEnabled(), + v1alpha1.DefaultClusterctl()) + if err != nil { + return nil, err + } + kubeconf := kubeconfig.NewBuilder(). WithBundle(p.helper.PhaseBundleRoot()). WithClusterMap(cMap). WithClusterName(p.apiObj.ClusterName). WithPath(p.kubeconfig). WithTempRoot(wd). + WithClusterctClient(cctlClient). Build() return executorFactory(