Commit Graph

636 Commits

Author SHA1 Message Date
koba1t
8eacab0fc6 Update kyaml to v0.17.2 2024-07-20 00:28:06 +09:00
koba1t
226d56b5cf Back to development mode; unpin the modules 2024-05-23 00:35:50 +09:00
koba1t
a34ac31a80 Update api to v0.17.2 2024-05-23 00:04:13 +09:00
koba1t
7424956ccf Update kyaml to v0.17.1 2024-05-22 23:24:23 +09:00
koba1t
72d95b5f41 chore: restore version for github.com/asaskevich/govalidator 2024-04-25 17:21:05 +09: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
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
e20e438d05 Update api to v0.17.1 2024-04-05 02:01:10 +09:00
koba1t
08d0593c3e unpin api 2024-04-05 00:45:41 +09:00
koba1t
e862612703 Update api to v0.17.0 2024-04-04 22:45:14 +09:00
koba1t
10c292f501 Update kyaml to v0.17.0 2024-04-04 21:59:50 +09: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
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
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
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
Krzysztof Gibuła
d73f0fd097 add test for values merge replace 2024-01-29 22:06:36 +01: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
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
c259c478e5 Update api to v0.16.0 2023-12-07 19:30:36 +09:00
koba1t
71f6f4c7d7 Update kyaml to v0.16.0 2023-12-07 19:00:00 +09: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
Arthur Outhenin-Chalandre
790ca0e7b6 helm: add kube-version and api-versions on CLI args
It makes sense to add that as a CLI args since you could use one single
kustomization file/helm chart for multiple clusters. Also it's easier to
have those on the CLI if the user has some kind of tooling that will end
up calling kustomize and that could pass those (i.e.: ArgoCD is doing
that for Helm so it could do that for Kustomize as well that will end up
calling Helm as well).

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@ledger.fr>
2023-11-02 16:46:41 +01:00
Ardika Bagus
6640f8799e test: add Kustomize test case for multiple helm charts with different version
Signed-off-by: Ardika Bagus <me@ardikabs.com>
2023-11-02 06:27:39 +07:00
Ardika Bagus
790dbf0fdf chore: rename chart and test case with clear intention 2023-11-02 06:23:50 +07:00
Ardika Bagus
b7b85b10fc chore: remove unnecessary code, and using testdata instead of inline
Signed-off-by: Ardika Bagus <me@ardikabs.com>
2023-11-02 06:23:50 +07:00
Ardika Bagus
5505af439a chore: fix lint, assert with required 2023-11-02 06:22:11 +07:00
Ardika Bagus
cc35d3c4e5 fix: fix while using local charts with version
fix https://github.com/kubernetes-sigs/kustomize/issues/5163

Signed-off-by: Ardika Bagus <me@ardikabs.com>
2023-11-02 06:22:11 +07:00
Dustin Lish
a0f131cf86 Fix using same helm chart with different versions (#4999)
* Fix using same helm chart with different versions

* Fix p.ValuesFile when version is set

* Updated: Fix using same helm chart with different versions

* Add test for issue #4813

* Use if/else for readability, add version check to absChartHome
2023-11-02 06:22:11 +07:00
Prashant Rewar
2ab117166f replace gopkg.in/yaml.v2 with sigs.k8s.io/yaml/goyaml.v2
Signed-off-by: Prashant Rewar <108176843+prashantrewar@users.noreply.github.com>
2023-11-01 14:40:41 +05:30
Carl Henrik Lunde
5c7f8b8d73 perf: improve applyOrdering by avoid call to GetByCurrentId
This shaves of 14 seconds (one third) of the execution time for a
kustomization tree with 4000 documents, from 40.68s to 27.41s

            0     0%  5.44%     18.42s 40.56%  sigs.k8s.io/kustomize/api/krusty.(*Kustomizer).applySortOrder
            0     0%  5.44%     18.40s 40.52%  sigs.k8s.io/kustomize/api/internal/builtins.applyOrdering
before

    (pprof) top20 -cum
    Showing nodes accounting for 5.85s, 12.88% of 45.41s total
    Dropped 622 nodes (cum <= 0.23s)
    Showing top 20 nodes out of 157
        flat  flat%   sum%        cum   cum%
            0     0%     0%     40.68s 89.58%  github.com/spf13/cobra.(*Command).Execute
            0     0%     0%     40.68s 89.58%  github.com/spf13/cobra.(*Command).ExecuteC
            0     0%     0%     40.68s 89.58%  github.com/spf13/cobra.(*Command).execute
            0     0%     0%     40.68s 89.58%  main.main
            0     0%     0%     40.68s 89.58%  runtime.main
            0     0%     0%     40.68s 89.58%  sigs.k8s.io/kustomize/kustomize/v5/commands/build.NewCmdBuild.func1
            0     0%     0%     40.12s 88.35%  sigs.k8s.io/kustomize/api/krusty.(*Kustomizer).Run
        0.51s  1.12%  1.12%     33.20s 73.11%  sigs.k8s.io/kustomize/api/resource.(*Resource).CurId
            0     0%  1.12%     26.95s 59.35%  sigs.k8s.io/kustomize/api/resmap.(*resWrangler).GetMatchingResourcesByCurrentId
        0.35s  0.77%  1.89%     26.95s 59.35%  sigs.k8s.io/kustomize/api/resmap.(*resWrangler).filteredById
        0.07s  0.15%  2.05%     25.53s 56.22%  sigs.k8s.io/kustomize/api/resmap.GetCurrentId
            0     0%  2.05%     21.68s 47.74%  sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).MakeCustomizedResMap (inline)
            0     0%  2.05%     21.68s 47.74%  sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).makeCustomizedResMap
        0.54s  1.19%  3.24%     19.75s 43.49%  sigs.k8s.io/kustomize/api/resource.(*Resource).GetGvk (inline)
            1s  2.20%  5.44%     19.21s 42.30%  sigs.k8s.io/kustomize/kyaml/resid.GvkFromNode
            0     0%  5.44%     18.42s 40.56%  sigs.k8s.io/kustomize/api/internal/builtins.(*SortOrderTransformerPlugin).Transform
            0     0%  5.44%     18.42s 40.56%  sigs.k8s.io/kustomize/api/krusty.(*Kustomizer).applySortOrder
            0     0%  5.44%     18.40s 40.52%  sigs.k8s.io/kustomize/api/internal/builtins.applyOrdering
        0.87s  1.92%  7.36%     16.55s 36.45%  sigs.k8s.io/kustomize/kyaml/yaml.visitMappingNodeFields
        2.51s  5.53% 12.88%     15.68s 34.53%  sigs.k8s.io/kustomize/kyaml/yaml.visitFieldsWhileTrue

after

    (pprof) top20 -cum
    Showing nodes accounting for 1.23s, 3.85% of 31.98s total
    Dropped 584 nodes (cum <= 0.16s)
    Showing top 20 nodes out of 184
        flat  flat%   sum%        cum   cum%
            0     0%     0%     27.41s 85.71%  github.com/spf13/cobra.(*Command).Execute
            0     0%     0%     27.41s 85.71%  github.com/spf13/cobra.(*Command).ExecuteC
            0     0%     0%     27.41s 85.71%  github.com/spf13/cobra.(*Command).execute
            0     0%     0%     27.41s 85.71%  main.main
            0     0%     0%     27.41s 85.71%  runtime.main
            0     0%     0%     27.41s 85.71%  sigs.k8s.io/kustomize/kustomize/v5/commands/build.NewCmdBuild.func1
            0     0%     0%     26.85s 83.96%  sigs.k8s.io/kustomize/api/krusty.(*Kustomizer).Run
            0     0%     0%     22.07s 69.01%  sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).MakeCustomizedResMap (inline)
            0     0%     0%     22.07s 69.01%  sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).makeCustomizedResMap
        0.38s  1.19%  1.19%     20.69s 64.70%  sigs.k8s.io/kustomize/api/resource.(*Resource).CurId
            0     0%  1.19%     13.64s 42.65%  sigs.k8s.io/kustomize/api/resmap.(*resWrangler).Append
            0     0%  1.19%     13.55s 42.37%  sigs.k8s.io/kustomize/api/resmap.(*resWrangler).GetMatchingResourcesByCurrentId (inline)
        0.12s  0.38%  1.56%     13.55s 42.37%  sigs.k8s.io/kustomize/api/resmap.(*resWrangler).filteredById
        0.01s 0.031%  1.59%     12.67s 39.62%  sigs.k8s.io/kustomize/api/resmap.GetCurrentId
        0.21s  0.66%  2.25%     12.49s 39.06%  sigs.k8s.io/kustomize/api/resource.(*Resource).GetGvk (inline)
        0.51s  1.59%  3.85%     12.28s 38.40%  sigs.k8s.io/kustomize/kyaml/resid.GvkFromNode
            0     0%  3.85%     11.52s 36.02%  sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).IgnoreLocal
            0     0%  3.85%     10.53s 32.93%  sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).AccumulateTarget
            0     0%  3.85%     10.53s 32.93%  sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).accumulateResources
            0     0%  3.85%     10.53s 32.93%  sigs.k8s.io/kustomize/api/internal/target.(*KustTarget).accumulateTarget
2023-10-30 22:31:52 +01:00
Sylvain Rabot
b1f100e3da Run go work sync and go mod tidy
```shell
go work sync
for i in $(find . -name go.mod); do (cd $(dirname $i); go mod tidy); done
```

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
2023-10-28 13:05:11 +02:00
Natasha Sarkar
96ad106ee1 Use upstream go-yaml fork and remove our internal one (#5412)
* test new yaml fork

* delete old kyaml fork

* update to sigs yaml 1.4.0

* remove comments
2023-10-25 19:48:22 +02:00
koba1t
0465637335 Back to development mode; unpin the modules 2023-10-20 05:30:43 +09:00
koba1t
16395012d1 Update api to v0.15.0 2023-10-20 02:36:50 +09:00
koba1t
8668b74622 Update kyaml to v0.15.0 2023-10-20 01:07:49 +09:00
Jan-Otto Kröpke
d64ac13447 kustomize: Add support for OCI based helm repos (#5167)
* kustomize: Add support for OCI based helm repos

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* Update api/internal/builtins/HelmChartInflationGenerator.go

* Update plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go

* go fmt

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* s/expectedHelmExternalDns/expectedHelmExternalDNS

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* commit

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* commit with content

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>

* Apply suggestions from maintainer

* go work sync

* added test

---------

Signed-off-by: Jan-Otto Kröpke <joe@cloudeteer.de>
2023-10-17 21:24:00 +02:00
Kazuki Suda
f5ca753377 Update imdario/mergo to v0.3.13
Co-authored-by: Krzysztof Gibuła <krzysztof.gibula@gmail.com>
Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>
2023-09-24 16:34:45 +09:00
Kazuki Suda
0d4849ff98 Add a test case for issue 4905
```
===== ACTUAL BEGIN ========================================
apiVersion: v1
data:
  config.yaml: "null"
kind: ConfigMap
metadata:
  name: issue4905
===== ACTUAL END ==========================================
   EXPECTED              ACTUAL
   --------              ------
   apiVersion: v1        apiVersion: v1
   data:                 data:
X    config.yaml: |-       config.yaml: "null"
X      item1: 1          kind: ConfigMap
X      item2: 2          metadata:
X  kind: ConfigMap         name: issue4905
X  metadata:
X    name: issue4905
    hasgett.go:22: Expected not equal to actual
--- FAIL: TestHelmChartInflationGeneratorIssue4905 (0.24s)
```

Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>
2023-09-24 16:33:43 +09:00
yugo kobayashi
59696d1ace fix a patch files accept multiple patches (#5194)
* fix a patch files accept multiple patches

* fix comments and variable name

* add error handling when using not allowed multiple strategic-merge patches

* fix error message of Multiple Strategic-Merge Patch file

* refactor transformStrategicMerge()

* add TODO comment and test for Multiple JSON patch Yaml documents are not allowed

* refactoring PatchTransformer

* add multiple patch test for PatchTransformer package

* improve error message to PatchTransformer

* refactor const and error message check

* fix some error messages
2023-09-15 16:20:13 -07:00
Stephen Kitt
b692e49b1e Switch to json-patch v5
json-patch was bumped to v5 in k/k as a result of
https://github.com/kubernetes/kubernetes/pull/118384; this aligns with
that, but switches to the v5 module, which is documented as
gopkg.in/evanphx/json-patch.v5.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-08-26 08:42:07 +02:00
natasha41575
ff75dd6cd5 release cleanup 2023-07-31 12:27:44 -05:00
natasha41575
5ce14e5024 pin to cmd/config and api 2023-07-31 11:28:25 -05:00
natasha41575
4a893ce8c6 pin to kyaml 2023-07-31 11:08:00 -05:00
natasha41575
eeff67d88d unpin everything 2023-06-19 12:05:59 -05:00