Skip to content
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

configmap with alphabetical order #5334

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

charles-chenzz
Copy link
Member

this PR tend to resolve #4292 by using alphabetical way. as I currently can't figure out a better way to move #5308 on.

I used to have a scenes that need to sort keys order in a map, and I've done it like here. IMHO, the configmap key is getting sort here and then get load.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 20, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: charles-chenzz
Once this PR has been reviewed and has the lgtm label, please assign natasha41575 for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@stormqueen1990
Copy link
Member

/cc

Copy link
Contributor

@natasha41575 natasha41575 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests demonstrating that ConfigMap items get outputed in alphabetical order. You can probably add them to api/krusty, maybe in this file: https://github.com/kubernetes-sigs/kustomize/blob/master/api/krusty/configmaps_test.go. You can use the contents from this comment #4292 (comment) as input to the test. Thanks!

for k := range m {
keys[i] = k
i++
keys = append(keys, k)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this code change is a functional change, it looks like it does exactly the same thing functionally as it did previously, but I believe your version has slightly worse performance because we are appending to an array rather than having a prebuilt array.

You can test this out in go playground and see that it functionally does the same thing: https://go.dev/play/p/1BBr3XTnHBS

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've check the link and the functional did do the same things... the performance should be relativity same as we pre-allocate capacity but I didn't test it so I can't guarantee.

the configmap data is getting sort and loaded here, but I don't know where it get un-sorted when return to the user..

@stormqueen1990
Copy link
Member

/uncc

@k8s-ci-robot k8s-ci-robot removed the request for review from stormqueen1990 December 18, 2023 01:48
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 17, 2024
@antoooks
Copy link
Contributor

Hi @charles-chenzz, are you planning to continue this PR? Let's add some test to validate your implementation

@charles-chenzz
Copy link
Member Author

Hi @charles-chenzz, are you planning to continue this PR? Let's add some test to validate your implementation

don't have much bandwidth recently.. If you want to take it on please feel free to do so! @antoooks

@kundan2707
Copy link
Contributor

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 12, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConfigMaps items are generated with random order
7 participants