Commit Graph

27 Commits (26168b12416acf4c5cb0162831472f0a12fa5e95)

Author SHA1 Message Date
Somtochi Onyekwere 1654791feb update description of kubeconfig flags
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
1 year ago
Sanskar Jaiswal aa65589391
set controller-runtime logger to a null logger
This is required because controller-runtime expects its consumers to
set a logger through log.SetLogger within 30 seconds of the program's
initalization. If not set, the entire debug stack is printed as an
error. Ref: https://github.com/kubernetes-sigs/controller-runtime/blob/ed8be90/pkg/log/log.go#L59
Since we have our own logging and don't care about controller-runtime's
logger, we configure it's logger to do nothing.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2 years ago
Sanskar Jaiswal 97b064be13
add a preview note for all non-bootstrap commands
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2 years 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
Paulo Gomes c45536723c
add validation to namespace flag
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2 years ago
Paulo Gomes fb1de8c649
remove unused func
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2 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
Soule BA 2e9fd33ce5
Mask dockerconfigjson secret types and support StringData secrets
If implemented, flux diff kustomization will managed correctly sops
managed dockerconfigjson secrets.
Sops encrypted secret with stringData maps are supported too.

Signed-off-by: Soule BA <soule@weave.works>
3 years ago
Soule BA b86b195450
Add contextual error code for flux diff kustomization
If implemented, calling the diff command on kustomization will return 0,
1(if changes are identified), >1 for errors.

Signed-off-by: Soule BA <soule@weave.works>
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
Max Jonas Werner be1ce74dc5
fix: trim CRLF from password read from stdin
bufio's reader.ReadString includes any CRLF characters and we don't
want these in the resulting token because this leads to errors in the
authentication like this:

```
✗ failed to get Git repository
"https://github.com/kingdon-ci/jenkins-infra": Get
"https://api.github.com/repos/kingdon-ci/jenkins-infra": net/http:
invalid header field value "Bearer gho_NNNNNsecrettokenMMMMM\n" for
key Authorization
```

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
Stefan Prodan f2de7e04b8
Set default ns with FLUX_SYSTEM_NAMESPACE env var
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 years ago
Somtochi Onyekwere 67b393ce09 Add test for create secret
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
3 years ago
Stefan Prodan fb713e9632
Mark the validation arg as deprecated
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 years ago
Kazuki Suda 254cc131ae
Add dynamic completion suppport
This commit adds dynamic completion support for the following commands
and flags:

- `flux delete ...` command
- `flux export ...` command
- `flux get ...` command
- `flux reconcile ...` command
- `flux resume ...` command
- `flux suspend ...` command
- `--namespace` flag
- `--context` flag

Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>
3 years ago
Allen Porter e8d6d5fe5c Remove fakeclient and use testenv for flux cmd tests
Remove use of the fake client, and replace with a real client connected to the
testEnv.

This required fixes to the yaml files as the testEnv has stricter verifcation
of objects. This also meant it was not possible to test a GitRepository with
a missing artifact since that is not a valid state.

The tests are slower than before, taking around 7-10 seconds each because the
 testEnv is setup and destroyed for every test. These will be sped up in a
 follow up PR.

Signed-off-by: Allen Porter <allen@thebends.org>
3 years ago
Allen Porter 351d287d88 Add tests for flux trace command
Add tests for flux trace command that fake out the kubernetes client,
load objects from a yaml file and create them in the client, and
assert on the output of the trace command to an expected golden file.

This is a follow up from the suggestions in PR https://github.com/fluxcd/flux2/pull/1626 which suggested that additional
testing would be helpful. This test approach is modeled after the helm command tests.

This required some changes to the kubernetes client setup to make it
possible to use a fake. If we agree this pattern makes sense, it can be
applied to other commands.

Signed-off-by: Allen Porter <allen@thebends.org>
3 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 998f0c7d53 Add frontmatter to command documentation
Signed-off-by: Hidde Beydals <hello@hidde.co>
4 years ago
Stefan Prodan 6003d11156
Embed the install manifests in flux binary
- add make target for generating the install manifests using kustomize
- embed the generated manifests in flux binary
- the install and bootstrap commands default to using the embedded manifests
- download the install manifests from GitHub only if the install/bootstrap version arg is set

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
4 years ago
Stefan Prodan f5ae8f44b4
Refactor flux uninstall command
- deletes Flux components (deployments and services)
- deletes Flux RBAC (service accounts, cluster roles and cluster role bindings)
- removes the Kubernetes finalizers from Flux custom resources
- deletes Flux custom resource definitions and custom resources
- deletes the namespace where Flux was installed
- preserves the Kubernetes objects and Helm releases that were reconciled on the cluster by Flux

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
Hidde Beydals 88a890d717 Log to stderr
This commit refactors the `printLogger` into a `stderrLogger` that
properly logs to `os.stderr` instead of `os.stdout`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
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