@@ -47,6 +47,7 @@ import (
47
47
apcmd "github.com/argoproj-labs/argocd-autopilot/cmd/commands"
48
48
"github.com/argoproj-labs/argocd-autopilot/pkg/application"
49
49
"github.com/argoproj-labs/argocd-autopilot/pkg/fs"
50
+ "github.com/argoproj-labs/argocd-autopilot/pkg/git"
50
51
apgit "github.com/argoproj-labs/argocd-autopilot/pkg/git"
51
52
"github.com/argoproj-labs/argocd-autopilot/pkg/kube"
52
53
apstore "github.com/argoproj-labs/argocd-autopilot/pkg/store"
@@ -693,6 +694,11 @@ func runRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
693
694
return util .DecorateErrorWithDocsLink (fmt .Errorf ("failed to bootstrap repository: %w" , err ))
694
695
}
695
696
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
+
696
702
err = oc .PrepareOpenshiftCluster (ctx , & oc.OpenshiftOptions {
697
703
KubeFactory : opts .KubeFactory ,
698
704
RuntimeName : opts .RuntimeName ,
@@ -2146,3 +2152,27 @@ func getRuntimeDef(runtimeDef, version string) string {
2146
2152
}
2147
2153
return strings .Replace (runtimeDef , "stable" , version , 1 )
2148
2154
}
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