@@ -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,8 +247,8 @@ 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 )
@@ -262,21 +262,29 @@ func gatherCAPIManifests(directory, gatherID string) (string, error) {
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