Commit Graph

378 Commits

Author SHA1 Message Date
Cailyn Edwards
90281a62e0 Make TestResourcesRepoNotFile Less Specific 2023-01-26 16:39:30 -05:00
Anna Song
fb294921f5 Localize helm fields (#4978)
* Localize helm fields

* Address readability feedback

* Handle edge cases

* Improve readability

Split copyChartHome and use existence to prevent repeated copying.
2023-01-26 12:56:26 -08:00
Katrina Verey
d315600e5e remove redundant type meta in tests 2023-01-24 17:59:36 -05:00
Kubernetes Prow Robot
8f75682b9c Merge pull request #4834 from elisshafer/generators/retain_disable_suffix_hash
api/resource: retain disableNameSuffixHash on merge and replace
2023-01-24 09:50:19 -08:00
Kubernetes Prow Robot
0a1aa7c2cb Merge pull request #4985 from KnVerey/repospec-git-suffix
Proposal: Remove RepoSpec manipulation of .git suffix
2023-01-20 13:16:01 -08:00
Kubernetes Prow Robot
89d3ca1757 Merge pull request #4973 from KnVerey/remove-inventory-field
Remove long-ignored Inventory field from Kustomization type
2023-01-20 13:15:53 -08:00
Katrina Verey
7e000aa820 Remove manipulation of .git suffix, which is just a conventional part of the directory name 2023-01-17 23:04:16 -05:00
Kubernetes Prow Robot
dbc11a43a8 Merge pull request #4983 from KnVerey/repospec_separators
Refactor parseGitURL
2023-01-17 17:22:34 -08:00
Kubernetes Prow Robot
ec4d1e802b Merge pull request #4974 from annasong20/expose-localize-test-helpers
Expose localize test helpers
2023-01-17 12:28:41 -08:00
Katrina Verey
00208394d6 Refactor parseGitURL to consolidate code paths, improve error handling 2023-01-16 20:36:19 -05:00
Katrina Verey
d70315fed6 Remove Inventory field from Kustomization
This field has not done anything since v3.5.5. It was missed in the cleanup in https://github.com/kubernetes-sigs/kustomize/pull/2421
2023-01-12 19:11:44 -05:00
Anna Song
dc34520ac1 Expose localizer test helpers
Expose helpers for later use by localize command handle tests
2023-01-12 10:14:44 -08:00
Kubernetes Prow Robot
c6ca3ff799 Merge pull request #4929 from koba1t/refactor/cleanup_Unmarshal_kustomization
Error on duplicate fields in Kustomization
2023-01-06 10:37:59 -08:00
koba1t
6489e35b7c improve error messages 2023-01-07 03:30:16 +09:00
Anna Song
06da3b96a2 Localize resources (#4912)
* Localize resources

* Improve readability

* Add integration tests

* Group test helper functions
2023-01-05 08:47:59 -08:00
Anna Song
de6162625f Localize fields: openapi, configurations, crds (#4907)
* Localize openapi, configurations, crds

* Add integration test

* Move krusty test

* Address code review feedback
2022-12-22 12:07:26 -08:00
yugo kobayashi
5fed0f76c8 refactor Unmarshal Kustomization struct code 2022-12-13 21:04:50 +00:00
Eli Shafer
2d854c46dd resource/api: update test to use a more specific kustomization 2022-12-11 22:58:41 -08:00
Eli Shafer
24bf1d07e7 api/resource: add new test for inline options. 2022-12-07 22:18:37 -08:00
Eli Shafer
487703ee8f api/resource: retain disableNameSuffixHash on merge. 2022-12-07 22:18:37 -08:00
Natasha Sarkar
2db573b6a0 drop support for legacy patches (#4911)
* drop support for legacy patches

* fix CI
2022-12-07 18:06:24 -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
Katrina Verey
fb0f567b63 Remove local-only resources at the last minute
This allows name references to them to be correctly resolved
2022-11-29 19:05:16 -05:00
Natasha Sarkar
997e6fcc63 fix TestRemoteLoad_LocalProtocol (#4844)
* remote load test fix

* fix spacing
2022-10-31 10:58:44 -07:00
Ahmed AbouZaid
3e447da6ef proposal v2.1 2022-10-22 03:16:41 +02:00
Ahmed AbouZaid
1b1e6ccab0 Test transformers krm exec function 2022-10-22 03:16:41 +02:00
Kubernetes Prow Robot
bf7a0f9004 Merge pull request #4805 from aibarbetta/fix-4717
[address #4717] Re-do create template/metadata when using includeTemplates if not present
2022-10-11 09:23:02 -07:00
Agustina Barbetta
7b84613ad1 Use fewer labels to ease reading 2022-10-08 20:38:44 -03:00
Agustina Barbetta
acba8fff62 Update api/krusty/inlinelabels_test.go
Co-authored-by: Katrina Verey <kn.verey@gmail.com>
2022-10-08 20:18:57 -03:00
Kubernetes Prow Robot
9ef7ba9c95 Merge pull request #4663 from johnmanjiro13/handle-error-of-remove-annotation
fix: handle error of remove annotations
2022-10-07 08:19:53 -07:00
johnmanjiro13
4e7f4bce7b feat: Wrap error 2022-10-07 18:14:59 +09:00
Agustina Barbetta
344b257c1f add tests for other kinds 2022-09-23 15:54:25 -03:00
yugo kobayashi
401cf9579c update golangci-lint v1.49.0 2022-09-22 13:24:40 +00:00
Agustina Barbetta
662ccf1915 add test for resources with no template 2022-09-20 13:29:38 -03:00
Yunchi Luo
e62480d11c Rewrite remoteload_test integration tests (#4783)
* Better error message when git clone fails

* support file:// URLs

* rewrite remoteload_test

* lint and test fix

* fixes for kverey's comments

* document file:// remote load

* replace assert with require where appropriate

* add tests for file:// without git suffix

* fixes plus pr review from natasha

* fixes for review, lint

* revert changes to error handling

* fix skipped test
2022-09-19 09:13:18 -07:00
Anna Song
eb51117adf Fix flaky
Disable submodules and increase timeout to prevent `localize` test that uses testdata from flaking.
2022-09-15 18:05:25 -07:00
johnmanjiro13
a8c0be49ae fix: handle error of remove annotations 2022-09-05 16:27:59 +09:00
yugo kobayashi
a54226e0a9 fix error handling 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
b6fae2a959 Merge pull request #4759 from mightyguava/enable-ssh-tests
Enable SSH tests
2022-08-26 09:14:25 -07:00
natasha41575
08918ea352 run openapi tests with other krusty tests 2022-08-26 09:01:44 -05:00
Yunchi Luo
5dcbd35e40 Enable SSH tests 2022-08-25 16:57:21 -04: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
f6b72077c8 Stop using deprecated ioutil functions 2022-08-10 18:22:46 -04:00
Katrina Verey
5762794793 Revert "[address #4717] create template/metadata when using includeTemplates if not present" 2022-08-10 14:06:33 -04:00
Agustina Barbetta
15545cc228 create template/metadata in includeTemplates if not present 2022-08-07 20:48:51 -03:00
Natasha Sarkar
1b0fe2a078 update openapi scripts to fetch protobuffer schemas (#4582)
* update openapi scripts to fetch protobuffer schema

* code review

* code review

* restore makeOpenApiInfoDotGo.sh

* code review
2022-08-05 15:00:32 -07:00
Kubernetes Prow Robot
0fce7d53a9 Merge pull request #4703 from KnVerey/name-ref-annotations
Fix NameReference transformer handling of self-references in annotations
2022-07-11 17:22:50 -07:00
Katrina Verey
68780b4c0c Fix flakey test 2022-07-11 20:03:13 -04:00
Katrina Verey
04e1663b70 appendCsVAnnotation must mutate the annotations RNode in place
Otherwise, it is incompatible with filters like fieldSpec.Filter that recurse through a tree of RNodes. In the case of the bug this commit fixes, the leaf RNode is a metadata.annotation value field, and appendCsvAnnotation is called immediately before updating that leaf's value. If appendCsvAnnotation replaces the entire metadata.annotation RNode on the resource, the leaf RNode that gets updated is no longer attached to the resource.

Alternatively, `func (f Filter) setScalar` could be updated to change
the value of the leaf RNode BEFORE calling appendCsvAnnotation. However,
the modification of the entire metadata segment of the RNode in a
function that nominally just edits an annotation feels like a
side-effect prone to creating other difficult-to-debug situations,
beyond this ordering dependency.
2022-07-11 19:58:49 -04:00