@@ -87,9 +87,8 @@ func TemplateCmd() *cobra.Command {
87
87
88
88
// render all mode, similar to helm template
89
89
// we will utilize pull command to fetch and render manifests from upstream
90
- log .ActionWithSpinner ("Pulling app from upstream and rendering templates..." )
90
+ log .Info ("Pulling app from upstream and rendering templates..." )
91
91
err := pullAndRender (license .Spec .AppSlug , licenseFile , configFile , localPath )
92
- log .FinishSpinner ()
93
92
94
93
if err != nil {
95
94
return errors .Wrap (err , "failed to render all templates" )
@@ -264,6 +263,7 @@ func pullAndRender(appSlug string, licensePath string, configPath string, localP
264
263
Silent : true ,
265
264
ExcludeAdminConsole : true ,
266
265
LocalPath : ExpandDir (localPath ),
266
+ Downstreams : []string {"this-cluster" },
267
267
}
268
268
269
269
upstream := pull .RewriteUpstream (appSlug )
@@ -273,25 +273,41 @@ func pullAndRender(appSlug string, licensePath string, configPath string, localP
273
273
return errors .Wrap (err , "failed to pull upstream" )
274
274
}
275
275
276
- // iterate over kotsKinds directory in tempDir and print all YAML contents
276
+ // iterate over kotsKinds + rendered directory in tempDir and print all YAML contents
277
277
kotsKindsDir := filepath .Join (tempDir , "kotsKinds" )
278
- files , err := os .ReadDir (kotsKindsDir )
279
- if err != nil {
280
- return errors .Wrap (err , "failed to read kotsKinds directory" )
281
- }
278
+ renderedDir := filepath .Join (tempDir , "rendered" )
279
+ dirs := []string {kotsKindsDir , renderedDir }
282
280
283
- manifetsToRender := make (map [string ]string )
284
- for _ , file := range files {
285
- if file .IsDir () {
286
- continue
287
- }
288
- content , err := os .ReadFile (filepath .Join (kotsKindsDir , file .Name ()))
281
+ manifestsToRender := make (map [string ]string )
282
+
283
+ for _ , dir := range dirs {
284
+ err := filepath .Walk (dir , func (path string , info os.FileInfo , err error ) error {
285
+ if err != nil {
286
+ return err
287
+ }
288
+ if info .IsDir () {
289
+ return nil
290
+ }
291
+
292
+ // ignore kotsadm- manifests
293
+ if strings .HasPrefix (info .Name (), "kotsadm-" ) {
294
+ return nil
295
+ }
296
+
297
+ content , err := os .ReadFile (path )
298
+ if err != nil {
299
+ return errors .Wrap (err , "failed to read file" )
300
+ }
301
+ manifestsToRender [info .Name ()] = string (content )
302
+
303
+ return nil
304
+ })
289
305
if err != nil {
290
- return errors .Wrap (err , "failed to read file " )
306
+ return errors .Wrap (err , "failed to walk directory to render manifests " )
291
307
}
292
- manifetsToRender [file .Name ()] = string (content )
293
308
}
294
- for k , m := range manifetsToRender {
309
+
310
+ for k , m := range manifestsToRender {
295
311
fmt .Println ("---" )
296
312
fmt .Printf ("# Source: %s\n " , k )
297
313
fmt .Println (m )
@@ -300,6 +316,7 @@ func pullAndRender(appSlug string, licensePath string, configPath string, localP
300
316
// also render helm charts with helm template if any
301
317
helmChartsDir := filepath .Join (tempDir , "helm" )
302
318
if _ , err := os .Stat (helmChartsDir ); err == nil {
319
+ logger .Info ("Rendering Helm charts with helm template..." )
303
320
var chartPath string
304
321
var valuesPath string
305
322
0 commit comments