Browse Source

Generate ssh key on the fly

Alfonso Acosta 4 months ago
parent
commit
c6c65a2948
2 changed files with 5 additions and 15 deletions
  1. 5
    2
      test/e2e/e2e-git.sh
  2. 0
    13
      test/e2e/ssh-key.yaml

+ 5
- 2
test/e2e/e2e-git.sh View File

@@ -3,12 +3,15 @@
3 3
 set -o errexit
4 4
 
5 5
 REPO_ROOT=$(git rev-parse --show-toplevel)
6
+SCRIPT_DIR="${REPO_ROOT}/test/e2e"
6 7
 export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
7 8
 
8 9
 echo ">>> Installing git"
9 10
 kubectl create namespace flux
10
-kubectl apply -f ${REPO_ROOT}/test/e2e/ssh-key.yaml
11
-kubectl apply -f ${REPO_ROOT}/test/e2e/git-dep.yaml
11
+ssh-keygen -t rsa -N "" -f "${SCRIPT_DIR}/id_rsa"
12
+kubectl create secret generic ssh-git --namespace=flux --from-file="${SCRIPT_DIR}/known_hosts" --from-file="${SCRIPT_DIR}/id_rsa" --from-file=identity="${SCRIPT_DIR}/id_rsa" --from-file="${SCRIPT_DIR}/id_rsa.pub"
13
+rm "${SCRIPT_DIR}/id_rsa" "${SCRIPT_DIR}/id_rsa.pub"
14
+kubectl apply -f "${SCRIPT_DIR}/git-dep.yaml"
12 15
 
13 16
 kubectl -n flux rollout status deployment/gitsrv
14 17
 

+ 0
- 13
test/e2e/ssh-key.yaml View File

@@ -1,13 +0,0 @@
1
----
2
-# ssh-keyscan gitsrv >> ~/.ssh/known_hosts
3
-apiVersion: v1
4
-kind: Secret
5
-data:
6
-  known_hosts: Z2l0c3J2IHNzaC1yc2EgQUFBQUIzTnphQzF5YzJFQUFBQURBUUFCQUFBQkFRRHQ2NU0wc2FGQTZFd3NqYzhtUTQwNWJJNDA2QnNGU0pyYkd6OUdGcmJXQm4wUnMzTG9pNFM2QURXZ1RXbGNzcEh2YmZtZjd2WFc5b2lUanhla2U4b0hQQ2ZGWXJIRmRQSzI2QmlnMkoxa0UyRHpST05pelpXY2R3OGRw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