Skip to content

Commit 16903d7

Browse files
CR-13036 sa name bug (#482)
* add replacement to kust * wip * bump * remove line * small fix * small fix
1 parent aab4fae commit 16903d7

File tree

4 files changed

+60
-5
lines changed

4 files changed

+60
-5
lines changed

Makefile

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

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

cmd/commands/cluster.go

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"github.com/juju/ansiterm"
3636
"github.com/spf13/cobra"
3737
kusttypes "sigs.k8s.io/kustomize/api/types"
38+
"sigs.k8s.io/kustomize/kyaml/resid"
3839
)
3940

4041
type (
@@ -59,7 +60,24 @@ type (
5960
}
6061
)
6162

62-
var minAddClusterSupportedVersion = semver.MustParse("0.0.283")
63+
var (
64+
minAddClusterSupportedVersion = semver.MustParse("0.0.283")
65+
66+
serviceAccountGVK = resid.Gvk{
67+
Version: "v1",
68+
Kind: "ServiceAccount",
69+
}
70+
jobGVK = resid.Gvk{
71+
Group: "batch",
72+
Version: "v1",
73+
Kind: "Job",
74+
}
75+
clusterRoleBindinGVK = resid.Gvk{
76+
Group: "rbac.authorization.k8s.io",
77+
Version: "v1",
78+
Kind: "ClusterRoleBinding",
79+
}
80+
)
6381

6482
func NewClusterCommand() *cobra.Command {
6583
cmd := &cobra.Command{
@@ -283,6 +301,43 @@ func createAddClusterManifests(ingressUrl, contextName, server, csdpToken, versi
283301
resourceUrl,
284302
},
285303
NameSuffix: nameSuffix,
304+
Replacements: []kusttypes.ReplacementField{
305+
{
306+
Replacement: kusttypes.Replacement{
307+
Source: &kusttypes.SourceSelector{
308+
ResId: resid.ResId{
309+
Gvk: serviceAccountGVK,
310+
Name: "argocd-manager",
311+
},
312+
FieldPath: "metadata.name",
313+
},
314+
Targets: []*kusttypes.TargetSelector{
315+
{
316+
Select: &kusttypes.Selector{
317+
ResId: resid.ResId{
318+
Gvk: jobGVK,
319+
Name: "csdp-add-cluster-job",
320+
},
321+
},
322+
FieldPaths: []string{
323+
"spec.template.spec.serviceAccount",
324+
},
325+
},
326+
{
327+
Select: &kusttypes.Selector{
328+
ResId: resid.ResId{
329+
Gvk: clusterRoleBindinGVK,
330+
Name: "argocd-manager-role-binding",
331+
},
332+
},
333+
FieldPaths: []string{
334+
"subjects.[name=argocd-manager].name",
335+
},
336+
},
337+
},
338+
},
339+
},
340+
},
286341
}
287342
k.FixKustomizationPostUnmarshalling()
288343
util.Die(k.FixKustomizationPreMarshalling())

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.0.427/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.428/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.0.427/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.428/cf-darwin-amd64.tar.gz | tar zx
4040

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

manifests/runtime.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
namespace: "{{ namespace }}"
66
spec:
77
defVersion: 1.0.1
8-
version: 0.0.427
8+
version: 0.0.428
99
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
1010
components:
1111
- name: events

0 commit comments

Comments
 (0)