This repository has been archived by the owner on Jun 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(argocd): possibility to add credentials through boom.yaml (#99)
* fix(argocd): added possbility to add repository.credentials Signed-off-by: Stefan Benz <[email protected]> * docs(argocd): added possibility to define credentials Signed-off-by: Stefan Benz <[email protected]>
- Loading branch information
Showing
6 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Credentials | ||
|
||
| Parameter | Description | Default | | ||
| ---------------------------------- | ------------------------------------------------------------------------------- | --------------------------------- | | ||
| `url` | Used URL for the repository, (starting "git@" or "https://" ) | | | ||
| `usernameSecret` | Attributes for username in a secret | | | ||
| `usernameSecret.name` | Name of the secret | | | ||
| `usernameSecret.key` | Key in the secret which contains the username | | | ||
| `passwordSecret` | Attributes for username in a secret | | | ||
| `passwordSecret.name` | Name of the secret | | | ||
| `passwordSecret.key` | Key in the secret which contains the password | | | ||
| `certificateSecret` | Attributes for username in a secret | | | ||
| `certificateSecret.name` | Name of the secret | | | ||
| `certificateSecret.key` | Key in the secret which contains the certificate | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
internal/bundle/application/applications/argocd/config/credential/credential.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package credential | ||
|
||
import ( | ||
toolsetsv1beta1 "github.com/caos/boom/api/v1beta1" | ||
"github.com/caos/orbiter/mntr" | ||
) | ||
|
||
type Credential struct { | ||
URL string | ||
UsernameSecret *secret `yaml:"usernameSecret,omitempty"` | ||
PasswordSecret *secret `yaml:"passwordSecret,omitempty"` | ||
SSHPrivateKeySecret *secret `yaml:"sshPrivateKeySecret,omitempty"` | ||
} | ||
|
||
type secret struct { | ||
Name string | ||
Key string | ||
} | ||
|
||
func GetFromSpec(monitor mntr.Monitor, spec *toolsetsv1beta1.Argocd) []*Credential { | ||
creds := make([]*Credential, 0) | ||
|
||
if spec.Credentials == nil || len(spec.Credentials) == 0 { | ||
return creds | ||
} | ||
|
||
for _, v := range spec.Credentials { | ||
var us, ps, ssh *secret | ||
if v.UsernameSecret != nil { | ||
us = &secret{ | ||
Name: v.UsernameSecret.Name, | ||
Key: v.UsernameSecret.Key, | ||
} | ||
} | ||
if v.PasswordSecret != nil { | ||
ps = &secret{ | ||
Name: v.PasswordSecret.Name, | ||
Key: v.PasswordSecret.Key, | ||
} | ||
} | ||
if v.CertificateSecret != nil { | ||
ssh = &secret{ | ||
Name: v.CertificateSecret.Name, | ||
Key: v.CertificateSecret.Key, | ||
} | ||
} | ||
|
||
cred := &Credential{ | ||
URL: v.URL, | ||
UsernameSecret: us, | ||
PasswordSecret: ps, | ||
SSHPrivateKeySecret: ssh, | ||
} | ||
creds = append(creds, cred) | ||
} | ||
|
||
return creds | ||
} |