-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Issue-4292: ConfigMaps items are generated with random order #4767
Conversation
adilfulara
commented
Aug 21, 2022
•
edited
Loading
edited
- Preserve order of keys read from KvPairSources
|
Welcome @adilfulara! |
Hi @adilfulara. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/easycla |
closes #4292 |
apologies @natasha41575 for jumping the gun and assigning the PR to your before review. I have deleted the comment. |
/ok-to-test |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: adilfulara 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 |
@adilfulara: This PR has multiple commits, and the default merge method is: merge. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
- Maintain input order of entries read from the KvPairSources Signed-off-by: Adil Fulara <adil.fulara@gmail.com>
@natasha41575 have made the changes suggested. LMK your thoughts. |
@adilfulara thanks for the fix. Unfortunately that doesn't work as expected, the final output is still with random order: $ mkdir /tmp/kustomize
$ cd /tmp/kustomize/
$ git clone https://github.com/adilfulara/kustomize.git
Cloning into 'kustomize'...
remote: Enumerating objects: 77623, done.
remote: Total 77623 (delta 0), reused 0 (delta 0), pack-reused 77623
Receiving objects: 100% (77623/77623), 90.77 MiB | 11.73 MiB/s, done.
Resolving deltas: 100% (45839/45839), done.
$ cd kustomize/
$ git checkout issue-4292
branch 'issue-4292' set up to track 'origin/issue-4292'.
Switched to a new branch 'issue-4292'
$ cd kustomize
$ go build .
$ cat >> kustomization.yaml<< EOF
configMapGenerator:
- name: test
literals:
- EE10D2E63AF9F498=foo
- FDC41072BFC0BC7F=foo
- 32E0817AE855A845=foo
- 0C6B462C403217C4=foo
- 024233B4DFB484FC=foo
- 6E7E3021F1821943=foo
- DFD86A289C3857EF=foo
EOF
$ ls -la
total 45480
drwxr-xr-x 9 user group 288 Sep 2 10:14 .
drwxr-xr-x 38 user group 1216 Sep 2 10:13 ..
lrwxr-xr-x 1 user group 22 Sep 2 10:13 Makefile -> ../Makefile-modules.mk
drwxr-xr-x 9 user group 288 Sep 2 10:13 commands
-rw-r--r-- 1 user group 2152 Sep 2 10:13 go.mod
-rw-r--r-- 1 user group 23139 Sep 2 10:13 go.sum
-rw-r--r-- 1 user group 252 Sep 2 10:14 kustomization.yaml
-rwxr-xr-x 1 user group 23246722 Sep 2 10:14 kustomize
-rw-r--r-- 1 user group 292 Sep 2 10:13 main.go
$ ./kustomize build .
apiVersion: v1
data:
0C6B462C403217C4: foo
6E7E3021F1821943: foo
32E0817AE855A845: foo
024233B4DFB484FC: foo
DFD86A289C3857EF: foo
EE10D2E63AF9F498: foo
FDC41072BFC0BC7F: foo
kind: ConfigMap
metadata:
name: test-7mt6kd57dt
$ ./kustomize build .
apiVersion: v1
data:
024233B4DFB484FC: foo
0C6B462C403217C4: foo
6E7E3021F1821943: foo
32E0817AE855A845: foo
DFD86A289C3857EF: foo
EE10D2E63AF9F498: foo
FDC41072BFC0BC7F: foo
kind: ConfigMap
metadata:
name: test-7mt6kd57dt |
looks related to golang/go#27179 The order is preserved until, the Resource is converted to YAML. As an intermediate step for YAML conversion, JSON is used and thats where the order is lost. So Resource byte buff -> JSON -> YAML. See here Open to suggestion on a approach before getting into an area which affects other portions of the binary. |