-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSON support to kustomization files #1392
Conversation
I don't think this will work. |
You're right - I forgot to squash and merge in one commit that was necessary. |
Looking into the issue it appears that this is a limitation set into Go JSON/YAML parser. Javascript for example does not behave that way: const obj = JSON.parse('{"c":"1","b":"2","a":"3"}');
console.log(obj, JSON.stringify(obj)); Will produce: { c: '1', b: '2', a: '3' } '{"c":"1","b":"2","a":"3"}' A solution for this use-case may be to use forks for marshaling/marshaling JSON such as this. Since the JSON marshaling in Go sorts the properties alphabetically - it is deterministic at least. |
@srfrnk Let's add the support for reading from and writing to |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: srfrnk The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@Liujingfang1 I have added the comment into the FAQ: commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not adding kustomization.json
to every place of kustomization.yaml
is present. You can add explanation of the accepted file names only at one place, maybe in the FAQ doc where you add Order and formatting changed when using a JSON kustomization file
. For other places, let's just use kustomization.yaml
.
docs/FAQ.md
Outdated
@@ -33,13 +33,13 @@ kustomize build --load_restrictor none $target | |||
|
|||
Example: [#1319](https://github.com/kubernetes-sigs/kustomize/issues/1319), [#1322](https://github.com/kubernetes-sigs/kustomize/issues/1322), [#1347](https://github.com/kubernetes-sigs/kustomize/issues/1347) and etc. | |||
|
|||
The fields transformed by kustomize is configured explicitly in [defaultconfig](https://github.com/kubernetes-sigs/kustomize/tree/master/pkg/transformers/config/defaultconfig). The configuration itself can be customized by including `configurations` in `kustomization.yaml`, e.g. | |||
The fields transformed by kustomize is configured explicitly in [defaultconfig](https://github.com/kubernetes-sigs/kustomize/tree/master/pkg/transformers/config/defaultconfig). The configuration itself can be customized by including `configurations` in `kustomization.yaml`/`kustomization.json`, e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not add kustomization.json
here since we don't have the same level support for it.
docs/fields.md
Outdated
@@ -1,6 +1,6 @@ | |||
# Kustomization File Fields | |||
|
|||
An explanation of the fields in a [kustomization.yaml](glossary.md#kustomization) file. | |||
An explanation of the fields in a [kustomization.yaml/json](glossary.md#kustomization) file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not add kustomization.json here since all the following fields are in yaml format.
docs/fields.md
Outdated
@@ -401,7 +401,7 @@ field. | |||
Directory specification can be relative, absolute, | |||
or part of a URL. URL specifications should | |||
follow the [hashicorp URL] format. The directory | |||
must contain a `kustomization.yaml` file. | |||
must contain a `kustomization.yaml` / `kustomization.json` file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not add kustomization.json
here since we didn't do that for other accepted files like kustomization.yml, kustomization.
|
||
// Remove `kind` and `apiVersion` so as make minimal changes to original source file: | ||
delete(k, "kind") | ||
delete(k, "apiVersion") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the original file contains kind
and apiVersion
, this will also remove them.
Let's not delete those two fields.
docs/glossary.md
Outdated
@@ -152,16 +152,16 @@ test or deploy) when that truth changes. | |||
## kustomization | |||
|
|||
The term _kustomization_ refers to a | |||
`kustomization.yaml` file, or more generally to a | |||
`kustomization.yaml` / `kustomization.json` file, or more generally to a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not add kustomization.json
to this doc, since we didn't do that for kustomization.yml
or kustomization
.
d70ebac
to
3d07892
Compare
Removed the second commit. Only the FAQ comment is added. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
it looks like this PR was never updated to handle the Feel free to reopen, but the bar here has to be high. It's not just about being able to load a json file. |
This allows you to use kustomization.json files.