46 Commits

Author SHA1 Message Date
Niklas Wagner
278dd6e55d fix: performance recession when propagating namespace to helm (#5971)
* fix: performance recession when propagating namespace to helm

* fix: handle passing namespace downstream more elegant

* Revert "fix: handle passing namespace downstream more elegant"

This reverts commit 976a7cf2aa.

* Revert "fix: performance recession when propagating namespace to helm"

This reverts commit c7612d1dba.

* fix: use annotation to identify helm chart generated resources

* fix: deduplicate code

* fix: missing import in NamespaceTransformer.go

* ci: allow manual trigger of pipeline in fork

* Revert "ci: allow manual trigger of pipeline in fork"

This reverts commit 8948788fe2.

* fix: test cases

* chore: fix code comment was on wrong line

* chore: fix code comment was on wrong line pt2
2025-09-29 14:08:19 -07:00
Niklas Wagner
9376a5c4b7 Propagate Namespace correctly to Helm 2025-07-08 19:24:46 +02:00
Davanum Srinivas
84e6594e9b Update golangci/golangci-lint to v1.56.2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-12-14 19:28:39 -05:00
Katrina Verey
a612cd2b7e Fix pluginator incompatibility with nolint lines 2022-11-30 11:22:10 -05:00
Katrina Verey
0c37ee89af Option to customize NamespaceTransfomer role binding subject handling 2022-07-27 23:12:55 -04:00
Katrina Verey
0c6e827ab8 Option to customize NamespaceTransformer overwrite behaviour (#4708)
* Option to customize NamespaceTransformer overwrite behaviour

* Code review feedback
2022-07-14 12:00:58 -07:00
monopole
5c4e363f11 Remove delegation to RNode in Resource. 2021-05-11 10:49:17 -07:00
monopole
123a5d6e56 Remove the wrappy layer. 2021-03-15 15:59:06 -07:00
Natasha Sarkar
722b0131f0 return error for duplicate keys rather than panicking 2021-03-03 12:13:24 -08:00
Natasha Sarkar
f71854a0c8 Refactored resource to store all previous names and namespaces 2021-02-03 12:01:09 -08:00
Natasha Sarkar
bd4580d73a Manage name changes (prefix/suffix) via YAML annotations rather than via in-memory-only fields. 2021-01-11 13:08:45 -08:00
monopole
614e853db3 Confine calls to ApplyToJSON. 2021-01-07 20:31:10 -08:00
Donny Xia
70dcc79bf4 cleanup namespace transformer 2020-10-22 13:18:20 -07:00
Natasha Sarkar
7c8c827a88 added IsEmpty() method 2020-09-30 12:17:14 -07:00
jregan
33e68c0f97 Removing YAMLSupport==false code path.
This continues work on the master and v3.8.* branches
to eliminate apimachinery dependence.
2020-07-10 19:06:26 -07:00
jregan
d3a7335bbc Switch namespace and patch transformers to kyaml. 2020-07-04 16:21:01 -07:00
jregan
e783af2881 Delegate to Kunstructured. 2020-06-19 15:06:13 -07:00
jregan
39cb87cf2b Define global const for metadata/namespace field 2020-05-09 18:00:26 -07:00
Phillip Wittrock
11ce0128ad NamespaceTransformer tests
Follow up items to #2288
2020-03-30 10:32:51 -07:00
Phillip Wittrock
51ba40d39b Move filltersutil serialization to kyaml 2020-03-28 10:02:15 -07:00
Phillip Wittrock
81bbd2f2e3 Enable using kyaml namespace transformer in builtin plugin 2020-03-24 20:44:28 -07:00
Michael Cook
aa46b6ec44 fix misspellings 2020-03-18 14:36:12 +01:00
Julien Poissonnier
0988f74d39 Show namespace resource on id conflict 2019-12-27 16:00:14 +01:00
Jeffrey Regan
e9ab3da164 Fix some nits in the crawler and elsewhere. 2019-12-03 10:44:44 -08:00
Jeffrey Regan
46524d3b6a Introduce API module. 2019-10-21 13:30:31 -07:00
jregan
951d15bf17 Make api/plugins 2019-10-20 15:12:13 -07:00
jregan
3af5a8afea Make resource, resmap public. 2019-10-20 10:51:20 -07:00
jregan
c90e0a4080 Drain pkg/transformers. 2019-10-20 09:19:07 -07:00
jregan
5de000ee3d Move FieldSpec to API. 2019-10-20 06:52:13 -07:00
Jeffrey Regan
e5c8b5ec8f Start api directory, which will become a module. 2019-10-17 14:01:20 -07:00
jregan
07d2500ee3 Make types package public. 2019-10-16 16:41:43 -07:00
Jeffrey Regan
41a008e9a3 Start pluglib, a set of public, plugin specific functions. 2019-10-14 19:43:55 -07:00
Jeffrey Regan
2d58f8b81c Break the dep between fs and pgmconfig. 2019-10-02 12:01:45 -07:00
Jeffrey Regan
def4f04572 Depend on new pluginator location. 2019-09-24 16:43:53 -07:00
Richard Marshall
24c173a49b Detect ID conflicts in namespace transformer 2019-08-19 08:55:54 -07:00
Jerome Brette
2faf4a491b Force the namespace value for the "default" service object.
The clusterrolebinding and rolebinding is pointing at a resource
which is not listed in the kustomize
2019-07-25 22:43:59 +00:00
Jerome Brette
f649b62629 Update Namespace and Name simultaneously (1/2)
- Removed RoleBinding and Webhook specific code in the namespacetransformer.
  That code was attempting to perform the task of the namereference
- Updated namereference transformer configuration to suppport the
  Webhooks.
- Prevent the namereference from wiping out the namespace value if
  no referral candidate was selected
- Added unit tests.
2019-07-23 11:04:52 -05:00
Jian Qiu
c912baeb3a Enable ns transformer for webhook
Add namespace transformer for ValidatingWebhookConfiguration
and MutatingWebhookConfiguration
2019-07-09 13:32:33 +08:00
Jeffrey Regan
0fe95a2f74 Add another resmap test. 2019-07-01 11:17:46 -07:00
Seth Pollack
2126b6cf23 use ObjectMeta instead of name and namespace fields 2019-06-29 23:30:50 -04:00
Jerome Brette
74f5e74b89 Consolidate IsClusterKind and IsNamespaceableKind method to avoid duplication 2019-06-25 13:46:49 -05:00
jregan
a7df00c07a Starting v3 release for plugin developers.
[doc]: https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher

Per this Go modules [doc] a repo or branch that's
already tagged v2 or higher should increment the major
version (e.g. go to v3) when releasing their first Go
module-based packages.

At the moment, the kustomize repo has these top level
packages in the sigs.k8s.io/kustomize module:

 - `cmd` - holds main program for kustomize

	 Conceivably someone can depend on this
	 package for integration tests.

 - `internal` - intentionally unreleased subpackages

 - `k8sdeps` - an adapter wrapping k8s dependencies

	 This exists only for use in pre-Go-modules kustomize-into-kubectl
	 integration and won't live much longer (as everything involved is
	 switching to Go modules).

 - `pkg` - kustomize packages for export

	 This should shrink in later versions, since
	 the surface area is too large, containing
	 sub-packages that should be in 'internal'.

 - `plugin` - holds main programs for plugins

This PR changes the top level go.mod file from

```
module sigs.k8s.io/kustomize
```

to

```
module sigs.k8s.io/kustomize/v3
```

and adjusts all import statements to
reflect the change.
2019-06-23 15:05:59 -07:00
Jeffrey Regan
2eccf67b1c Push namespace transformer code to plugin. 2019-06-19 12:57:02 -07:00
Jeffrey Regan
4bc31f4b2a Move pluginator to cmd directory. 2019-06-18 10:16:46 -07:00
Jeffrey Regan
3a01a63a01 Simplify code base.
- In ResMap, drop concept of internal Id to Resource
   map.  The ResMap is now (just) a list, allowing only
   very particular edits.

 - Resources should now be maintained in the order
   loaded.  A later PR can adjust tests to remove the
   internal legacy sorting, and confirm order-out is
   predictable from order-in.  The PR would suppress
   the sort in tests, and reorder the output to make
   all tests pass again, and confirm that the new order
   matched depth-first input traversal.  The FromMap
   fixture function was removed from all test inputs to
   establish a predictable input order.

 - Resources now have two 'Ids', OriginalId and
   CurrentId.  The former is fixed as
   GVK-name-namespace at load time, the latter changes
   during transformations.  The latter can be used to
   narrow name references when the former maps to
   multiple resources.  We allow bases to be loaded
   more than once in a build (a diamond pattern), so
   the OriginalId is not unique across the resources
   set.  The CurrentId is (and must be) unique, but is
   constantly mutating.  Failing to make this
   distinction clear, and attempting to maintain a
   mapping from a single mutating Id to a resource was
   making the code too complex.

 - Drop prefix/suffix from ResId - the ResId is now
   immutable.  A later PR can remove the distinction
   with ItemId.

 - This PR increases coverage of ResMap is since this
   is a large refactor.  Higher level tests didn't need
   much change outside reordering of results at the
   resource level.
2019-06-17 10:50:45 -07:00
Jeffrey Regan
79906d73d0 Add builtin namespace transformer plugin 2019-05-21 13:56:36 -07:00