Commit Graph

48 Commits (26168b12416acf4c5cb0162831472f0a12fa5e95)

Author SHA1 Message Date
Stefan Prodan 05903e2171
Generate image pull secret at bootstrap
Add an optional flag called `--registry-creds` to the bootstrap
command for generating an image pull secret for container images
stored in private registries.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
9 months ago
Ernest Wong 5685afb9d5 Fix typos in flux bootstrap documentation
Signed-off-by: Ernest Wong <chwong719@gmail.com>
1 year ago
Somtochi Onyekwere 2f15ad972b confirm before overriding installation by another manager
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
1 year ago
Max Jonas Werner 52acac1a37
Add /v2 suffix to module name in preparation of 2.0.0 release
Signed-off-by: Max Jonas Werner <mail@makk.es>
2 years ago
Timo Furrer 2e1721ca85 Implement `--deploy-token-auth` in GitLab bootstrapping
This change set implements support for the `--deploy-token-auth` option
in the `flux bootstrap gitlab` command.

That option will reconcile a GitLab Project Deploy Token to use for the
authentication of the GitLab git repository.
A GitLab Project Deploy Token can be used the same way as a Personal
Access Token which is already supported via `--token-auth`.
The difference with the GitLab Project Deploy Token is that the token is
managed (created, updated, deleted) by Flux and not provided by the
user.

This change is transparent to the source-controller.

A prerequisite for this change is the
`fluxcd/go-git-providers` change here:

* https://github.com/fluxcd/go-git-providers/pull/191

See related discussion here: https://github.com/fluxcd/flux2/discussions/3595
GitLab Issue here: https://gitlab.com/gitlab-org/gitlab/-/issues/392605

Signed-off-by: Timo Furrer <tuxtimo@gmail.com>
2 years ago
Stefan Prodan b44a3d36ba
Remove deprecated flags
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
Sanskar Jaiswal 28feb8b1d7 bootstrap: fallback to default known_hosts
Use default known_hosts and ssh configuration when no private key file
is provided while bootstraping using ssh.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2 years ago
Boris Kreitchman c01023d8f8 Process getVersion error in bootstrap
Signed-off-by: Boris Kreitchman <bkreitch@gmail.com>
2 years ago
Sanskar Jaiswal 0a5048a56b refactor bootstrap process to use fluxcd/pkg/git
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2 years ago
Philip Laine a4734d7e30 Remove file reading from bootstrap package
Signed-off-by: Philip Laine <philip.laine@gmail.com>
2 years ago
Philip Laine 0343575146 Move bootstrap package from internal to pkg
Signed-off-by: Philip Laine <philip.laine@gmail.com>
2 years ago
Sanskar Jaiswal 7232ff9ea0 modify tmp dir generation to be absolute on all OSes
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
3 years ago
Stefan Prodan 0d8194c800 Add the kube client qps and burst to the global args
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 years ago
Robert Wittman e3f5a8fee3
Add GPG options to Gitlab and BitBucket bootstraps
Signed-off-by: Robert Wittman <robkwittman@gmail.com>
3 years ago
Jakob Schrettenbrunner ca7d2e783f Use k8s.io/cli-runtime for kubernetes flags
Signed-off-by: Jakob Schrettenbrunner <jakob.schrettenbrunner@telekom.de>
3 years ago
Somtochi Onyekwere 43c6a1531a Add caBundle to gogit provider config
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
3 years ago
Max Jonas Werner 31771f3575
fix: improve wording
Signed-off-by: Max Jonas Werner <mail@makk.es>
3 years ago
Max Jonas Werner ffcd7d8059
feat: prompt for access tokens in 'bootstrap' command
This change adds functionality to both, `bootstrap github` and
`bootstrap gitlab` to prompt the user for the personal access tokens
if those can't be derived from the shell environment. Echoing is
turned off for better privacy.

Instead of having to interactively type the token or manually paste it
from the clipboard, users can also pipe it to Flux which comes in
handy e.g. when executing Flux remotely over an SSH connection:

```
$ echo 'asdf' | flux bootstrap github
```

Otherwise, Flux will prompt the user:

```
$ flux bootstrap github
Please type your GitHub personal access token:
```

closes #2011

Signed-off-by: Max Jonas Werner <mail@makk.es>
3 years ago
Dmitry Rybin 7f425efa6b chore: remove deprecated io/ioutil
Signed-off-by: Dmitry Rybin <ayrowa@yandex.ru>
4 years ago
Claudia Beresford 87e11ed653 Switch StringArrayVar flags to use StringSliceVar
StringSliceVar allows for more flexibility when passing vars to list
flags.
Both formats will be supported:
- '--foo=one --foo=two'
- '--foo=one,two'

Signed-off-by: Claudia Beresford <claudiaberesford@gmail.com>
4 years ago
Hidde Beydals b6d349da8c Put potentially destructive reconcile behind flag
The behavior introduced during the introduction of go-git-providers
was more strict, and has proven pretty quickly to not be useful to
all users. Therefore, the reconciliation behavior for repository
configuration has been put behind an opt-in flag, so that it does
not overwrite people their configs by accident.

Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Hidde Beydals f123b9d3cb Change private flag description
To highlight the fact that it configures the repository as defined,
which was not _really_ clear to some users and has resulted in public
repositories accidentally being changed to private (losing important
goodies like stars and linked forks).

Discussion on this is ongoing and there will likely be other
improvements in the near future to protect users against this.

Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Hidde Beydals e0dd12505f Normalize paths to forward slashes
Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Stefan Prodan b872e595ae
Add recurse submodules arg to bootstrap cmd
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
4 years ago
Hidde Beydals e65a5beaae Work around custom client domain issue
With this commit comes a lot of evil.

Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Hidde Beydals ef576128e3 Use correct hostname argument for secret gen
Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Hidde Beydals 7f0bc2ada2 Provide option to add appendix to commit messages
Using the `--commit-message-appendix` flag a string can be added to the
commit messages made by the bootstrapper process to for example skip CI
actions from executing using e.g. `[skip ci]`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Hidde Beydals f57ce14754 Implement `bootstrap` package in commands
This includes making a lot of things configurable (e.g. SSH key
algorithm, RSA bit size, etc.) that used to be static.

Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Hidde Beydals 236ffd1767 Tidy up command descriptions
Rewordings and removal of superfluous newlines.

Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Hidde Beydals dc6b0d0f0d Use Host from parsed URL instead of Hostname
Regression bug introduced in #1001.

Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Hidde Beydals 8a5bba80bf Add `sourcesecret` and `kustomization` manifestgen
This includes a change to the `sync` generator to make the deploy
secret name configurable.

Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Michael Bridgen bc45a79b92 Give more explanation for --personal flag
Signed-off-by: Michael Bridgen <michael@weave.works>
4 years ago
Stefan Prodan bc9cbc387c
Add flux version to bootstrap commit messages
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
4 years ago
Somtochi Onyekwere a7586e69fd Refactor cmd global variables into structs
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
4 years ago
Somtochi Onyekwere 406601eead Update pkg/git to v0.2.2
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
4 years ago
Philip Laine d236a9af57 Add git implementation to generate sync options
Signed-off-by: Philip Laine <philip.laine@gmail.com>
4 years ago
Somtochi Onyekwere 4fcf93306a Gets actual path for owner
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
4 years ago
Somtochi Onyekwere 3a4a2002d4 Corrects typo
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
4 years ago
Somtochi Onyekwere b8d4af5538 Inform user of path being used
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
4 years ago
Somtochi Onyekwere 0646538cef Checks if bootstrap path differs
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
4 years ago
Somtochi Onyekwere 61129c6b6a Coverts backward slash to forward slash in path flag
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
4 years ago
Somtochi Onyekwere f1cfae8f26 Validates project name for gitlab
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
4 years ago
Hidde Beydals 5ea4e814f5 Add safe guards for relative paths
This commit adds multiple safe guards for relative paths, ensuring they
never traverse outside the working directory.

The `SafeRelativePath` flag calculates the safe relative path based on a
relative base dir, which results in a flattened path.

The write methods of `manifestgen` make use of the `SecureJoin` as well,
to ensure writes are never outside of the given directory when used as
a lib outside of the CLI.

Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Michael Bridgen 4abe69f90a Give flux bootstrap the extra components flag
This commit adds a flag for supplying extra components to bootstrap
(and its subcommands), to match the one for `flux install`.

Since the bootstrapComponents global is used in a few places, I made
it a func and renamed the variable. For consistency, I also renamed
the var used in install.go.

Lastly, so that the flag sorts next to `--components`, I changed it to
`--components-extra` in both commands.

Signed-off-by: Michael Bridgen <michael@weave.works>
4 years ago
Stefan Prodan 7792cd6a10
Add token authentication option to bootstrap
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
4 years ago
Sylvain Rabot 78d7dca985
Add a --context option
Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
4 years ago
Hidde Beydals 0bf52f4746 Change `fluxcd/toolkit` to `fluxcd/flux2`
Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Hidde Beydals e2752e4508 Rename `gotk` binary to `flux`
Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago