35 Commits

Author SHA1 Message Date
5b740c45d1 Implement flux debug kustomization command
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-13 12:21:41 +02:00
120ec049f9 Implement flux debug helmrelease command
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-11 11:41:27 +02:00
8470f23ad2 Add flux create secret proxy command
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-09-27 19:11:10 +03:00
2d37544b06 Recursively build and diff Kustomizations
Signed-off-by: Boris Kreitchman <bkreitch@gmail.com>
2024-09-06 21:24:38 +03:00
493c1fbdf9 Add flux envsubst command
This command can be used to replicate the behavior of the
Flux Kustomization post-build substitutions.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-08 17:54:38 +03:00
e901e8b6f8 Update all the references of NC v1beta2 to v1beta3
Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-12-08 21:16:54 +05:30
e73d1acb20 Tweak permissions on created files
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-06 12:33:38 +01:00
f5d3283cff misc: remove unused bits of code
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-17 14:08:09 +02:00
b67a46371b misc: handle undhandled error
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-10-17 14:08:00 +02:00
42607aadc3 Add support for passing multiple objects to suspend/resume commands
This change adds support for running `suspend/resume` on multiple
supported resources at the same time. This improves the user
experience by converting

```
flux suspend ks operator && \
flux suspend ks database && \
flux suspend ks app
```

to

```
flux suspend ks operator database app
```

This works for all types of resources (Kustomizations, Sources, etc.)
since it has been implemented at the `suspend.go` and `resume.go`
level.

When the `--wait` flag is passed to the `resume` command, then Flux
will wait for all resources in parallel within a goroutine each.

Each object is only processed once, even if user provided its name
more than once.

If suspension or resuming fails for one object, it is still carried
out for the remaining objects.

As a special case, the old behaviour of `resume` is retained, i.e.
when only one object name is provided, `resume` waits for the object
to become ready even if the `--wait` flag is not provided. In all
other cases the `--wait` flag is always considered.

closes #3746
closes #3793

Co-Authored-By: Max Jonas Werner <mail@makk.es>
Signed-off-by: Rishikesh Nair <alienware505@gmail.com>
Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-06-29 08:23:13 +02:00
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>
2023-06-05 10:07:38 +02:00
52acac1a37 Add /v2 suffix to module name in preparation of 2.0.0 release
Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-04-05 16:05:21 +03:00
5dcd599612 reset cmd flags
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-12 10:49:00 +01:00
8049634e4d Add oci:// prefix
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-08-09 12:44:58 +03:00
adc7981f22 Add tests for source oci command
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-08-09 12:44:58 +03:00
e19ea796b1 Add OCI support to create source helm
closes #2774

Signed-off-by: Max Jonas Werner <mail@makk.es>
2022-06-01 15:59:52 +02:00
1fda202cf9 all: fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-03-02 19:36:08 +08:00
2c4c3fd749 test: ignore golden template files with -update
Add a template values check in the `assertGoldenTemplateFile()` function
to only update golden files if they aren't templates. A note is printed
when an update to a template golden file is needed and `-update` flag
can't update it.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-02-28 08:56:08 +05:30
edaf6ca522 Add test flag -update to update the golden files
Test flag `-update` can be used to update all the golden files whenever
the CLI output changes.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-02-24 08:58:19 +05:30
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>
2022-02-03 13:41:57 +01:00
f7d9ee90cd Add e2e tests for build/diff kustomization
Signed-off-by: Soule BA <soule@weave.works>
2022-01-20 11:51:57 +01:00
67b393ce09 Add test for create secret
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-22 12:34:36 +01:00
3d4ca831dc Add missing copyright headers
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-14 16:14:28 +03:00
8cbd4e8172 Add test for "flux create source git"
The create source tests are more interesting than the existing tests as they
create objects then wit for the flux source reconciler to complete. The tests
simulate this with a background goroutine that waits for an object to be
created then uses a test specific function to update it.

The tests set a timeout so that if there is a failure they timeout somewhat
quickly rather than hanging for a longer period of time.

Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-30 07:44:03 -07:00
e2454d91f1 Remove use of deprecated io/ioutil
Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-24 13:06:17 -07:00
d45501a129 Use shared envTest for unit tests
Speed up unit tests by using a shared envTest. This requires each
test to use its own namespace to avoid clobbering objects for
other tests. Tests previously took around 8 seconds each, and now
the initial test takes 2 seconds with follow up tests taking less
than a second each.

Also update existing tests that use a fixed namespace to use a
generated namespace.

Share gold file template function with yaml files.

Remove the testClusterMode, and instead rely on MainTest to do
the appropriate test setup and rootArgs flag setup. Move the
rootArg flag setup out of NewTestEnvKubeManager to avoid
side effects.

A follow up change can be to push the individual setups
from NewTestEnvKubeManager() into their respective TestMain since
the harness share little code.

Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-24 01:01:14 -07:00
3a3bdc62c8 Make test harness more flexible with functions
Replace the 4 arguments to cmdTestCase with a function that
can let tests run arbitrary logic if it is more complex than
what is provided by the test harness. Move the existing logic
into functions that the test can use for common assertions on
golden files and golden values.

These changes were pulled out of PR #1696 to make a smaller review.

Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-23 08:57:43 -07:00
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>
2021-08-18 18:53:53 -07:00
cc32c1be07 add e2e test for check --pre with templating support
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
2021-08-18 18:28:37 +07:00
d1982e64b2 Refactor e2e tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-17 13:55:14 +03:00
8f78263455 implement testEnv for e2e tests
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
2021-08-17 00:07:09 +07:00
c18d0b9217 Adds a watch flag to the get command
The new flag fetch and display the request ressource and then continue
watching the ressource until timeout or cancellation.

A single ressource/ressource type is supported.

Signed-off-by: Soule BA <soule@weave.works>
2021-08-06 13:44:06 +02:00
4146df1f02 Replace init() with TestMain()
Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-04 08:14:22 -07:00
8b68d7d7e2 Remove deprecated io/ioutil usage
Issue #1658

Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-04 07:46:25 -07:00
dd0f17d7a5 Refactor test helpers
- move test helpers to main
- add support for inline golden values
- add test for `flux --version`

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-04 10:47:33 +03:00