Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Support varying the apiVersion of target resources #1052

Merged
merged 2 commits into from
Jul 26, 2019
Merged

Support varying the apiVersion of target resources #1052

merged 2 commits into from
Jul 26, 2019

Conversation

marun
Copy link
Contributor

@marun marun commented Jul 23, 2019

Previously the sync controller used ResourceClient to make changes to member clusters. This meant that the API endpoint configuration for a target type was always sourced from an FTC.

This PR updates the sync controller to use GenericClient so that API endpoint configuration for create and update calls can be provided on a per-call basis. If apiVersion is set via template or override for a given federated resource, that value will supersede the configuration sourced from an FTC. This is intended to allow a given federated type to manage more than one version across member clusters. For example, federated resource foo could manage a resource in cluster1 at v1, and a resource in cluster2 at v2. It would still be necessary for all clusters to support the version defined in the FTC since that is what would configure the informers for member clusters.

@marun marun requested review from font, shashidharatd and xunpan July 23, 2019 08:54
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 23, 2019
@k8s-ci-robot k8s-ci-robot requested a review from gyliu513 July 23, 2019 08:54
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marun

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 23, 2019
@marun marun changed the title WIP Support varying the apiVersion of target resources Support varying the apiVersion of target resources Jul 24, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 24, 2019
@marun marun added this to the v0.1.0 milestone Jul 24, 2019
@marun
Copy link
Contributor Author

marun commented Jul 25, 2019

Rebased

marun added 2 commits July 25, 2019 09:19
Previously the sync controller used ResourceClient to make changes to
member clusters. This meant that the API endpoint configuration for a
target type was always sourced from an FTC.

This commit updates the sync controller to use GenericClient so that
API endpoint configuration for create and update calls can be provided
on a per-call basis. If values for `apiVersion` is provided via
template or override for a given federated resource, that value will
supersede the configuration sourced from an FTC.

This is intended to allow a given federated type to manage more than
one version across member clusters. For example, federated resource
foo could manage a resource in cluster1 at v1, and a resource in
cluster2 at v2.
@marun
Copy link
Contributor Author

marun commented Jul 25, 2019

Rebased

@shashidharatd
Copy link
Contributor

Awesome work. This LGTM. Thanks @marun!

Copy link
Contributor

@font font left a comment

Choose a reason for hiding this comment

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

Thanks @marun!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 26, 2019
@k8s-ci-robot k8s-ci-robot merged commit 2628b60 into kubernetes-retired:master Jul 26, 2019
Copy link
Contributor

@pmorie pmorie left a comment

Choose a reason for hiding this comment

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

Looks good to me - modulo @font's question answered authoritatively. For testing, can we add a test to crd.go that establishes that this works by declaring multiple versions (example here), and then uses an override to differentiate the version for one of the clusters. Multiple version support has been available since 1.11 so I think we should be able to add this with confidence.

I'd be happy to get this test in an immediate follow-up, since we've established via CI that the existing feature set hasn't regressed.

pkg/controller/sync/dispatch/unmanaged.go Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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 Indicates that a PR is ready to be merged. 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.

5 participants