Merge pull request #834 from fluxcd/fix-secret-cmd

Fix create secret commands
pull/837/head v0.7.4
Stefan Prodan 4 years ago committed by GitHub
commit cff96ed7ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -50,6 +50,15 @@ jobs:
- name: flux install --manifests - name: flux install --manifests
run: | run: |
./bin/flux install --manifests ./manifests/install/ ./bin/flux install --manifests ./manifests/install/
- name: flux create secret
run: |
./bin/flux create secret git git-ssh-test \
--url ssh://git@github.com/stefanprodan/podinfo
./bin/flux create secret git git-https-test \
--url https://github.com/stefanprodan/podinfo \
--username=test --password=test
./bin/flux create secret helm helm-test \
--username=test --password=test
- name: flux create source git - name: flux create source git
run: | run: |
./bin/flux create source git podinfo \ ./bin/flux create source git podinfo \

@ -51,6 +51,8 @@ func makeSecret(name string) (corev1.Secret, error) {
Namespace: rootArgs.namespace, Namespace: rootArgs.namespace,
Labels: secretLabels, Labels: secretLabels,
}, },
StringData: map[string]string{},
Data: nil,
}, nil }, nil
} }

@ -133,10 +133,10 @@ func createSecretGitCmdRun(cmd *cobra.Command, args []string) error {
return err return err
} }
secret.Data = map[string][]byte{ secret.StringData = map[string]string{
"identity": pair.PrivateKey, "identity": string(pair.PrivateKey),
"identity.pub": pair.PublicKey, "identity.pub": string(pair.PublicKey),
"known_hosts": hostKey, "known_hosts": string(hostKey),
} }
if !createArgs.export { if !createArgs.export {
@ -148,9 +148,9 @@ func createSecretGitCmdRun(cmd *cobra.Command, args []string) error {
} }
// TODO: add cert data when it's implemented in source-controller // TODO: add cert data when it's implemented in source-controller
secret.Data = map[string][]byte{ secret.StringData = map[string]string{
"username": []byte(secretGitArgs.username), "username": secretGitArgs.username,
"password": []byte(secretGitArgs.password), "password": secretGitArgs.password,
} }
default: default:
return fmt.Errorf("git URL scheme '%s' not supported, can be: ssh, http and https", u.Scheme) return fmt.Errorf("git URL scheme '%s' not supported, can be: ssh, http and https", u.Scheme)

Loading…
Cancel
Save