@@ -47,6 +47,7 @@ import (
4747 apcmd "github.com/argoproj-labs/argocd-autopilot/cmd/commands"
4848 "github.com/argoproj-labs/argocd-autopilot/pkg/application"
4949 "github.com/argoproj-labs/argocd-autopilot/pkg/fs"
50+ "github.com/argoproj-labs/argocd-autopilot/pkg/git"
5051 apgit "github.com/argoproj-labs/argocd-autopilot/pkg/git"
5152 "github.com/argoproj-labs/argocd-autopilot/pkg/kube"
5253 apstore "github.com/argoproj-labs/argocd-autopilot/pkg/store"
@@ -693,6 +694,11 @@ func runRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
693694 return util .DecorateErrorWithDocsLink (fmt .Errorf ("failed to bootstrap repository: %w" , err ))
694695 }
695696
697+ err = patchClusterResourcesAppSet (ctx , opts .InsCloneOpts )
698+ if err != nil {
699+ return util .DecorateErrorWithDocsLink (fmt .Errorf ("failed to patch cluster-resources ApplicationSet: %w" , err ))
700+ }
701+
696702 err = oc .PrepareOpenshiftCluster (ctx , & oc.OpenshiftOptions {
697703 KubeFactory : opts .KubeFactory ,
698704 RuntimeName : opts .RuntimeName ,
@@ -2146,3 +2152,27 @@ func getRuntimeDef(runtimeDef, version string) string {
21462152 }
21472153 return strings .Replace (runtimeDef , "stable" , version , 1 )
21482154}
2155+
2156+ func patchClusterResourcesAppSet (ctx context.Context , cloneOpts * git.CloneOptions ) error {
2157+ r , fs , err := cloneOpts .GetRepo (ctx )
2158+ if err != nil {
2159+ return err
2160+ }
2161+
2162+ appSet := & argocdv1alpha1.ApplicationSet {}
2163+ name := store .Get ().ClusterResourcesPath
2164+ if err := fs .ReadYamls (name , appSet ); err != nil {
2165+ return err
2166+ }
2167+
2168+ if appSet .ObjectMeta .Labels == nil {
2169+ appSet .ObjectMeta .Labels = make (map [string ]string )
2170+ }
2171+
2172+ appSet .ObjectMeta .Labels [store .Get ().LabelKeyCFInternal ] = "true"
2173+ if err = fs .WriteYamls (name , appSet ); err != nil {
2174+ return err
2175+ }
2176+
2177+ return apu .PushWithMessage (ctx , r , "patch cluster-resources ApplicationSet" )
2178+ }
0 commit comments