@@ -187,6 +187,7 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
187
187
if err != nil {
188
188
return fmt .Errorf ("failed to get a runtime creation response: %w" , err )
189
189
}
190
+
190
191
opts .RuntimeToken = runtimeCreationResponse .NewAccessToken
191
192
192
193
log .G (ctx ).WithField ("version" , rt .Spec .Version ).Infof ("installing runtime '%s'" , opts .RuntimeName )
@@ -203,14 +204,17 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
203
204
err = apcmd .RunProjectCreate (ctx , & apcmd.ProjectCreateOptions {
204
205
CloneOpts : opts .insCloneOpts ,
205
206
ProjectName : opts .RuntimeName ,
207
+ Labels : map [string ]string {
208
+ store .Get ().LabelKeyCFType : fmt .Sprintf ("{{ labels.%s }}" , util .EscapeAppsetFieldName (store .Get ().LabelKeyCFType )),
209
+ },
206
210
})
207
211
if err != nil {
208
212
return fmt .Errorf ("failed to create project: %w" , err )
209
213
}
210
214
211
215
for _ , component := range rt .Spec .Components {
212
216
log .G (ctx ).Infof ("creating component '%s'" , component .Name )
213
- if err = component .CreateApp (ctx , opts .KubeFactory , opts .insCloneOpts , opts .RuntimeName , rt .Spec .Version ); err != nil {
217
+ if err = component .CreateApp (ctx , opts .KubeFactory , opts .insCloneOpts , opts .RuntimeName , store . Get (). CFComponentType , rt .Spec .Version ); err != nil {
214
218
return fmt .Errorf ("failed to create '%s' application: %w" , component .Name , err )
215
219
}
216
220
}
@@ -464,7 +468,7 @@ func RunRuntimeUpgrade(ctx context.Context, opts *RuntimeUpgradeOptions) error {
464
468
465
469
for _ , component := range newComponents {
466
470
log .G (ctx ).Infof ("Creating app '%s'" , component .Name )
467
- if err = component .CreateApp (ctx , nil , opts .CloneOpts , opts .RuntimeName , newRt .Spec .Version ); err != nil {
471
+ if err = component .CreateApp (ctx , nil , opts .CloneOpts , opts .RuntimeName , store . Get (). CFComponentType , newRt .Spec .Version ); err != nil {
468
472
return fmt .Errorf ("failed to create '%s' application: %w" , component .Name , err )
469
473
}
470
474
}
@@ -504,7 +508,7 @@ func createComponentsReporter(ctx context.Context, cloneOpts *git.CloneOptions,
504
508
Type : application .AppTypeDirectory ,
505
509
URL : cloneOpts .URL () + "/" + resPath ,
506
510
}
507
- if err := appDef .CreateApp (ctx , opts .KubeFactory , cloneOpts , opts .RuntimeName , nil ); err != nil {
511
+ if err := appDef .CreateApp (ctx , opts .KubeFactory , cloneOpts , opts .RuntimeName , store . Get (). CFComponentType , nil ); err != nil {
508
512
return err
509
513
}
510
514
@@ -543,18 +547,10 @@ func updateProject(repofs fs.FS, runtimeName string) error {
543
547
return err
544
548
}
545
549
546
- if appset .Spec .Template .Labels == nil {
547
- appset .Spec .Template .Labels = make (map [string ]string )
548
- }
549
- if appset .Labels == nil {
550
- appset .Labels = make (map [string ]string )
551
- }
552
-
553
550
if project .ObjectMeta .Labels == nil {
554
551
project .ObjectMeta .Labels = make (map [string ]string )
555
552
}
556
553
557
- appset .Spec .Template .Labels [store .Get ().LabelKeyCFType ] = store .Get ().CFComponentType
558
554
project .ObjectMeta .Labels [store .Get ().LabelKeyCFType ] = store .Get ().CFRuntimeType
559
555
return repofs .WriteYamls (projPath , project , appset )
560
556
}
@@ -884,7 +880,7 @@ func createGitSource(ctx context.Context, insCloneOpts *git.CloneOptions, gsClon
884
880
Type : application .AppTypeDirectory ,
885
881
URL : insCloneOpts .URL () + insFs .Join (insFs .Root (), resPath ),
886
882
}
887
- if err = appDef .CreateApp (ctx , nil , insCloneOpts , runtimeName , nil ); err != nil {
883
+ if err = appDef .CreateApp (ctx , nil , insCloneOpts , runtimeName , store . Get (). CFGitSourceType , nil ); err != nil {
888
884
return fmt .Errorf ("failed to create git-source: %w" , err )
889
885
}
890
886
0 commit comments