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

git repo improvements for helm operator #1238

Merged
merged 3 commits into from
Jul 24, 2018
Merged

Conversation

squaremo
Copy link
Member

Here are some improvements to the git mirroring, so that it's usable for the Helm operator.

  • allow a git repo be read-only, so that you can give the helm-op a read-only SSH key (as we do in local env)
  • add a "files only" clone, git.Export, so the helm operator can get at a working tree without all the config baggage that fluxd uses in its working directories

squaremo added 3 commits July 19, 2018 17:44
For the helm operator (and in some places in fluxd) we need only
read-only access to the git repo. Indeed in some deployments, the helm
operator will be given a read-only SSH key.

So: give the git mirroring (git.Repo) a read-only option, which means
it will

 - consider itself ready when it's been cloned, without checking
   whether it can write to the upstream repo;
 - not let you make a working clone (because it's assumed you won't be
   able to push commits from it)

We still need a way to get a copy of the repo, so the helm operator
can look at the files. For that purpose, add a bare-bones type
`git.Export`, with which all you can do is get the directory it's been
cloned to.
For fluxd, we have a git mirroring implementation that keeps track of
its ready state. This is because when fluxd starts, it may not have a
viable SSH key, so it needs to be able to retry in the background,
while it does everything else that it can.

In the helm operator, and in tests, it's more useful to be able to
clone the repo and succeed or fail synchronously. This should remove
some flakes from the tests, which previously had to start the repo's
loop, and check back with it to see if it was ready -- which would
occasionally fail to be the case within the timeout.
Newer gits insist on there being a non-empty path after `--` if it
appears. The version of git baked into the container image does not
have this quirk, but a newer git on the path may cause tests to fail
when run locally.
@squaremo squaremo requested a review from aaron7 July 20, 2018 11:28
@squaremo
Copy link
Member Author

The substance is in https://github.com/weaveworks/flux/pull/1238/files#diff-4e28ed4007c9ceb9cb3efd309643ca04, in which the state machine loop is factored out so it can be used synchronously (in repo.Ready(...) ) but also set running in repo.Start(...).

Copy link
Contributor

@aaron7 aaron7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtrm

@squaremo squaremo merged commit 63dc183 into master Jul 24, 2018
@squaremo squaremo deleted the rewrite/better-gits branch July 24, 2018 11:24
@squaremo
Copy link
Member Author

Thanks Aaron 🍝

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants