Commit Graph

421 Commits (6bf439d4ce3518218b97ff6aee27a18b3ddcab21)

Author SHA1 Message Date
Max Jonas Werner cbdd71e44e
Make `flux logs` more lenient
UX changes:

- Only print an error when a pod doesn't have a matching container
  instead of exiting early.
- Return a non-zero status code when no pod is found at all.

Details:

In certain situations there might be 3rd-party pods running in the
Flux namespace that cause the command to fail streaming logs, e.g.
when they have multiple containers but none of them is called
`manager` (which all Flux-maintained pods do). An example of such a
situation is when Flux is installed with the 3rd-party Flux extension
on AKS.

The `logs` command is now more forgiving and merely logs an error in
these situations instead of completely bailing out. It still returns a
non-zero exit code.

For the parallel log streaming with `-f` the code is now a little more
complex so that errors are now written to stderr in parallel with all
other logs written to stdout. That's what `asyncCopy` is for.

refs #3944

Signed-off-by: Max Jonas Werner <mail@makk.es>
2 years 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
Somtochi Onyekwere 020a494f3f Retry oci push operations
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2 years ago
Horacio Granillo 799848c2a0 Fix break lines in create helmrelease and source
Signed-off-by: Horacio Granillo <horacio.granillo@smarttra.de>
2 years ago
Raffael Sahli b8c24f906d fix: support reconcile recursive source tree hr => chart => repo
Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
2 years ago
Raffael Sahli e678738ded feat: add reconcile source chart command
Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
2 years ago
Stefan Prodan 13ff4afaa4
Update Kubernetes to v1.27 and Kustomize to v5.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
fluxcdbot ace242fca2
Update toolkit components
- kustomize-controller to v1.0.0-rc.2
  https://github.com/fluxcd/kustomize-controller/blob/v1.0.0-rc.2/CHANGELOG.md
- source-controller to v1.0.0-rc.2
  https://github.com/fluxcd/source-controller/blob/v1.0.0-rc.2/CHANGELOG.md
- notification-controller to v1.0.0-rc.2
  https://github.com/fluxcd/notification-controller/blob/v1.0.0-rc.2/CHANGELOG.md
- image-reflector-controller to v0.27.1
  https://github.com/fluxcd/image-reflector-controller/blob/v0.27.1/CHANGELOG.md
- image-automation-controller to v0.33.0
  https://github.com/fluxcd/image-automation-controller/blob/v0.33.0/CHANGELOG.md

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
Vincent Gillet 86df468c3f Fix autocompletion for image repository reconcile
Signed-off-by: Vincent Gillet <gilletvincent@gmail.com>
2 years ago
Matheus Pimenta 56d265ae11 Add OCI provider option to create Helm source command
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2 years ago
cui fliter 3edfff49a2 fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2 years ago
Max Jonas Werner 6700aac4a4
better messaging for `pull artifact` command
- When there's an error stat'ing the output directory flux now prints
  the error:

  Before:
  ```
  ✗ invalid output path ./ro-dir/foo
  ```

  After:
  ```
  ✗ invalid output path "./ro-dir/foo": stat ./ro-dir/foo: permission denied
  ```
- When no output directory is provided flux now explicitly says so in
  the error:

  Before:
  ```
  ✗ invalid output path
  ```

  After:
  ```
  ✗ output path cannot be empty
  ```

Signed-off-by: Max Jonas Werner <mail@makk.es>
2 years ago
Somtochi Onyekwere a52f5aaa75 Add label selector flag to get cmd
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2 years ago
Soule BA b74638c25c
Add the possibility to ignore files with build and diff ks
If implemented, user will be able to ignore files when using `build
kustomization` and `diff kustomization` both with .sourceignore and
`ignore-paths` flag.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2 years ago
Stefan Prodan cecffc0588
Add commonMetadata to flux build/diff
Signed-off-by: Stefan Prodan <stefan.prodan@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
Somtochi Onyekwere e44ab85880
update testdata yamls
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2 years ago
Somtochi Onyekwere 24452ecd37
Update GitRepository Receiver, and Kustomization to v1
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2 years ago
Santosh Kaluskar 6afef04a88
Add support for create source git with --commit and --ref-name flags
Signed-off-by: Santosh Kaluskar <dtshbl@gmail.com>
2 years ago
Yiannis b55f49b4fe
fix: Remove any leading and trailing whitespace from resource before
exporting

Signed-off-by: Yiannis <yiannistri@users.noreply.github.com>
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
Matheus Pimenta c9fea671a7 Add retry interval option to create kustomization command
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2 years ago
Santosh Kaluskar 5a45d2b127
Create secret with bearer-token
Signed-off-by: Santosh Kaluskar <dtshbl@gmail.com>
2 years ago
Hidde Beydals af153ea0cf
events: avoid having to keep individal kind maps
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2 years ago
Hidde Beydals 3f3d68a33a
events: reword error messages
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2 years ago
Hidde Beydals c0916edc44
events: prevent defer in loop
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2 years ago
Hidde Beydals 34220fd514
events: make `--for` case insensitive for kinds
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2 years ago
Hidde Beydals 5b8f673baa
events: use constants for supported Flux kinds
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2 years ago
Somtochi Onyekwere 5b18289808
Add `flux events` command
This adds a command to Flux which behaves similarly as `kubectl events`,
including the Flux sources events when showing events for top level
objects, thus making debugging easy for Flux users.

For example, `flux events --for kustomization/<name>` includes the
events of its source (e.g. a `GitRepository`, `OCIRepository` or
`Bucket`).

In addition, `flux events --for helmrelease/<name>` includes events of
the `HelmChart` and `HelmRepository`. While `flux events --for
alerts/<name>` includes the events of the `Provider`.

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2 years ago
Hidde Beydals 26aafa1b6f
e2e: update podinfo to version with newer APIs
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2 years ago
Hidde Beydals 1cc7682d44
Replace `helmv2.KubeConfig` with `meta.KubeConfig`
This is a backwards compatible change in terms of "YAML API", as they
spec still equals the previous one. Object type has just changed.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2 years ago
Stefan Prodan a64913f2f0
Allow custom annotations to be set when pushing OCI artifacts
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
Stefan Prodan 7490d4d4b8
Add command to print the reconcilers status
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
Stefan Prodan b44a3d36ba
Remove deprecated flags
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
Hidde Beydals 0f7b903ace Update `push artifact`'s `--revision` to RFC-0005
Signed-off-by: Hidde Beydals <hello@hidde.co>
2 years ago
Hidde Beydals 7f99655a2b Update golden files with RFC-0005 revision formats
Signed-off-by: Hidde Beydals <hello@hidde.co>
2 years ago
Sunny 9dd98fb2b2 Update image-reflector API to v1beta2
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2 years ago
Hidde Beydals bb6a7b8f07 Support shortening of revision with digest
The `\b` in the regular expression ensures we only match with a
hexadecimal notation as awhole, while still allowing to match with
e.g. `sha1:...` which would not have been possible by using `\W`
as this includes `_`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2 years ago
Hidde Beydals 662f0d8cae tests: rename "kubectl" `setupTestNamespace`
As the other version has a different signature, but exists for a
different build tag. Resulting in my IDE becoming absolutely confused
when I tried to enable both at the same time. Opted for "exec" because
this one shells out.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2 years ago
Hidde Beydals b263e14fa8 tests: only provide template values when used
As otherwise the `.golden` values can not be automatically updated using
`-update` as documented in `CONTRIBUTING.md`.

Also ensure we do not use `defer` but rather `t.Cleanup` in tests, as
this will always be called even if e.g. `t.Fatal` absruptly stops the
test.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2 years ago
Stefan Prodan 87232fd4dd
flux tree: Set CRDs GroupKind in output
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
Stefan Prodan be154d079b
flux tree: Track CRDs managed by HelmReleases
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
Stefan Prodan 06b8ad2402
flux tree: Add namespaces to objects reconcile from HRs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
Stefan Prodan 6681cd05a9
Add example of push and sign OCI artifacts
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
Stefan Prodan 56807fddf6
Add json/yaml output to flux push artifact
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
Max Jonas Werner 0648f56049
fix misleading messaging when using `-A` flag
Before:

```
$ flux get source git -A
✗ no GitRepository objects found in flux-system namespace
```

After:

```
$ flux get source git -A
✗ no GitRepository objects found in any namespace
```

Signed-off-by: Max Jonas Werner <max@e13.dev>
2 years ago
Kingdon Barrett ddd377b997
Fix fluxcd/website#1347
Signed-off-by: Kingdon Barrett <kingdon@weave.works>
2 years ago
Stefan Prodan 9d38ea6ffc
check: Show the latest stored version of CRDs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago
fluxcdbot be361a44d5
Update toolkit components
- helm-controller to v0.28.1
  https://github.com/fluxcd/helm-controller/blob/v0.28.1/CHANGELOG.md
- notification-controller to v0.30.2
  https://github.com/fluxcd/notification-controller/blob/v0.30.2/CHANGELOG.md

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 years ago