1
0
mirror of synced 2026-02-06 19:05:55 +00:00
Commit Graph

426 Commits

Author SHA1 Message Date
Stefan Prodan
80ef184b60 Add flux tree command
The `flux tree kustomization` command prints the resources reconciled by the given Kustomization.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-25 13:45:13 +03:00
Somtochi Onyekwere
67b393ce09 Add test for create secret
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-22 12:34:36 +01:00
Stefan Prodan
cd52a0eef3 Add poll interval flag to flux check cmd
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-22 09:57:54 +03:00
Stefan Prodan
77aa81a064 Add wait flag to create kustomization cmd
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-19 16:18:09 +03:00
Stefan Prodan
3d4ca831dc Add missing copyright headers
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-14 16:14:28 +03:00
Somtochi Onyekwere
4f7d89e825 Fix description for resume --all
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-13 16:25:15 +01:00
Stefan Prodan
fb713e9632 Mark the validation arg as deprecated
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-08 21:11:08 +03:00
Stefan Prodan
0b659e3f09 Update kustomize-controller API to v1beta2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-08 21:11:06 +03:00
Stefan Prodan
4c99117c7c Update Kubernetes version minimum requirements
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-08 21:10:36 +03:00
Stefan Prodan
83c3e8c2fc Replace kubectl with Go server-side apply
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-08 21:10:31 +03:00
Hidde Beydals
5249d17a95 Use proper GPG terminology
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-08 19:35:39 +02:00
Stefan Prodan
25d06a53bc Update image-reflector-controller to v0.12.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-08 19:26:31 +03:00
Somtochi Onyekwere
0beab87f5b Add gpg key path and passphrase as args
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-08 16:59:08 +01:00
Kazuki Suda
dd81ed896b Fix "get" subcommands to use stdout instead of stderr
Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>
2021-10-06 10:46:37 +09:00
Somtochi Onyekwere
3ee8747fdc Add flux version command
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-05 10:29:00 +01:00
Somtochi Onyekwere
50a1e32da3 Sort pods from each deployment to get first and ready pod
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-03 14:30:31 +01:00
Somtochi Onyekwere
d06a2936cc Better checks for reconciliation in reconcile run command
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-01 08:24:13 +01:00
Somtochi Onyekwere
a096bd2d71 Allow users to define team roles
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-09-27 21:16:12 +01:00
Somtochi Onyekwere
1849e1768a Set username when it isn't default
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-09-22 09:46:04 +01:00
Somtochi Onyekwere
68a89d3cd4 Check for nil pointer before setting createNamespace in helmrelease
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-09-21 14:37:20 +01:00
Somtochi Onyekwere
64f39e160b Check if helmRelease.Spec.Install is nil
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-09-21 11:04:21 +01:00
Max Jonas Werner
546be76f55 fix: don't set 'Install' field by default in 'create hr'
This fixes the case where you create a HelmRelease with `--export` and
the `install: {}` field being there, adding no value to the manifest.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2021-09-20 14:42:29 +02:00
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>
2021-09-18 17:27:47 +09:00
Kazuki Suda
4cc2326c7f Fix flux completion zsh to work with source only
Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>
2021-09-17 17:49:47 +09:00
Fynn Späker
18acae57bd Fix SecretRef
Signed-off-by: Fynn Späker <spaeker@23technologies.cloud>
2021-09-07 12:15:35 +02:00
Max Jonas Werner
2e6ca16a4a chore: use os.ReadFile instead of deprecated ioutil.ReadFile
Signed-off-by: Max Jonas Werner <mail@makk.es>
2021-09-03 12:20:57 +02:00
Max Jonas Werner
e98f1142a6 feat: enable bootstrap with custom CA locally
When a user provided the `--ca-file` flag to the `bootstrap` command,
the given CA file wasn't taken into account for cloning the repository
locally. It was just passed along to the CR that is created so Flux
can make use of it when cloning the repository in-cluster.

However, users may not want to add a custom CA to their local host's
trust chain and may expect the `--ca-file` flag to be respected also
for cloning the repository locally. This is what this commit
accomplishes.

closes #1775

Signed-off-by: Max Jonas Werner <mail@makk.es>
2021-09-01 15:38:53 +02:00
Allen Porter
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
Daniel Petró
c6f4d71187 Be able to create a git source without human interaction.
Signed-off-by: Daniel Petró <daniel.petro@icloud.com>
2021-08-27 13:01:35 +02:00
Tomas Tulka
54758b1692 add --since and --since-time
Signed-off-by: Tomas Tulka <tomas.tulka@gmail.com>
2021-08-25 22:10:47 +02:00
Allen Porter
e2454d91f1 Remove use of deprecated io/ioutil
Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-24 13:06:17 -07:00
Allen Porter
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
Allen Porter
11708d4189 Rename trace test golden files
Rename trace test golden files to match the convention used by other tests

Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-23 09:29:27 -07:00
Allen Porter
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
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>
2021-08-18 18:53:53 -07:00
Chanwit Kaewkasi
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
Stefan Prodan
375edffd15 Add image scanning e2e tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-17 15:15:42 +03:00
Stefan Prodan
d1982e64b2 Refactor e2e tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-17 13:55:14 +03:00
Chanwit Kaewkasi
8f78263455 implement testEnv for e2e tests
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
2021-08-17 00:07:09 +07:00
Soule BA
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
Allen Porter
4146df1f02 Replace init() with TestMain()
Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-04 08:14:22 -07:00
Allen Porter
8b68d7d7e2 Remove deprecated io/ioutil usage
Issue #1658

Signed-off-by: Allen Porter <allen@thebends.org>
2021-08-04 07:46:25 -07:00
Charles Cai
70f2b5028f feat: display success message while create secrets via flux cli.
Signed-off-by: Charles Cai <charles.cai@sap.com>
2021-08-04 21:31:57 +08:00
Hidde Beydals
9607b07e65 Request reconcile using patch instead of update
This should prevent the generation of the object getting bumped, as
observed on a GKE K8s 1.18 cluster using the  logic before this commit.

We only want to generation to increase when there are actual changes to
the `spec` of a resource, as some controllers use the `generation`
value to make assumptions about what they should do during a
reconciliation.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-08-04 13:08:36 +02:00
Stefan Prodan
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
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>
2021-08-03 06:35:13 -07:00
Dmitry Rybin
7f425efa6b chore: remove deprecated io/ioutil
Signed-off-by: Dmitry Rybin <ayrowa@yandex.ru>
2021-07-30 20:51:46 +02:00
Allen Porter
bd250c9871 Fix template optional field check in trace
Signed-off-by: Allen Porter <allen@thebends.org>
2021-07-22 20:20:21 -07:00
Allen Porter
91b3788362 Fix trace for optional GitRepository.Spec.Reference
Check for existence of GitRepository.Spec.Reference when displaying a trace to
avoid error:

✗ template: tmpl:28:21: executing "tmpl" at <.GitRepository.Spec.Reference.Tag>: nil pointer evaluating *v1beta1.GitRepositoryRef.Tag

Fixes issue #1621
Manually tested using the use cases highlighted in the issue.

Signed-off-by: Allen Porter <allen@thebends.org>
2021-07-22 20:20:21 -07:00
Chanwit Kaewkasi
d8911e0c77 add an example to the status-selector flag's description
Co-authored-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
2021-07-07 14:21:26 +07:00