kubernetes-sigs / legacyflag

Provides a pflag wrapper that addresses pain-points of backwards-compatible ComponentConfig migration.
Apache License 2.0
2 stars 8 forks source link

Added a method to initialize a FlagSet #3

Closed alejandrox1 closed 5 years ago

alejandrox1 commented 5 years ago

This can be used to initialize a FlagSet given a pflag.FlagSet. Useful for converting pflg.FlagSets to FlagSets.

Signed-off-by: alejandrox1 alarcj137@gmail.com

k8s-ci-robot commented 5 years ago

Welcome @alejandrox1!

It looks like this is your first PR to kubernetes-sigs/legacyflag 🎉. 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/legacyflag 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. :smiley:

alejandrox1 commented 5 years ago

Came up with this as a possible solution for converting a pflag.FlagSet to a legacy.FlagSet, such as in https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-proxy/app/server.go#L454

alejandrox1 commented 5 years ago

Thank you @rosti @sttts for your comments. Just made the name change

sttts commented 5 years ago

/lgtm /approve

k8s-ci-robot commented 5 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alejandrox1, sttts

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: - ~~[OWNERS](https://github.com/kubernetes-sigs/legacyflag/blob/master/OWNERS)~~ [sttts] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
mtaufen commented 5 years ago

Thinking about this, I'm not sure it's necessary. If we use legacyflag, it can be used for all the flags on a component. It's more consistent and easier to reason about to just interface with one flag library for all the flags, so why not just switch everything over to legacyflag all at once?

In other words, I see how this new method could be useful for an incremental migration to legacyflag, but why can't the migration be atomic (and do we really want to be in the business of another incremental migration)?