@@ -24,11 +24,11 @@ import (
2424 "github.com/openshift/installer/pkg/asset/installconfig"
2525 assetstore "github.com/openshift/installer/pkg/asset/store"
2626 "github.com/openshift/installer/pkg/asset/tls"
27+ "github.com/openshift/installer/pkg/clusterapi"
2728 serialgather "github.com/openshift/installer/pkg/gather"
2829 "github.com/openshift/installer/pkg/gather/service"
2930 "github.com/openshift/installer/pkg/gather/ssh"
3031 "github.com/openshift/installer/pkg/infrastructure"
31- "github.com/openshift/installer/pkg/infrastructure/clusterapi"
3232 infra "github.com/openshift/installer/pkg/infrastructure/platform"
3333
3434 _ "github.com/openshift/installer/pkg/gather/aws"
@@ -144,7 +144,7 @@ func gatherBootstrap(bootstrap string, port int, masters []string, directory str
144144 gatherID := time .Now ().Format ("20060102150405" )
145145 archives := map [string ]string {}
146146
147- if capiManifestsBundlePath , err := gatherCAPIManifests (directory , gatherID ); err != nil {
147+ if capiManifestsBundlePath , err := gatherCAPIArtifacts (directory , gatherID ); err != nil {
148148 // Do not fail the whole gather if we can't find capi manifests (we can be running terraform)
149149 logrus .Infof ("Failed to gather Cluster API manifests: %s" , err .Error ())
150150 } else {
@@ -247,36 +247,44 @@ func logClusterOperatorConditions(ctx context.Context, config *rest.Config) erro
247247 return nil
248248}
249249
250- func gatherCAPIManifests (directory , gatherID string ) (string , error ) {
251- logrus .Infoln ("Pulling Cluster API manifests " )
250+ func gatherCAPIArtifacts (directory , gatherID string ) (string , error ) {
251+ logrus .Infoln ("Pulling Cluster API artifacts " )
252252 dir , err := filepath .Abs (directory )
253253 if err != nil {
254254 return "" , fmt .Errorf ("failed to get absolute path for %s: %w" , directory , err )
255255 }
256256
257- capiDir := filepath .Join (dir , clusterapi .CAPIArtifactsDir )
257+ capiDir := filepath .Join (dir , clusterapi .ArtifactsDir )
258258 if _ , err := os .Stat (capiDir ); err != nil {
259259 if errors .Is (err , fs .ErrNotExist ) {
260260 return "" , fmt .Errorf ("either Cluster API manifests not generated or terraform provision" )
261261 }
262262 return "" , fmt .Errorf ("failed to stat Cluster API output directory: %w" , err )
263263 }
264264
265- bundleDir := filepath .Join (dir , fmt .Sprintf ("capi-manifests -bundle-%s" , gatherID ))
266- // Symlink the hidden directory so the manifests are not hidden in the archive
265+ bundleDir := filepath .Join (dir , fmt .Sprintf ("capi-artifacts -bundle-%s" , gatherID ))
266+ // Symlink the hidden directory so the artifacts are not hidden in the archive
267267 if err := os .Symlink (capiDir , bundleDir ); err != nil {
268- return "" , fmt .Errorf ("failed to copy Cluster API manifests : %w" , err )
268+ return "" , fmt .Errorf ("failed to copy Cluster API artifacts : %w" , err )
269269 }
270270 defer os .Remove (bundleDir )
271271
272- capiManifests , err := filepath .Glob (filepath .Join (bundleDir , "*.yaml" ))
272+ var capiArtifacts []string
273+ manifests , err := filepath .Glob (filepath .Join (bundleDir , "*.yaml" ))
273274 if err != nil {
274275 return "" , fmt .Errorf ("failed to gather Cluster API manifests: %w" , err )
275276 }
277+ capiArtifacts = append (capiArtifacts , manifests ... )
276278
277- capiManifestsBundlePath := fmt .Sprintf ("%s.tar.gz" , bundleDir )
278- if err := serialgather .CreateArchive (capiManifests , capiManifestsBundlePath ); err != nil {
279+ logs , err := filepath .Glob (filepath .Join (bundleDir , "*.log" ))
280+ if err != nil {
281+ return "" , fmt .Errorf ("failed to gather Cluster API control plane logs: %w" , err )
282+ }
283+ capiArtifacts = append (capiArtifacts , logs ... )
284+
285+ capiArtifactsBundlePath := fmt .Sprintf ("%s.tar.gz" , bundleDir )
286+ if err := serialgather .CreateArchive (capiArtifacts , capiArtifactsBundlePath ); err != nil {
279287 return "" , fmt .Errorf ("failed to create clusterapi bundle file: %w" , err )
280288 }
281- return capiManifestsBundlePath , nil
289+ return capiArtifactsBundlePath , nil
282290}
0 commit comments