Commit Graph

1423 Commits

Author SHA1 Message Date
koba1t
7424956ccf Update kyaml to v0.17.1 2024-05-22 23:24:23 +09:00
Kubernetes Prow Robot
49a645f05d Merge pull request #5294 from typeid/localize_absolute_paths
feat: localize absolute paths
2024-04-29 22:11:47 -07:00
Tiago Silva
e7a15496dd fix: use fmt.Errorf instead of non-existing errors.New (#5651)
* fix: use fmt.Errorf ubstead if non-exising `errors.New`

When https://github.com/kubernetes-sigs/kustomize/pull/5525 merged, it
referenced `errors.New` function but that function doesn't exist.
This PR replaces the call with simple `fmt.Errorf`.

* Add lint check with kustomize_disable_go_plugin_support

* move lint-api-static to /api/Makefile

* clean golangci cache
2024-04-29 18:22:26 -07:00
Kubernetes Prow Robot
e676d056b2 Merge pull request #5500 from charles-chenzz/kust-target-tc
add testcase that check yield malformed yaml errors
2024-04-28 23:45:18 -07:00
koba1t
72d95b5f41 chore: restore version for github.com/asaskevich/govalidator 2024-04-25 17:21:05 +09:00
Mauren
671de1662d feat: support labels key in transformer configuration (#5556)
* feat: support labels key in transformer configuration

Allow the usage of a separate transformer configuration for the labels key,
similar to what is currently available for commonLabels and commonAnnotations.
This aims to provide the same functionality that commonLabels currently provide
for labels, since commonLabels is deprecated and slated for removal in a future
release.

* chore(transformerconfig): add nolint hint

Add a nolint hint to the new method so the returns can stay consistent with
one another.

* fix: changes from code review

* Rename methods `AddCommonLabelFieldSpec` and `AddLabelFieldSpec` to
  `AddCommonLabelsFieldSpec` and `AddLabelsFieldSpec`.
* Add extra test to verify scenarios applying labels to Custom Resource Definitions.
2024-04-25 00:40:44 -07:00
Mauren Berti
5d127e4138 chore(deps): bump dependencies of kustomize + sync go workspace
* Bump the golang.org/x dependencies.
* Run `go work sync` to synchronize dependencies across Go workspaces.
2024-04-21 20:03:38 -04:00
Yusuke Abe
ed09399cd1 fix: return error instead of log.Fatalf() (#5625)
* fix: return error instead of log.Fatalf()

* chore: add meaningful message to error output

* chore: add meaningful message to fatal function
2024-04-18 03:56:51 -07:00
Kubernetes Prow Robot
82ee768212 Merge pull request #5079 from chlunde/perf-1
perf: improve applyOrdering by avoid call to GetByCurrentId
2024-04-06 10:14:25 -07:00
koba1t
fb9f45ebe0 Back to development mode; unpin the modules 2024-04-05 02:24:31 +09:00
koba1t
277da9ed21 fix version subcommand is not working after release build 2024-04-05 01:37:31 +09:00
koba1t
10c292f501 Update kyaml to v0.17.0 2024-04-04 21:59:50 +09:00
Jonathan King
b3d1df2644 Fix name in a configMapRef missing hash #5047 (#5236)
* Add regression tests

* Update PrefixesSuffixesEquals function

* Try empty prefix/suffix but fall back on duplicates

* Run gofmt

* Remove newline

* Revert unnecessary gofmt change

* Add comment
2024-04-02 12:44:11 -07:00
Karl Isenberg
ed2ca23400 Pin tool versions with hack/go.mod (#5622)
* Pin tool versions with hack/go.mod

This change centralizes the tracking of versions for tools used for
development and testing. This way, the tools and all their
dependencies have their checksums stored in hack/go.sum, which
improves supply chain security.

* Workspace Sync & Tidy
2024-04-02 12:34:13 -07:00
Kubernetes Prow Robot
8fef99fa35 Merge pull request #5542 from ephesused/issue5540
fix: improve accumulation failure message
2024-03-27 10:32:54 -07:00
koba1t
91b92b52c1 remove klog/v1 dependencies due to that is in the unwanted dependencies in k/k 2024-03-28 00:30:27 +09:00
Kubernetes Prow Robot
d7e60b8451 Merge pull request #5624 from karlkfi/karl-example-500
Use a local test server instead of example.com
2024-03-27 08:28:55 -07:00
Karl Isenberg
9db92fd28d Use a local test server instead of example.com 2024-03-21 13:14:12 -07:00
Karl Isenberg
43868688d5 Use require for Error and NoError
Assert keeps going after failure, but require immediately fails
the tests, making it easier to find the output related to the test
failure, rather than having to comb through a bunch of subsequent
assertion failures. For equality tests, we may or may not want to
continue, but for error checks we almost always want to immediately
fail the test. Exceptions can be changed as-needed.
2024-03-20 13:19:18 -07:00
Karl Isenberg
4dbc0d22e1 chore: Update to Go v1.21
- go mod tidy (all modules)
- go work sync
- Fixed plugin generation for Go 1.21
- Updated linting for Go 1.21
- Fixed minecraft example for Helm v3 pull download path
- Update dev docs to mention Go 1.21
- Regenerate plugins with Go 1.21
2024-03-15 11:47:44 -07:00
koba1t
d35edbf80d update dependencies google.golang.org/protobuf@v1.33.0 2024-03-14 17:27:48 +09:00
Ed Overton
14a9a9849f test: correct lint issues 2024-03-11 15:16:11 -04:00
Matthew Hughes
8aafbacd17 Fix null YAML values being replaced by "null"
Related issues:

* https://github.com/kubernetes-sigs/kustomize/issues/5031
* https://github.com/kubernetes-sigs/kustomize/issues/5171

After noting this behaviour was not present in
d89b448c74 a `git bisect` pointed to the
change 1b7db20504. The issue with that
change is that upon seeing a `null` node it would replace it with a node
whose value was equivalent but without a `!!null` tag. This meant that
one application of a patch would have the desired approach: the result
would be `null` in the output, but on a second application of a similar
patch the field would be rendered as `"null"`.

To avoid this, define a new attribute on `RNode`s that is checked before
clearing any node we should keep. The added
`TestApplySmPatch_Idempotency` test verifies this behaviour.

See also https://github.com/kubernetes-sigs/kustomize/pull/5365 for an
alternative approach
2024-03-09 17:31:35 +00:00
Ed Overton
4da880d6cb Merge remote-tracking branch 'origin/master' into issue5540 2024-03-08 14:48:51 -05:00
Ed Overton
62eca858f3 test: add test for issue 5440 2024-03-08 14:33:09 -05:00
Tiago Silva
33caee50cb Allow importing kustomize API's without relying on plugins (#5525)
* Allow importing kustomize API's without relying on `plugins`

Introduce `kustomize_disable_go_plugin_support` go build tag to decouple the kustomize
API from the `plugins` package dependency. This is advantageous for applications
embedding the kusstomize API without the need for dynamic Go plugins, mitigating an
increase in binary size associated with the inclusion of the plugins dependency
and the population of ELF sections like `.dynsym` and `.dynstr`.

The flag provides applications with the flexibility to exclude the import, catering to
scenarios where dynamic Go plugin support is unnecessary.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* fix golint by disabling some lint checks

* handle code review suggestions

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-02-27 08:22:51 -08:00
Kubernetes Prow Robot
db2240c9c1 Merge pull request #5541 from skitt/canonical-json-patch
Use canonical json-patch v4 import
2024-02-27 08:10:10 -08:00
koba1t
37715863f0 use Strict unmarshal when read TransformerConfig 2024-02-22 05:39:55 +09:00
Kubernetes Prow Robot
3e69c2e36a Merge pull request #5510 from andreaskaris/kustomize-env-var-max-length
Skip KUSTOMIZE_PLUGIN_CONFIG_* env variables when too large
2024-02-21 09:35:01 -08:00
Andreas Karis
17eab513e9 Skip KUSTOMIZE_PLUGIN_CONFIG_* env variables when too large
Kustomize sets the legacy KUSTOMIZE_PLUGIN_CONFIG_STRING and
KUSTOMIZE_PLUGIN_CONFIG_ROOT environment variables. When these
environment variables exceed a hardcoded length (PAGE_SIZE * 32 on most
Linux systems), the kernel will return `argument list too long`. Given
that the environment variables are legacy, log a warning and do not set
them if they exceed 131071 bytes.

Reported-at: https://github.com/kubernetes-sigs/kustomize/issues/5480
Signed-off-by: Andreas Karis <ak.karis@gmail.com>
2024-02-21 17:36:09 +01:00
Ed Overton
f80650e8ce fix: improve accumulation failure message
For accumulation errors when the file load fails due to malformed
YAML and the base load fails due to a timeout, report both errors.
Previously only the malformed YAML error was returned, masking the
git repo timeout.
2024-02-16 12:47:02 -05:00
Stephen Kitt
bcf100f592 Use canonical json-patch v4 import
The canonical import for json-patch v4 is
gopkg.in/evanphx/json-patch.v4 (see
https://github.com/evanphx/json-patch/blob/master/README.md#get-it for
reference).

Using the v4-specific path should also reduce the risk of unwanted v5
upgrade attempts (see
https://github.com/kubernetes/kubernetes/pull/120327 for context).

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-02-16 12:23:04 +01:00
Dale Haiducek
9546529f1d Include plugin stderr with wrapped error
This allows plugins to provide more details aside
from just `exit status 1` inside the error

Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
2024-02-15 09:48:21 -05:00
Krzysztof Gibuła
bf286dce76 wrap errors and add comments 2024-01-29 22:06:36 +01:00
Krzysztof Gibuła
d768fc371c replace mergo with kyaml/yaml/merge2 2024-01-29 22:06:36 +01:00
koba1t
4675bec08a add license for api/pkg/util/image/go 2024-01-29 23:18:51 +09:00
Kubernetes Prow Robot
69826668a7 Merge pull request #5234 from blackjid/bug_fix_set_image_digest_and_tag
fix edit set image to parse both tag and digest
2024-01-26 21:03:52 +01:00
Juan Ignacio Donoso
a85dfd4141 fix edit set image to parse both tag and digest 2024-01-26 16:30:41 -03:00
Kubernetes Prow Robot
abdcae870c Merge pull request #5463 from chansuke/feat/show-version
Fix version tag management
2024-01-26 20:21:29 +01:00
charles-chenzz
3f921e159b add testcase that yield malformed yaml errors 2024-01-08 19:25:04 +08:00
chansuke
cd886102a9 Fix version tag management 2023-12-15 00:32:36 +09:00
Stephen Kitt
bf485f66d3 Revert "Switch to json-patch v5"
This reverts commit b692e49b1e.

The json-patch bump in k/k was reverted, so the corresponding bump in
kustomize should be reverted too.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-12-07 18:40:29 +01:00
koba1t
8eee90d2c6 Back to development mode; unpin the modules 2023-12-07 19:56:35 +09:00
koba1t
71f6f4c7d7 Update kyaml to v0.16.0 2023-12-07 19:00:00 +09:00
Nick
f23d45fcb4 Add deprecation warning message to commonLabels (#5464)
* Add commonLabels deprecation warning message

* Add test

* Add warningToRunEditFix message
2023-11-30 17:41:43 +01:00
Claudio Busse
7b1eaf1e4f feat: localize absolute paths 2023-11-26 12:22:15 +01:00
Kubernetes Prow Robot
eb7f91ffcd Merge pull request #5270 from MrFreezeex/helm-kube-api
helm: add support for kube-version and add cli args for both kube-version and api-versions
2023-11-15 21:13:59 +01:00
Kubernetes Prow Robot
e219b8864e Merge pull request #5421 from prashantrewar/swap-yaml-library
Replace gopkg.in/yaml.v2 with sigs.k8s.io/yaml/goyaml.v2
2023-11-10 17:14:41 +01:00
Kubernetes Prow Robot
863ca93f0b Merge pull request #5364 from 0xff-dev/master
fix: goroutine leak
2023-11-10 17:14:34 +01:00
Arthur Outhenin-Chalandre
dc29923a08 helm: add tests with different kubeVersion
Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@ledger.fr>
2023-11-09 11:37:14 +01:00