kubernetes-retired / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
301 stars 67 forks source link

✨ Convert PodMutators to Plugins #314

Closed m-messiah closed 2 years ago

m-messiah commented 2 years ago

What this PR does / why we need it: The PR converts PodMutators mechanism to Plugins, allowing any additional vc-syncer implementations to easily add their own pod mutator methods. The PR defines a simple mutatorplugin.Interface to implement and converts two existing mutators (ServiceLink and ServiceAccountToken) to plugins. The default pod mutator uses too many controller methods and caches, so it is not worth time to convert it to be a plugin, especially, while we want it to be executed first to be the actual "default". I could try to migrate it as a follow-up if you think it is needed.

I also extended PodMutateCtx to have vPod too, to simplify comparisons and mutations in the future plugins.

Relate: https://github.com/kubernetes-sigs/cluster-api-provider-nested/pull/311#issuecomment-1259073854

Fei-Guo commented 2 years ago

Looks reasonable to me.

@wondywang , can you take a look as well?

wondywang commented 2 years ago

/lgtm thanks @m-messiah

k8s-ci-robot commented 2 years ago

@wondywang: changing LGTM is restricted to collaborators

In response to [this](https://github.com/kubernetes-sigs/cluster-api-provider-nested/pull/314#issuecomment-1260290203): >> > >/lgtm >thanks @m-messiah > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
k8s-ci-robot commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christopherhein, m-messiah

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: - ~~[virtualcluster/OWNERS](https://github.com/kubernetes-sigs/cluster-api-provider-nested/blob/main/virtualcluster/OWNERS)~~ [christopherhein] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment