Commit graph

517 commits

Author SHA1 Message Date
Florian Forster
a3fc5a92e4
flux diff artifact: Add (and fix) unit tests.
Signed-off-by: Florian Forster <fforster@gitlab.com>
2024-09-23 11:10:47 +02:00
Florian Forster
672b759f2e
flux diff artifact: Add support for the --ignore-paths flag.
Signed-off-by: Florian Forster <fforster@gitlab.com>
2024-09-23 11:10:46 +02:00
Florian Forster
72d32a248b
flux diff artifact: Compute a unified diff internally by default.
Signed-off-by: Florian Forster <fforster@gitlab.com>
2024-09-23 11:10:42 +02:00
Florian Forster
a45a0ee7c5
flux diff artifact: Use the tar.Untar() convenience function.
Signed-off-by: Florian Forster <fforster@gitlab.com>
2024-09-23 11:09:26 +02:00
Florian Forster
ba36b37ac1
flux diff artifact: Provide a non-semantic diff option.
Artifacts may contain other files types, not just YAML files, meaning the
semantic YAML diff provided by `dyff` is not a safe default.

This change implements purely textual diffing using the `diff` command line
tool. This tool can be overridden by users using the `FLUX_EXTERNAL_DIFF`
environment variable.

Users that store Kubernetes resource manifests in the artifact can re-enable
the semantic YAML diff behavior using the `--semantic-diff yaml` flag.

The arguments to the diff subcommand may be:

* A directory
* A .tar.gz or .tgz file
* An OCI url
* An individual file

The two arguments to the command are treated the same way, allowing users to
diff in either direction.

Signed-off-by: Florian Forster <fforster@gitlab.com>
2024-09-23 11:09:22 +02:00
Florian Forster
506a44d740
flux diff artifact: Use cmd.Print() instead of fmt.Print().
Signed-off-by: Florian Forster <fforster@gitlab.com>
2024-09-23 11:08:15 +02:00
Florian Forster
0a56dabf2d
flux diff artifact: Fix and document --path=- which reads from STDIN.
Signed-off-by: Florian Forster <fforster@gitlab.com>
2024-09-23 11:08:15 +02:00
Florian Forster
d28d9ff58d
Use printers.DyffPrinter to format the output.
Also updates the list of options passed to `dyff.CompareInputFiles` to be the
same as in the internal `build` package.

Signed-off-by: Florian Forster <fforster@gitlab.com>
2024-09-23 11:08:15 +02:00
Florian Forster
2c4194e0a5
flux diff artifact: Check for an expected error using errors.Is.
This fixes the `TestDiffArtifact` unit test.

Signed-off-by: Florian Forster <fforster@gitlab.com>
2024-09-23 11:08:15 +02:00
Florian Forster
72a948e8a9
flux diff artifact: Print the differences in human readable form.
I was hoping to use `flux diff artifact` as part of a CI pipeline to show the
difference between the merge request and the currently deployed artifact. The
existing implementation doesn't work for us, since it only compares the
checksums.

This commit changes the output produced by `flux diff artifact` to a list of
changes in human readable form. The code is using the `dyff` package to produce
a semantic diff of the YAML files. That means, for example, that changes in the
order of map fields are ignored, while changes in the order of lists are not.

Example output:

```
$ ./bin/flux diff artifact "oci://${IMAGE}" --path=example-service/

spec.replicas  (apps/v1/Deployment/example-service-t205j6/backend-production)
  ± value change
    - 1
    + 7

✗ "oci://registry.gitlab.com/${REDACTED}/example-service-t205j6/deploy:production" and "example-service/" differ
```

The new `--brief` / `-q` flag enables users to revert to the previous behavior
of only printing a has changed/has not changed line.

Signed-off-by: Florian Forster <fforster@gitlab.com>
2024-09-23 11:08:12 +02:00
Boris Kreitchman
2d37544b06 Recursively build and diff Kustomizations
Signed-off-by: Boris Kreitchman <bkreitch@gmail.com>
2024-09-06 21:24:38 +03:00
Jason
9af1e85b93 build(deps): bump notation-go to v1.2.1
Signed-off-by: Jason <jagoodse@microsoft.com>
2024-09-05 22:22:47 +10:00
Max Tantow
82671cfd24
tests: use tempdir to avoid manual gc
Signed-off-by: Max Tantow <max@macks.cloud>
2024-09-03 17:40:13 +02:00
Matheus Pimenta
f6a0250712 Fix reconcile helmrelease command description
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2024-08-08 00:30:38 +01:00
Viktor Nagy
fabdbaaf92 Introduce visibility flag for bootstrap gitlab
Signed-off-by: Viktor Nagy <vnagy@gitlab.com>
2024-07-17 20:22:25 +02:00
avoidalone
f42c91448d
chore: remove repetitive word
Signed-off-by: avoidalone <wuguangdong@outlook.com>
2024-06-11 23:56:04 +02:00
Soule BA
5feee5c73d
Add support for creating HR with .spec.ChartRef
Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-05-11 22:49:52 +02:00
Soule BA
0d0285ad09
Enable reconciling HelmReleases with ChartRef
If implemented HR with ChartRef can be reconciled with
`--with-source`set.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-05-11 20:55:55 +02:00
Stefan Prodan
d8e6199b2a
Set Kubernetes 1.28 as min required version
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-10 18:52:15 +03:00
Stefan Prodan
6edf2bc5a2
Update helm-controller/api to v1.0.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-10 18:29:37 +03:00
Stefan Prodan
d5aedaca7d
Update tests to GA APIs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-09 19:05:45 +03:00
Stefan Prodan
52f1ae2df7
Mark HelmRelease commands as GA
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-09 17:18:11 +03:00
Stefan Prodan
8856de1478
Update HelmRelease API to v2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-09 17:10:00 +03:00
Stefan Prodan
472396728b
Adapt HelmRelease revision to API v2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-09 16:52:23 +03:00
Max Jonas Werner
18d5ec4ecd
Add (create|delete|export) source chart commands
The `create source chart` command supports all HelmChart.spec fields
except `.valuesFiles` and `ignoreMissingValuesFiles` as these are
assumingly rarely used fields and the CLI usually only supports
commonly used ones.

closes #4760

Co-authored-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Max Jonas Werner <mail@makk.es>
2024-05-09 11:57:38 +02:00
frekw
26109ee821 Add --reproducible flag to flux push artifact
This makes the pushed artifact have the exact same hash if the contents
are the same.

E.g
```
flux push artifact oci://repo/image:tag1 --source deploy --revision="test" --path=deploy --reproducible
flux push artifact oci://repo/image:tag2 --source deploy --revision="test" --path=deploy --reproducible
```

will both result in the same sha hash, tagged with `tag1` and `tag2`.

This is useful when producing flux artifacts in a monorepo setup where
you don't want to unnecessarily push new artifacts unless something has
actually changed.

Signed-off-by: frekw <fredrik@warnsberg.se>
2024-05-08 13:30:22 +02:00
Sunny
4edc640d0c
Update image-automation-controller API to v1beta2
Signed-off-by: Sunny <github@darkowlzz.space>
2024-05-07 08:34:10 +00:00
Stefan Prodan
aae086c508
Migrate flux uninstall to Helm Source API v1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-06 15:43:10 +03:00
Stefan Prodan
e40961c6d0
Migrate flux trace to Helm Source API v1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-06 15:23:30 +03:00
Stefan Prodan
315c53a717
Migrate flux events to Helm Source API v1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-06 15:15:38 +03:00
Stefan Prodan
6baefa2586
Mark source helm commands as GA
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-06 12:50:22 +03:00
Stefan Prodan
1aaa48fa09
Update Helm Source APIs to v1 (GA)
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-06 12:28:34 +03:00
Stefan Prodan
7027e823d8
Add --ssh-hostkey-algos flag to bootstrap command
Allow configuring the list of host key algorithms to use for
SSH connections initialized by the CLI during bootstrap.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-01 13:02:50 +03:00
Jason
c49ba9d310 Add command for creating notation configuration secrets
Signed-off-by: Jason <jagoodse@microsoft.com>
2024-04-23 22:29:23 +10:00
Max Jonas Werner
1bb92548e4
Add flags for issuer/subject OCI signature verification
This change introduces two new flags to `create source oci` for
providing the values to the
`OCIRepository.spec.verify.matchOIDCIdentity.(issuer,subject)` fields.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2024-04-17 09:45:33 +02:00
toomaj
9ff9f2beba
add support for bearer token as header to bootstrap git
Signed-off-by: toomaj <toomaj@tuta.io>

Set tokenAuth to true with withBearerToken

Signed-off-by: toomaj <toomaj@tuta.io>

Set breaderToken if tokenAuth & withBearerToken were set

Signed-off-by: toomaj <toomaj@tuta.io>
2024-04-17 16:47:31 +10:00
Stefan Prodan
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
Stefan Prodan
7d52267fc4
Add --strict-substitute flag to flux build and flux diff ks commands
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-08 16:05:10 +03:00
Stefan Prodan
0672c8add2
Generate image pull secret at install
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-04-06 11:39:51 +03:00
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>
2024-04-05 16:42:15 +03:00
Rishikesh Nair
1e7dc1b392 Fix a typo in --force flag description
Signed-off-by: Rishikesh Nair <alienware505@gmail.com>
2024-02-26 20:15:30 +05:30
Stefan Prodan
5e14014e37
Update dependencies to Kubernetes v1.28.6
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-01-30 14:07:35 +02:00
Kenny Meador
933cf9db02
detect unexpected args on flux check command
Signed-off-by: Kenny Meador <kenny.meador@outlook.com>
2024-01-26 00:25:40 +02:00
Kenny Meador
1a0d931ab5
detect unexpected args in flux stats command
Signed-off-by: Kenny Meador <kenny.meador@outlook.com>
2024-01-22 19:50:51 -06:00
Kenny Meador
145fd1c2f2
Properly detect unexpected arguments
Signed-off-by: Kenny Meador <kenny.meador@outlook.com>
2024-01-21 13:06:59 -06:00
Sven Hoexter
59e5f4c887 Remove duplicate part of the reconcile hr --reset help message
Signed-off-by: Sven Hoexter <sven@stormbind.net>
2023-12-14 11:14:22 +01:00
Hidde Beydals
bf6754e20c
Properly detect unsupported API errors
This can happen when Custom Resource Definitions do not exist on the
cluster. For example, because only a subset of the Flux controllers are
installed on the cluster.

Previously, the detection was based on a combination of error type and
string matching. However, a more reliable (and maintained)
`apimeta.IsNoMatchError` checker is available upstream. Making it less
likely this suddenly stops to matching properly when Kubernetes changes
things.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-12-13 13:16:18 +01:00
Stefan Prodan
c22d8f28f9
Drop support for Kubernetes EOL versions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-12-12 16:09:54 +02:00
Stefan Prodan
2b653f9cfa
Use IsObjectNamespaced from controller-runtime
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-12-12 11:55:35 +02:00
Stefan Prodan
b4f5d121c8
Update tests to HelmRelease v2beta2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-12-12 11:40:16 +02:00