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

Remove dependency injection functions #8217

Merged
merged 31 commits into from Jul 11, 2023

Conversation

ary1992
Copy link
Contributor

@ary1992 ary1992 commented Jul 7, 2023

How to categorize this PR?

/area open-source dev-productivity
/kind enhancement

What this PR does / why we need it:
The package controller-runtime/pkg/runtime/inject has been removed in controller-runtime v0.15. This package contained long deprecated injection functions (like InjectScheme, InjectLogger, InjectConfig, InjectClient, InjectCache, etc.).

The runtime injection functionality has been deprecated since Controller Runtime 0.10; all of the above fields can be passed from the Manager to structs or interfaces that need them.

kubernetes-sigs/controller-runtime#2134
kubernetes-sigs/controller-runtime#2120

Which issue(s) this PR fixes:
Part of #7991

Special notes for your reviewer:

Release note:

Usage of the deprecated injection mechanisms in controller-runtime (like `InjectScheme`, `InjectLogger`, `InjectConfig`, `InjectClient`, `InjectCache` etc) as well as package `extensions/pkg/controller/common` are dropped in a preparation to upgrade to the next version where injection is removed entirely. With this, `Inject*` functions on controllers, predicates, actuators, delegates, and friends are not called anymore. When upgrading the `gardener/gardener` dependency to this version, all injection implementations need to be removed. As a replacement, you can get the needed clients and similar from the manager during initialisation of the component.

@gardener-prow
Copy link
Contributor

gardener-prow bot commented Jul 7, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@gardener-prow gardener-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/open-source Open Source (community, enablement, contributions, conferences, CNCF, etc.) related area/dev-productivity Developer productivity related (how to improve development) kind/enhancement Enhancement, improvement, extension cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. labels Jul 7, 2023
@gardener-prow gardener-prow bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 7, 2023
@ary1992
Copy link
Contributor Author

ary1992 commented Jul 7, 2023

/test all

@ary1992 ary1992 marked this pull request as ready for review July 7, 2023 07:52
@gardener-prow gardener-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 7, 2023
Copy link
Contributor

@ScheererJ ScheererJ left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the very well structured PR.

I just have a minor question. Apart from that it looks good already.

pkg/provider-local/controller/worker/add.go Outdated Show resolved Hide resolved
Copy link
Contributor

@shafeeqes shafeeqes left a comment

Choose a reason for hiding this comment

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

Thanks for the well-structured PR.

@shafeeqes
Copy link
Contributor

/retest

Copy link
Contributor

@ScheererJ ScheererJ left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jul 10, 2023
@gardener-prow
Copy link
Contributor

gardener-prow bot commented Jul 10, 2023

LGTM label has been added.

Git tree hash: 7a09b7c7a77db56743ea2ffb8ab2bd70aba9da86

@timebertt
Copy link
Member

/assign

Copy link
Member

@timebertt timebertt left a comment

Choose a reason for hiding this comment

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

Nice work, thanks for the change!
I'm not through with my review, but here are some comments from the first pass.

Copy link
Member

@timebertt timebertt left a comment

Choose a reason for hiding this comment

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

Made it through, here are the remaining comments :)

pkg/provider-local/controller/worker/add.go Outdated Show resolved Hide resolved
extensions/pkg/controller/common/context.go Outdated Show resolved Hide resolved
@gardener-prow gardener-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 10, 2023
Copy link
Member

@timebertt timebertt left a comment

Choose a reason for hiding this comment

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

Awesome, nice work @ary1992!
/lgtm
/approve


// ClientContext bundles the feature of providing injected scheme and client for
// the controller runtime. Additionally it offers a decoder using the scheme.
type ClientContext struct {
Copy link
Member

Choose a reason for hiding this comment

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

Can you mention/explain the removal of this package in the release note as well? :)

@gardener-prow gardener-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jul 11, 2023
@gardener-prow
Copy link
Contributor

gardener-prow bot commented Jul 11, 2023

LGTM label has been added.

Git tree hash: fa1059deb98598618b2d055d84c5568c55f22b9e

@gardener-prow
Copy link
Contributor

gardener-prow bot commented Jul 11, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: timebertt

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

@gardener-prow gardener-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 11, 2023
@gardener-prow gardener-prow bot merged commit 9b963d4 into gardener:master Jul 11, 2023
16 checks passed
@ary1992 ary1992 deleted the enh/inject-package branch July 11, 2023 08:01
nickytd pushed a commit to nickytd/gardener that referenced this pull request Sep 11, 2023
* Adapt extensions/pkg/controller/backupBucket

* Adapt extensions/pkg/controller/backupEntry

* Adapt extensions/pkg/controller/containerruntime

* Adapt extensions/pkg/controller/controlplane

* Adapt extensions/pkg/controller/dnsrecord

* Adapt extensions/pkg/controller/extension

* Adapt extensions/pkg/controller/healthcheck

* Adapt extensions/pkg/controller/network

* Adapt extensions/pkg/controller/bastion

* Adapt extensions/pkg/controller/infrastructure

* Adapt extensions/pkg/controller/operatingsystemconfig

* Adapt extensions/pkg/controller/controlplane

* Adapt pkg/controllerutils/reconciler

* Adapt extensions/pkg/controller/healthcheck

* Adapt extensions/pkg/controller/heartbeat

* Adapt extensions/pkg/controller/worker

* Adapt provider-local

* Add `context.Context` as first argument to AddToManager function

* Adapt extensions/pkg/predicate/

* Adapt validator, handler and mutator

* Adapt `ClientContext` for extensions controller

* Adapt pkg/gardenlet/controller/controllerinstallation

* Adapt pkg/gardenlet/controller/managedseed

* Adapt pkg/controllermanager/controller/managedseedset

* Adapt pkg/controllerutils/mapper

* Adapt extensions/pkg/controller/mock/

* Adapt tests

* [OperationAnnotationWrapper] Address PR review

* Address PR review feedback

* Drop pkg/controller/common

* [Address PR review feedback] Pass cache instead of manager to `EnqueueRequestsFrom` function
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. area/dev-productivity Developer productivity related (how to improve development) area/open-source Open Source (community, enablement, contributions, conferences, CNCF, etc.) related cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/enhancement Enhancement, improvement, extension lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants