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

Commit

Permalink
Use kustomize for patching install
Browse files Browse the repository at this point in the history
This changes the `fluxctl install` installation to use a
kustomization, rather than sed. This is a little more robust; but the
motivation is more that it will enable more complicated patches, like
mounting volumes.

_En passant_, the kubectl rollout during flux installation gets a
timeout, so it can fail fast. Well, faster than twenty minutes.
  • Loading branch information
squaremo committed Nov 4, 2019
1 parent 467f719 commit 0b9d6ef
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
9 changes: 9 additions & 0 deletions test/e2e/fixtures/e2e_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- op: add
path: /spec/template/spec/containers/0/args/-
value: --git-poll-interval=10s
- op: add
path: /spec/template/spec/containers/0/args/-
value: --sync-interval=10s
- op: add
path: /spec/template/spec/containers/0/args/-
value: --registry-exclude-image=*
15 changes: 15 additions & 0 deletions test/e2e/fixtures/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resources:
- flux-account.yaml
- flux-deployment.yaml
- flux-secret.yaml
- 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
kind: Deployment
name: flux
path: e2e_patch.yaml
17 changes: 7 additions & 10 deletions test/e2e/lib/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,13 @@ function uninstall_flux_with_helm() {
fluxctl_install_cmd="fluxctl install --git-url=ssh://git@gitsrv/git-server/repos/cluster.git --git-email=foo"

function install_flux_with_fluxctl() {
local eol=$'\n'
# Use the local Flux image instead of the latest release, use a poll interval of 10s
# (to make tests quicker) and disable registry polling (to avoid overloading kind)
$fluxctl_install_cmd --namespace "${FLUX_NAMESPACE}" |
sed 's%docker\.io/fluxcd/flux:.*%fluxcd/flux:latest%' |
sed "s%--git-email=foo%--git-email=foo\\$eol - --git-poll-interval=10s%" |
sed "s%--git-email=foo%--git-email=foo\\$eol - --sync-interval=10s%" |
sed "s%--git-email=foo%--git-email=foo\\$eol - --registry-exclude-image=\*%" |
kubectl apply -f -
kubectl -n "${FLUX_NAMESPACE}" rollout status deployment/flux
local kustomtmp
kustomtmp="$(mktemp -d)"
# This generates the base descriptions, which we'll then patch with a kustomization
$fluxctl_install_cmd --namespace "${FLUX_NAMESPACE}" -o "${kustomtmp}" 2>&3
cp ${E2E_DIR}/fixtures/{kustomization,e2e_patch}.yaml "${kustomtmp}/"
kubectl apply -k "${kustomtmp}" >&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}")
Expand Down

0 comments on commit 0b9d6ef

Please sign in to comment.