@@ -187,6 +187,7 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
187187 if err != nil {
188188 return fmt .Errorf ("failed to get a runtime creation response: %w" , err )
189189 }
190+
190191 opts .RuntimeToken = runtimeCreationResponse .NewAccessToken
191192
192193 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 {
203204 err = apcmd .RunProjectCreate (ctx , & apcmd.ProjectCreateOptions {
204205 CloneOpts : opts .insCloneOpts ,
205206 ProjectName : opts .RuntimeName ,
207+ Labels : map [string ]string {
208+ store .Get ().LabelKeyCFType : fmt .Sprintf ("{{ labels.%s }}" , util .EscapeAppsetFieldName (store .Get ().LabelKeyCFType )),
209+ },
206210 })
207211 if err != nil {
208212 return fmt .Errorf ("failed to create project: %w" , err )
209213 }
210214
211215 for _ , component := range rt .Spec .Components {
212216 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 {
214218 return fmt .Errorf ("failed to create '%s' application: %w" , component .Name , err )
215219 }
216220 }
@@ -464,7 +468,7 @@ func RunRuntimeUpgrade(ctx context.Context, opts *RuntimeUpgradeOptions) error {
464468
465469 for _ , component := range newComponents {
466470 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 {
468472 return fmt .Errorf ("failed to create '%s' application: %w" , component .Name , err )
469473 }
470474 }
@@ -504,7 +508,7 @@ func createComponentsReporter(ctx context.Context, cloneOpts *git.CloneOptions,
504508 Type : application .AppTypeDirectory ,
505509 URL : cloneOpts .URL () + "/" + resPath ,
506510 }
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 {
508512 return err
509513 }
510514
@@ -543,18 +547,10 @@ func updateProject(repofs fs.FS, runtimeName string) error {
543547 return err
544548 }
545549
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-
553550 if project .ObjectMeta .Labels == nil {
554551 project .ObjectMeta .Labels = make (map [string ]string )
555552 }
556553
557- appset .Spec .Template .Labels [store .Get ().LabelKeyCFType ] = store .Get ().CFComponentType
558554 project .ObjectMeta .Labels [store .Get ().LabelKeyCFType ] = store .Get ().CFRuntimeType
559555 return repofs .WriteYamls (projPath , project , appset )
560556}
@@ -884,7 +880,7 @@ func createGitSource(ctx context.Context, insCloneOpts *git.CloneOptions, gsClon
884880 Type : application .AppTypeDirectory ,
885881 URL : insCloneOpts .URL () + insFs .Join (insFs .Root (), resPath ),
886882 }
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 {
888884 return fmt .Errorf ("failed to create git-source: %w" , err )
889885 }
890886
0 commit comments