* feat: minor refactoring + test improvements
* Refactor some bits of the edit add secret/configmap commands to reuse code.
* Improve test coverage for both these commands by invoking the cobra command
directly.
* Add some reusable constants for both these commands and their tests.
* fix: changes from code review
* Update formatting as requested in code review.
* Rename flagsAndArgs to configmapSecretFlagsAndArgs: change the file and struct
names to reflect the real usage of this code.
* Remove excessive newlines from the imports block.
* Replace all usages of assert with require and fix newlines in imports.
This PR intends to move the loader api to
internal. Only the necessary methods which
are needed for the api have been put into
`pkg/loader.go`.
Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
Update the comment for the newCmdRemoveConfigMap function to explain what this
function really does. The previous comment was referring to a different function.
* Incorporate feedback from reviews.
* Add extra test cases to increase coverage.
* Tiny refactors for code parity with remove configmap.
* Update copyright notice.
```
===== 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>
* 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
* Restructure existing Reference docs
Restructure Reference section for site to better match k8s.io. Change
descriptions to complete sentences. Improve instructions to locally load
site.
* Document AnnotationsTransformer on site
Dcoument AnnotationsTransformer API under Reference on site.
* Document required fields
Document required fields and explain effects of optional ones.
* Make site setup instructions more explicit
* Link required K8s fields
* test: add openapi.IsNamespaceScoped benchmark
Add a benchmark test for IsNamespaceScoped performance when the default
schema is in use.
* perf: limit initSchema calls from openapi.IsNamespaceScoped
Avoid calling initSchema from openapi.IsNamespaceScoped when possible.
Work done in #4152 introduced a precomputed namespace scope map based on
the default built-in schema. This commit extends that work by avoiding
calls to initSchema when a resource is not found in the precomputed map
and the default built-in schema is in use. In those cases, there is no
benefit to calling initSchema since the precomputed map is exactly what
will be calculated by parsing the default built-in schema.
* fix: delay parsing of default built-in schema
When namespace scope can be determined by the precomputed map but the
type is not present in the precomputed map, delay the parsing of the
default built-in schema.
If the schema to be initialized is the default built-in schema and the
type is not in the precomputed map, then the type will not be found in
the default built-in schema. There is no need to parse the default
built-in schema for that answer; its parsing may be delayed until it
is needed for some other purpose.
In cases where the schema is used solely for namespace scope checks, the
schema might not ever be parsed. Skipping the parsing reduces both
execution time and memory use.
* fix: correct openapi.go's schemaNotParsed value
openapiData initializes with defaultBuiltInSchemaParseStatus set to 0,
so schemaNotParsed should have 0 as its value.
Kind:
Refactor
Summary:
Setters functionality is provided as a KRM function. We should remove code related to setters in cmd/config and kyaml.
As of now most setters2 and setters usage are related to fork of kpt, however, these:
[fluxcd/image-automation-controller](6827808a1a/pkg/update/filter.go (L24)) with [kyml](6827808a1a/go.mod (L42))
[rancher/fleet](0a6cf6cb92/internal/cmd/controller/controllers/image/update/setters.go (L16)) with [kyaml](0a6cf6cb92/go.mod (L75))
Repositories still using them, They pinned these two into a specific kyaml version. If we decide to go for this removal then we can make a release note that this is actually removed on the next version since we already marked this as deprecated before.