Skip to content
This repository has been archived by the owner on Jun 12, 2020. It is now read-only.

Commit

Permalink
fix(argocd): added possiblity to add known_hosts to argocd
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Benz <[email protected]>
  • Loading branch information
stebenz committed Apr 1, 2020
1 parent a72c406 commit 2589dcb
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/v1beta1/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type Argocd struct {
Auth *ArgocdAuth `json:"auth,omitempty" yaml:"auth,omitempty"`
Rbac *Rbac `json:"rbacConfig,omitempty" yaml:"rbacConfig,omitempty"`
Repositories []*ArgocdRepository `json:"repositories,omitempty" yaml:"repositories,omitempty"`
KnownHosts []string `json:"knownHosts,omitempty" yaml:"knownHosts,omitempty"`
}

type Rbac struct {
Expand Down
12 changes: 11 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion config/crd/bases/toolsets.boom.caos.ch_toolsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ spec:
type: object
deploy:
type: boolean
knownHosts:
items:
type: string
type: array
network:
properties:
acmeAuthority:
Expand All @@ -236,14 +240,18 @@ spec:
email:
type: string
required:
- domain
- domain
type: object
rbacConfig:
properties:
policy.csv:
type: string
policy.default:
type: string
scopes:
items:
type: string
type: array
type: object
repositories:
items:
Expand Down Expand Up @@ -563,6 +571,7 @@ spec:
description: ToolsetStatus defines the observed state of Toolset
type: object
type: object
version: v1beta1
versions:
- name: v1beta1
served: true
Expand Down
10 changes: 10 additions & 0 deletions internal/bundle/application/applications/argocd/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ func (a *Argocd) SpecToHelmValues(monitor mntr.Monitor, toolsetCRDSpec *toolsets
}
}

if spec.KnownHosts != nil && len(spec.KnownHosts) > 0 {
knownHostsStr := values.Configs.KnownHosts.Data["ssh_known_hosts"]

for _, v := range spec.KnownHosts {
knownHostsStr = strings.Join([]string{knownHostsStr, v}, "\n")
}

values.Configs.KnownHosts.Data["ssh_known_hosts"] = knownHostsStr
}

return values
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func DefaultValues(imageTags map[string]string) *Values {
knownHostsStr = strings.Join([]string{knownHostsStr, v}, "\n")
}
}
knownHostsStr = strings.Join([]string{knownHostsStr, "\n"}, "")

values := &Values{
FullnameOverride: "argocd",
Expand Down

0 comments on commit 2589dcb

Please sign in to comment.