mirror of
https://github.com/fluxcd/flux2.git
synced 2026-04-14 15:56:52 +00:00
Create secret with bearer-token
Signed-off-by: Santosh Kaluskar <dtshbl@gmail.com>
This commit is contained in:
parent
0fd8fbe301
commit
5a45d2b127
5 changed files with 34 additions and 3 deletions
|
|
@ -39,6 +39,7 @@ const (
|
|||
PrivateKeySecretKey = "identity"
|
||||
PublicKeySecretKey = "identity.pub"
|
||||
KnownHostsSecretKey = "known_hosts"
|
||||
BearerTokenKey = "bearerToken"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
|
|
@ -58,6 +59,7 @@ type Options struct {
|
|||
KeyFile []byte
|
||||
TargetPath string
|
||||
ManifestFile string
|
||||
BearerToken string
|
||||
}
|
||||
|
||||
func MakeDefaultOptions() Options {
|
||||
|
|
@ -72,5 +74,6 @@ func MakeDefaultOptions() Options {
|
|||
CertFile: []byte{},
|
||||
KeyFile: []byte{},
|
||||
ManifestFile: "secret.yaml",
|
||||
BearerToken: "",
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,9 @@ func buildSecret(keypair *ssh.KeyPair, hostKey, caFile, certFile, keyFile, docke
|
|||
secret.StringData[UsernameSecretKey] = options.Username
|
||||
secret.StringData[PasswordSecretKey] = options.Password
|
||||
}
|
||||
if options.BearerToken != "" {
|
||||
secret.StringData[BearerTokenKey] = options.BearerToken
|
||||
}
|
||||
|
||||
if len(caFile) != 0 {
|
||||
secret.StringData[CAFileSecretKey] = string(caFile)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue