From 330a7947fd7ba2918dc357b9fa64f094cd1f26ad Mon Sep 17 00:00:00 2001 From: Pierre Prinetti Date: Sat, 6 Apr 2024 15:28:51 +0200 Subject: [PATCH] clusterapi: Add worker asset to PreProvision This is needed by OpenStack to provision the server group for workers in the CAPI flow, based on the manifests potentially modified by the user. --- pkg/asset/cluster/cluster.go | 1 + pkg/infrastructure/clusterapi/clusterapi.go | 3 +++ pkg/infrastructure/clusterapi/types.go | 2 ++ 3 files changed, 6 insertions(+) diff --git a/pkg/asset/cluster/cluster.go b/pkg/asset/cluster/cluster.go index a04c8804bdf..dbdb8e40500 100644 --- a/pkg/asset/cluster/cluster.go +++ b/pkg/asset/cluster/cluster.go @@ -70,6 +70,7 @@ func (c *Cluster) Dependencies() []asset.Asset { &kubeconfig.AdminClient{}, &bootstrap.Bootstrap{}, &machine.Master{}, + &machines.Worker{}, &machines.ClusterAPI{}, new(rhcos.Image), &manifests.Manifests{}, diff --git a/pkg/infrastructure/clusterapi/clusterapi.go b/pkg/infrastructure/clusterapi/clusterapi.go index 700737e96d1..bf4da84dc09 100644 --- a/pkg/infrastructure/clusterapi/clusterapi.go +++ b/pkg/infrastructure/clusterapi/clusterapi.go @@ -58,6 +58,7 @@ func InitializeProvider(platform Provider) infrastructure.Provider { //nolint:gocyclo func (i *InfraProvider) Provision(dir string, parents asset.Parents) ([]*asset.File, error) { manifestsAsset := &manifests.Manifests{} + workersAsset := &machines.Worker{} capiManifestsAsset := &capimanifests.Cluster{} capiMachinesAsset := &machines.ClusterAPI{} clusterKubeconfigAsset := &kubeconfig.AdminClient{} @@ -68,6 +69,7 @@ func (i *InfraProvider) Provision(dir string, parents asset.Parents) ([]*asset.F masterIgnAsset := &machine.Master{} parents.Get( manifestsAsset, + workersAsset, capiManifestsAsset, clusterKubeconfigAsset, clusterID, @@ -110,6 +112,7 @@ func (i *InfraProvider) Provision(dir string, parents asset.Parents) ([]*asset.F RhcosImage: rhcosImage, ManifestsAsset: manifestsAsset, MachineManifests: machineManifests, + WorkersAsset: workersAsset, } if err := p.PreProvision(ctx, preProvisionInput); err != nil { diff --git a/pkg/infrastructure/clusterapi/types.go b/pkg/infrastructure/clusterapi/types.go index 35150307dec..237bb9d829c 100644 --- a/pkg/infrastructure/clusterapi/types.go +++ b/pkg/infrastructure/clusterapi/types.go @@ -6,6 +6,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/openshift/installer/pkg/asset/installconfig" + "github.com/openshift/installer/pkg/asset/machines" "github.com/openshift/installer/pkg/asset/manifests" "github.com/openshift/installer/pkg/asset/rhcos" ) @@ -33,6 +34,7 @@ type PreProvisionInput struct { RhcosImage *rhcos.Image ManifestsAsset *manifests.Manifests MachineManifests []client.Object + WorkersAsset *machines.Worker } // IgnitionProvider handles preconditions for bootstrap ignition and