Commit Graph

779 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
9407e26433 Merge pull request #5155 from ephesused/eliminate-unnecessary-rnode
perf: eliminate unnecessary RNode creation
2023-05-09 15:27:55 -07:00
Katrina Verey
96f893f350 Move inactive contributors to emeritus 2023-05-02 17:47:32 -04:00
Ed Overton
97c8cd7d1a perf: eliminate unnecessary RNode creation 2023-05-02 13:15:01 -04:00
Simon Bein
c79916b1ba Add DeepCopy for ResourceMeta and ObjectMeta 2023-04-24 20:19:33 +02:00
Yutaro
42bf3c0e2b prevent all uses of YAML aliases from being overwritten by a transformer (#5096)
* return copied Node

* add a test case about imageTagTransformer for anchor scenario

* add TestPatchTransformerAnchor

* TestReplacementTransformerAnchor
2023-03-31 16:07:50 -07:00
Ed Overton
93d7511b38 perf: optimize Gvk.ApiVersion()
Convert Gvk.ApiVersion() from using strings.Builder to raw string
concatenation. The logic in Gvk.ApiVersion() is simple enough that
raw concatenation executes quicker and consumes less memory.
2023-02-21 11:02:57 -05:00
Natasha Sarkar
1957d5c746 support for more helm template args (#4926)
* support for more helm template args

* move templateArgs and unit tests to api/types

* undo package name change

* use our own simple helm chart instead of forking one

* add argument to AsHelmArgs

* code review

* lint errors
2023-02-01 10:19:05 -08:00
Patryk Małek
f7c3fce6a5 fix(kyaml): add lock for schema related globals 2023-01-27 09:40:47 +01:00
Kubernetes Prow Robot
af9a13111b Merge pull request #4944 from ephesused/optimize-getannotations-2
Refactor mapping node traversal and optimize RNode.GetAnnotations and RNode.GetLabels
2023-01-26 12:18:25 -08:00
Brian Pursley
ace8132edc Improve panic error message to include the parse error. 2023-01-18 21:37:13 -05:00
Kubernetes Prow Robot
def01f0af8 Merge pull request #4947 from Azhovan/jabar/allow-path-starting-forward-slash
feat: Allow path starting with slash
2023-01-17 13:04:33 -08:00
Olivier Lemasle
aaf9d39975 Bump k8s.io/kube-openapi to remove archived dependency
Bump k8s.io/kube-openapi to remove archived dependency github.com/PuerkitoBio/urlesc
2023-01-13 20:50:59 +01:00
Cailyn
8ab4b8d167 remove direct dependency on github/pkg/errors (#4970) 2023-01-13 10:52:25 -08:00
Kubernetes Prow Robot
445622147f Merge pull request #4889 from fengshunli/vuln
fix: all module net and text dependent package CVE-2022-41717 and CVE-2022-32149 vulnerabilities
2023-01-09 11:45:29 -08:00
fsl
32f31c34ba fix: all module net and text dependent package CVE-2022-41717 and CVE-2022-32149 vulnerabilities
Signed-off-by: fsl <1171313930@qq.com>
2023-01-09 11:27:35 +08:00
Katrina Verey
5be179305a Update sigs.k8s.io/yaml to 1.3.0 2023-01-06 16:23:17 -05:00
Jabar Asadi
368697f8ef feat: Allow paths starting with slash 2022-12-26 17:18:08 +01:00
Ed Overton
a0e94c1642 fix: correct visitMappingNodeFields
This commit adjusts visitMappingNodeFields so that it no longer assumes
the mapping node has unique keys.
2022-12-22 11:51:15 -05:00
Ed Overton
20b0d3c7ce perf: optimize RNode GetAnnotations and GetLabels
This commit optimizes in three ways:

1. For heavily used functions, allocate memory to avoid overhead
   associated with map and array re-sizing.
2. Where appropriate, limit annotation and label retrievals to only the
   desired keys.
3. Adjust annotation and label retrieval to avoid unnecessary temporary
   object creation.
2022-12-20 17:24:35 -05:00
Ed Overton
194a017c81 refactor: single function to visit mapping node content
Refactor mapping node content traversal so that all code paths execute
through the same root function.
2022-12-20 17:21:05 -05:00
Katrina Verey
903fbb6ed2 Wildcard support for creation in ReplacementTransformer (#4886)
* Ahead-of-time wildcard path expansion solution

* Wrapped PathGetter solution

This approach doesn't work when multiple existing sequence elements
should match, i.e. because the sequence contains maps and we're
searching on a key they all contain (target all containers with a certain
image would be one use case for this). PathGetter just takes the first
match in that case, which is not what we want.

* Add creation support to PathMatcher

* Regression test for existing bug when creation is enabled and sequence query should match multiple elements

* PathMatcher Create tests and support for sequence appending

* revert hyphen append support

PathGetter treats it as meaning 'last' not 'append' and does not have test coverage for its handling of this when create is set. Semantics are dubious given that multiple Replacement fieldPaths may be specified, which would cause successive appends.

* This also provides a solution to issue 1493

* Review feedback
2022-12-06 12:40:37 -08:00
Yannis Zarkadas
a502717460 Make ordering configurable (#4019)
* api: Add new types for customizeable resource ordering

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* plugins: Implement SortOrderTransformer plugin

Implement the SortOrderTransformer plugin. This plugin allows the user
to customize the order that kustomize will output resources in.

The API for the plugin is the following:

sortOptions:
  order: legacy | fifo
  legacySortOptions:
    orderFirst:
    - {GVK}
    orderLast:
    - {GVK}

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* plugins: Add boilerplate and generate code for new SortOrderTransformer

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* build: Add option to denote if the reorder flag was set by the user

We want to take different actions if the reorder flag was set by the
user or filled by the default value. Thus, we propagate this information
from build to the krusty options.

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* api/krusty: Ensure sort ordering works with CLI flag and kustomization

Sort order can be defined in two places:
- (new) kustomization file
- (old) CLI flag
We want the kustomization file to take precedence over the CLI flag.

Eventually, we may want to move away from having a CLI flag altogether:
https://github.com/kubernetes-sigs/kustomize/issues/3947

Case 1: Sort order set in kustomization file AND in CLI flag.
Print a warning and let the kustomization file take precedence.

Case 2: Sort order set in CLI flag only or not at all.
Follow the CLI flag (defaults to legacy) and reorder at the end.

Case 3: Sort order set in kustomization file only.
Simply build the kustomization.

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* krusty: Add e2e test for SortOrderTransformer

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* plugins: Purge LegacyOrderTransformer

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* Update go.work.sum

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* review: Make review changes

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
2022-12-02 13:59:53 -08:00
Kubernetes Prow Robot
588da7e392 Merge pull request #4852 from pacoxu/psp-cleanup
remove PSP as v1.25 remove it
2022-11-30 08:44:55 -08:00
Paco Xu
37ad9b1d4e remove PSP as v1.25 remove it 2022-11-30 10:16:39 +08:00
Brian Pursley
1b7db20504 merge2: preserve explicitly set null values
Fixed bug where an explicitly set null value in yaml was
cleared, even when the patch did not operate on that field.
2022-11-26 16:33:14 -05:00
Kubernetes Prow Robot
78978723db Merge pull request #4840 from oscr/update-golangci-lint
Update golangci-lint version (1.49.0 -> 1.50.1) and enable linters: dupword and testableexamples
2022-11-17 10:36:29 -08:00
Katrina Verey
91a2c2b1a4 Update to Go 1.19 2022-11-17 12:57:17 -05:00
Kubernetes Prow Robot
e638e408b0 Merge pull request #4802 from oscr/the-the
grammar: replace all occurrences of "the the" with "the"
2022-11-16 08:22:48 -08:00
summer-dev
69435e059a Merge branch 'kubernetes-sigs:master' into update-swagto-v0.22.3 2022-11-02 09:46:51 +08:00
Oscar Utbult
e16b0f0dfc Update golangci-lint version (1.49.0 -> 1.50.1) and enable linters dupword and testableexamples 2022-10-31 19:31:56 +01:00
sun min
1252e45576 update kyaml's go.mod and go.sum 2022-10-13 09:34:45 +08:00
summer-dev
19d163ca0f update kyaml's dependency swag to v0.22.3 2022-10-12 21:30:12 +08:00
Florian Lehner
c2312c4018 kyaml/yaml: preallocate memory
Signed-off-by: Florian Lehner <dev@der-flo.net>
2022-10-06 05:38:18 +02:00
Florian Lehner
0fbaa2d0e8 kyaml/sets: preallocate memory
Signed-off-by: Florian Lehner <dev@der-flo.net>
2022-10-06 05:37:41 +02:00
yugo kobayashi
6ce230f2b2 fix testcases on runfn_test.go 2022-09-23 07:26:19 +00:00
yugo kobayashi
401cf9579c update golangci-lint v1.49.0 2022-09-22 13:24:40 +00:00
Oscar Utbult
88cf251ef7 grammar: replace all occurrences of "the the" with "the" 2022-09-17 22:28:56 +02:00
Kubernetes Prow Robot
6c587c9542 Merge pull request #4770 from jihoon-seo/220824_Fix_broken_links
Fix broken links
2022-09-09 08:49:22 -07:00
yugo kobayashi
e49bf52928 fix tests 2022-09-03 00:29:10 +00:00
yugo kobayashi
a54226e0a9 fix error handling 2022-09-03 00:29:10 +00:00
yugo kobayashi
f086269d6e be build fail when parse failed to FunctionSpec 2022-09-03 00:29:10 +00:00
yugo kobayashi
e2e9181bed add a warning to missing field in FunctionSpec 2022-09-03 00:29:10 +00:00
Natasha Sarkar
8868d91670 Revert "Load and calculate Destination of files for kustomize localize (#4652)"
This reverts commit bf17fe1d8f.
2022-08-26 13:26:23 -05:00
Kubernetes Prow Robot
2e2674fa24 Merge pull request #4727 from KnVerey/improve_fieldspec_errors
Improve invalid node kind errors
2022-08-25 12:44:07 -07:00
Jihoon Seo
170eca7c52 Fix broken links 2022-08-24 17:25:29 +09:00
Anna Song
bf17fe1d8f Load and calculate Destination of files for kustomize localize (#4652)
* Implement file localization for localize

Implement file localization for new command kustomize localize

* Patch file localization

Fix lint errors, address feedback, begin transition to file loader from
localizer

* Add Repo() to Loader

* Implement locLoader factory + cleanup

* Add domain to RepoSpec

Fix ssh relative url host parsing for non-github domain on the side

* Implement Load(), New(), Root(), Dst() for LocLoader

* Address repospec code review comments

* Address 1st round of code review feedback

* Address feedback #2

Removed localized path calculations to cover edge case and improve readability.

* Remove ldr Cleanup logging

* Address code review round #3

* Address code review feedback #4
2022-08-19 14:33:53 -07:00
Katrina Verey
f66936f6bf Internalize forked code 2022-08-17 16:09:05 -04:00
Natasha Sarkar
eb54c97947 fix leading newline issue 2022-08-17 16:09:05 -04:00
Natasha Sarkar
b84885d5c4 tests for compactSeqIndent 2022-08-17 16:09:04 -04:00
Natasha Sarkar
298d977ee7 add defaultSeqIndent method 2022-08-17 16:09:04 -04:00