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

⚠️ Follow XDG Directory standard for config/data/... files #6913

Merged

Conversation

cwrau
Copy link
Contributor

@cwrau cwrau commented Jul 13, 2022

What this PR does / why we need it: This PR switches the hardcoded paths ($HOME/.cluster-api) to be XDG conform ($XDG_CONFIG_HOME/cluster-api).

This removes clutter in the users' home directory.

Open questions:

  • I tried adding backwards compatibility to the old path inside the reader_viper.go but I'm not sure if this works for everything

  • The script cmd/clusterctl/hack/create-local-repository.py creates a dev-repository at $HOME/.cluster-api/dev-repository. I see three solutions to this;

    • The script uses an xdg library, which has to be installed on the users' system, which we'll mention in the docs
    • The script does everything by itself, without needing dependencies
      • This could be a lot of work, especially for Windows and macOS, as I can't test these systems
    • The documentation will mention to overwrite XDG_CONFIG_HOME while using the script, this could be weird

    I personally vote for the first possibility

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 13, 2022
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 13, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: cwrau / name: Chris Werner Rau (a0d0c1d)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jul 13, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @cwrau!

It looks like this is your first PR to kubernetes-sigs/cluster-api 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @cwrau. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 13, 2022
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 13, 2022
@apricote
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 13, 2022
@cwrau
Copy link
Contributor Author

cwrau commented Jul 14, 2022

The apidiff is failing, but that is expected, what can I do?

@killianmuldoon
Copy link
Contributor

The api diff isn't merge blocking if the maintainers think this is worth merging without an API revision - the check is really informing rather than blocking for API changes so don't worry about trying to pass it :)

@killianmuldoon
Copy link
Contributor

The api diff isn't merge blocking if the maintainers think this is worth merging without an API revision - the check is really informing rather than blocking for API changes so don't worry about trying to pass it - it would be good if you could sign the CLA though 🙂

@cwrau
Copy link
Contributor Author

cwrau commented Jul 14, 2022

The api diff isn't merge blocking if the maintainers think this is worth merging without an API revision - the check is really informing rather than blocking for API changes so don't worry about trying to pass it - it would be good if you could sign the CLA though slightly_smiling_face

Yes, my boss is working on the CLA 👍️

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jul 19, 2022
@cwrau
Copy link
Contributor Author

cwrau commented Jul 27, 2022

CLA has been accepted 👍️

/help

@killianmuldoon
Copy link
Contributor

Good to hear! I'm not sure what you're looking for with the help tag though 😆

@cwrau
Copy link
Contributor Author

cwrau commented Jul 27, 2022

Good to hear! I'm not sure what you're looking for with the help tag though 😆

I just wanted to add the help-wanted label, but apparently that doesn't work this way 🤣

@killianmuldoon
Copy link
Contributor

I think we normally only add that label to issues where we want someone to take them up - are you looking to have someone else pick up this PR? If so it might be better to create an issue describing the goals, link this draft PR and then add the help wanted tag.

@cwrau
Copy link
Contributor Author

cwrau commented Jul 27, 2022

Ah, ok, then I misunderstood the point of that label 😅

No, I can keep this PR 👍

@sbueringer
Copy link
Member

sbueringer commented Aug 16, 2022

@cwrau Is the PR ready for review? (just asking because we usually use Draft/WIP to ~ signal implementation is still in progress and folks should wait for reviews except if they are explicitly asked to provide a review)

cc @ykakarap

@cwrau
Copy link
Contributor Author

cwrau commented Aug 16, 2022

@sbueringer

Ah, I see, yeah, I still need to have the questions answered 👍

By anyone, really 😅

@sbueringer
Copy link
Member

Got it.

cc @ykakarap
I'll also take a closer look soon

Copy link
Contributor

@ykakarap ykakarap left a comment

Choose a reason for hiding this comment

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

Ah, I see, yeah, I still need to have the questions answered 👍

By anyone, really 😅

I will take a look at this.

Copy link
Contributor

@ykakarap ykakarap left a comment

Choose a reason for hiding this comment

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

Looks like according to XDG documentation if XDG_CONFIG_HOME is not defined it should default to $HOME/.config. Meaning, we will effectively move from $HOME/.cluster-api to $HOME/.config/cluster-api in the general case.

I do not have strong opinions on doing this move.

Regarding your first question - I think establishing backward compatibility with $HOME/.cluster-api should be possible. This would also mean unless we break the contract both the XDG_CONFIG_HOME and $HOME/.cluster-api will need to be supported.

Regarding your second question - Are you suggesting that we move the dev-repository location also to XDG_CONFIG_HOME? If so, It might be easier to just build the support into the script we have. Looks like we dont need all of xdg library to begin with and can just have the logic that reads the XDG_CONFIG_HOME env var and default to the appropriate value if it is not defined. This would be simpler and would reduce external dependencies. As you pointed out I am not sure if this will be complicated for other OS environments. We will need more information before we can decide.

The documentation will mention to overwrite XDG_CONFIG_HOME while using the script, this could be weird

I am not sure why a user will have to override XDG_CONFIG_HOME. Can you please explain?

@dims
Copy link
Member

dims commented Aug 19, 2022

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 29, 2022
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 18, 2023
@cwrau cwrau force-pushed the feature/follow-xdg-standard branch from 7c7737d to 101fdf3 Compare April 24, 2023 08:46
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 24, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2023
@cwrau cwrau force-pushed the feature/follow-xdg-standard branch from 101fdf3 to e69ace0 Compare May 22, 2023 07:55
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 22, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 7, 2023
@richardcase
Copy link
Member

Looks like with a rebase this is good to go.

@cwrau cwrau force-pushed the feature/follow-xdg-standard branch from e69ace0 to 9c75855 Compare June 12, 2023 13:47
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 12, 2023
go.mod Outdated Show resolved Hide resolved
@sbueringer
Copy link
Member

Only did a high-level review given all the lgtm's above. Looks good to me, just one nit.

Thank you very much for the patience, would be great to get this into the next release.

…. files

feat(clusterctl): use XDG_CONFIG_HOME for script as well
@cwrau cwrau force-pushed the feature/follow-xdg-standard branch from 9c75855 to a0d0c1d Compare June 13, 2023 08:41
@richardcase
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 0a1f3bb26081b57b62b2140d39d471cff41080f7

@sbueringer
Copy link
Member

Thx! lgtm (from a high-level review)

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Thanks again for following through on this!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: killianmuldoon

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 13, 2023
@k8s-ci-robot k8s-ci-robot merged commit 69d4494 into kubernetes-sigs:main Jun 13, 2023
20 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.5 milestone Jun 13, 2023
@cwrau
Copy link
Contributor Author

cwrau commented Jun 13, 2023

🥳🎉

elmiko added a commit to elmiko/cluster-api-provider-kubemark that referenced this pull request Nov 3, 2023
this is following changes to upstream to make it follow the xdg
configuration directory. see
kubernetes-sigs/cluster-api#6913 for more
information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/clusterctl Issues or PRs related to clusterctl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet