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

Bug 1866568: Removes RestMapper since DynamicRestMapper is now the pkg default #437

Merged
merged 1 commit into from
Aug 18, 2020

Conversation

danehans
Copy link
Contributor

@danehans danehans commented Aug 5, 2020

kubernetes-sigs/controller-runtime#554 merged to fix kubernetes-sigs/controller-runtime#321. This PR updates the operator to use the controller-runtime DynamicRestMapper (default option) instead of using the internal implementation. The controller-runtime DynamicRestMapper was tested by:

  1. Running the ingress operator locally.
  2. Removing the ingresscontroller CRD and default ingresscontroller CR from the api server.
  3. Recreating the the ingresscontroller CRD and the operator successfully created the default ingresscontroller CR.

/assign @Miciah @knobunc
/cc @frobware @sgreene570

@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. label Aug 5, 2020
@openshift-ci-robot
Copy link
Contributor

@danehans: This pull request references Bugzilla bug 1866568, which is invalid:

  • expected the bug to target the "4.6.0" release, but it targets "4.5.z" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1866568: Updates RestMapper to use controller-runtime DynamicRestMapper

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.

@openshift-ci-robot openshift-ci-robot added bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 5, 2020
@danehans
Copy link
Contributor Author

danehans commented Aug 5, 2020

/bugzilla refresh

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Aug 5, 2020
@openshift-ci-robot
Copy link
Contributor

@danehans: This pull request references Bugzilla bug 1866568, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

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.

@openshift-ci-robot openshift-ci-robot removed the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Aug 5, 2020
@Miciah
Copy link
Contributor

Miciah commented Aug 6, 2020

This is great! Can we simplify further by deleting pkg/util/restmapper.go and using apiutil.NewDynamicRESTMapper directly in pkg/operator/operator.go?

@danehans
Copy link
Contributor Author

This is great! Can we simplify further by deleting pkg/util/restmapper.go and using apiutil.NewDynamicRESTMapper directly in pkg/operator/operator.go?

@Miciah done in commit 826c995.

@Miciah
Copy link
Contributor

Miciah commented Aug 12, 2020

This is great! Can we simplify further by deleting pkg/util/restmapper.go and using apiutil.NewDynamicRESTMapper directly in pkg/operator/operator.go?

@Miciah done in commit 826c995.

Thanks! I was hoping we could collapse it down to the following:

		MapperProvider: apiutil.NewDynamicRESTMapper,

But it looks like apiutil.NewDynamicRESTMapper's variadic opts parameter causes a type mismatch (cannot use apiutil.NewDynamicRESTMapper (value of type func(cfg *rest.Config, opts ...apiutil.DynamicRESTMapperOption) (meta.RESTMapper, error)) as func(c *rest.Config) (meta.RESTMapper, error) value in struct literal).

However, it looks like the dynamic REST mapper is now the default mapper:

if options.MapperProvider == nil {
options.MapperProvider = func(c *rest.Config) (meta.RESTMapper, error) {
return apiutil.NewDynamicRESTMapper(c)
}
}

Any reason not to delete the designated initializer for the MapperProvider field entirely so we get the default?

@danehans danehans changed the title Bug 1866568: Updates RestMapper to use controller-runtime DynamicRestMapper Bug 1866568: Removes RestMapper since DynamicRestMapper is now the pkg default Aug 13, 2020
@openshift-ci-robot
Copy link
Contributor

@danehans: This pull request references Bugzilla bug 1866568, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1866568: Removes RestMapper since DynamicRestMapper is now the pkg default

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.

@danehans
Copy link
Contributor Author

Any reason not to delete the designated initializer for the MapperProvider field entirely so we get the default?

@Miciah I wasn't aware that the DynamicRestMapper is now the default. Thanks for looking into this. Commit 179dcbc implements your feedback.

@Miciah
Copy link
Contributor

Miciah commented Aug 13, 2020

I love seeing all that code deleted!
/lgtm
Can we do the same cleanup in cluster-dns-operator? It's using controller-runtime 0.6.0, which appears to have the fix.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 13, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danehans, Miciah

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

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@danehans
Copy link
Contributor Author

@Miciah thanks for making me aware that dns operator uses the same internal RestMapper implementation. openshift/cluster-dns-operator#189 is the same PR as this for dns operator.

@danehans
Copy link
Contributor Author

/bin/bash: line 129: /tmp/artifacts/junit/junit_install_status.xml: No such file or directory
error: failed to execute wrapped command: exit status 1

^ is unrelated to this PR.

/test e2e-aws

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

27 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 4c59487 into openshift:master Aug 18, 2020
@openshift-ci-robot
Copy link
Contributor

@danehans: All pull requests linked via external trackers have merged: openshift/cluster-ingress-operator#437. Bugzilla bug 1866568 has been moved to the MODIFIED state.

In response to this:

Bug 1866568: Removes RestMapper since DynamicRestMapper is now the pkg default

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.

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. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RESTMapper doesn't update to reflect new CRDs
6 participants