Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Mount known_hosts properly
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Nov 7, 2019
1 parent 4214b3d commit a5e8f43
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
12 changes: 12 additions & 0 deletions test/e2e/fixtures/kustom/base/flux/e2e_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@
- op: add
path: /spec/template/spec/containers/0/args/-
value: --registry-exclude-image=*
- op: add
path: /spec/template/spec/containers/0/volumeMounts/-
value:
name: known-hosts
mountPath: /root/.ssh/known_hosts
subPath: known_hosts
- op: add
path: /spec/template/spec/volumes/-
value:
name: known-hosts
configMap:
name: flux-known-hosts
2 changes: 0 additions & 2 deletions test/e2e/fixtures/kustom/base/flux/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ resources:
- memcache-dep.yaml
- memcache-svc.yaml
patchesJson6902:
# use a poll interval of 10s (to make tests quicker) and disable
# registry polling (to avoid overloading kind)
- target:
group: apps
version: v1
Expand Down
8 changes: 3 additions & 5 deletions test/e2e/lib/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fluxctl_install_cmd="fluxctl install --git-url=ssh://git@gitsrv/git-server/repos

function install_flux_with_fluxctl() {
kustomization_dir=${1:-base/flux}
kubectl -n "${FLUX_NAMESPACE}" create configmap flux-known-hosts --from-file="${E2E_DIR}/fixtures/known_hosts"
local kustomtmp
kustomtmp="$(mktemp -d)"
defer "rm -rf \"${kustomtmp}\""
Expand All @@ -64,14 +65,11 @@ function install_flux_with_fluxctl() {
cp -R "${E2E_DIR}"/fixtures/kustom/* "${kustomtmp}/"
kubectl apply -k "${kustomtmp}/${kustomization_dir}" >&3
kubectl -n "${FLUX_NAMESPACE}" rollout status -w --timeout=30s deployment/flux
# Add the known hosts file manually (it's much easier than editing the manifests to add a volume)
local flux_podname
flux_podname=$(kubectl get pod -n "${FLUX_NAMESPACE}" -l name=flux -o jsonpath="{['items'][0].metadata.name}")
kubectl exec -n "${FLUX_NAMESPACE}" "${flux_podname}" -- sh -c "mkdir -p /root/.ssh; echo '${KNOWN_HOSTS}' > /root/.ssh/known_hosts" >&3
}

function uninstall_flux_with_fluxctl() {
$fluxctl_install_cmd --namespace "${FLUX_NAMESPACE}" | kubectl delete -f -
kubectl delete -n "${FLUX_NAMESPACE}" configmap flux-known-hosts
$fluxctl_install_cmd -n "${FLUX_NAMESPACE}" | kubectl delete -f -
}

flux_gpg_helm_template="helm template --name flux-gpg
Expand Down

0 comments on commit a5e8f43

Please sign in to comment.