Skip to content

Commit 7dfbc67

Browse files
authored
CR-13084-hide-cluster-resources (#657)
* patch `internal: true` to cluster-resources appset * bumped version to 0.1.19
1 parent 30f734a commit 7dfbc67

File tree

5 files changed

+36
-8
lines changed

5 files changed

+36
-8
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.1.18
1+
VERSION=v0.1.19
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

cmd/commands/runtime_install.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cf version
2323

2424
```bash
2525
# download and extract the binary
26-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.18/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.19/cf-linux-amd64.tar.gz | tar zx
2727

2828
# move the binary to your $PATH
2929
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -36,7 +36,7 @@ cf version
3636

3737
```bash
3838
# download and extract the binary
39-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.18/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.19/cf-darwin-amd64.tar.gz | tar zx
4040

4141
# move the binary to your $PATH
4242
mv ./cf-darwin-amd64 /usr/local/bin/cf

pkg/store/store.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ type Store struct {
147147
MinKubeVersion string
148148
MaxKubeVersion string
149149
MasterIngressName string
150+
ClusterResourcesPath string
150151
InClusterPath string
151152
SccName string
152153
CFInternalGitSources []string
@@ -265,6 +266,7 @@ func init() {
265266
s.MinKubeVersion = "v1.21.0"
266267
s.MaxKubeVersion = "v1.25.0"
267268
s.MasterIngressName = "-master"
269+
s.ClusterResourcesPath = "/bootstrap/cluster-resources.yaml"
268270
s.InClusterPath = "/bootstrap/cluster-resources/in-cluster"
269271
s.SccName = "cf-scc"
270272
s.CFInternalGitSources = []string{s.MarketplaceGitSourceName}

pkg/util/aputil/aputil.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,12 @@ func AddCloneFlags(cmd *cobra.Command, o *CloneFlagsOptions) *git.CloneOptions {
6060
return opts
6161
}
6262

63-
func PushWithMessage(ctx context.Context, r git.Repository, msg string, progress ...io.Writer) error {
63+
func PushWithMessage(ctx context.Context, r git.Repository, msg string) error {
6464
var (
6565
err error
6666
prog io.Writer
6767
)
6868

69-
if len(progress) > 0 {
70-
prog = progress[0]
71-
}
72-
7369
for try := 0; try < pushRetries; try++ {
7470
_, err = r.Persist(ctx, &git.PushOptions{
7571
AddGlobPattern: ".",

0 commit comments

Comments
 (0)