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

⚠️ Functional Options Redux #536

Conversation

DirectXMan12
Copy link
Contributor

This switches over our functional options to actually be interfaced-based. Practically, this feels incredibly similar for users, to the point where I expect nobody will have to change their code (with the exception of Preconditions, which was a pointer).

The upsides are slightly more ergonomic options in some cases (like client.MatchingLabels{"foo": "bar"} instead of needing client.MatchingLabels(map[string]string{"foo": "bar"}), although the latter still works), as well as the removal of the need for separate variants for options that apply across different operations.

Technically, this is a breaking change, since there are type signature changes.

Fixes #503 (see that issue for more details)

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 24, 2019
@k8s-ci-robot k8s-ci-robot requested review from droot and pwittrock July 24, 2019 00:59
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DirectXMan12

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 Jul 24, 2019
These behave more-or-less like functional options, except that a given
option can be applied to more than on option type, so we can deprecate
the 3 different dryrunall variants.

Things with arguments generally become type aliases, with the exception
of MatchingField, which gets deprecated in favor of MatchFields (a type
alias to fields.Set).
For field manager, update and create also support fieldmanager, so we
allow using them there.

For dryrun, it's also supported by delete, so we support setting it
there.
@DirectXMan12 DirectXMan12 force-pushed the feature/functional-options-redux branch from 0216acb to 320b6b6 Compare July 24, 2019 01:05
@rajathagasthya
Copy link
Contributor

Ooh, this is going to affect #341 :-)

@DirectXMan12
Copy link
Contributor Author

should be a relatively minor tweak though. lmk if you have any issues.

@rajathagasthya
Copy link
Contributor

No worries, I can rebase.

@droot droot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 25, 2019
@k8s-ci-robot k8s-ci-robot merged commit 5181210 into kubernetes-sigs:master Jul 25, 2019
@DirectXMan12 DirectXMan12 deleted the feature/functional-options-redux branch July 25, 2019 21:59
DirectXMan12 pushed a commit that referenced this pull request Jan 31, 2020
📖 add how to get auth proxy for older project
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. 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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The XYZDryRunAll functions are frustratingly numerous
4 participants