Skip to content

Commit e1a725d

Browse files
authored
Merge pull request #1382 from estroz/revert/1322
✨ revert injection deprecation logging until internal injection code use stops
2 parents 16bf3ad + 9512597 commit e1a725d

File tree

4 files changed

+3
-18
lines changed

4 files changed

+3
-18
lines changed

pkg/cluster/cluster.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
type Cluster interface {
4040
// SetFields will set any dependencies on an object for which the object has implemented the inject
4141
// interface - e.g. inject.Client.
42+
// Deprecated: use the equivalent Options field to set a field. This method will be removed in v0.10.
4243
SetFields(interface{}) error
4344

4445
// GetConfig returns an initialized Config

pkg/internal/controller/controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type Controller struct {
6161
Queue workqueue.RateLimitingInterface
6262

6363
// SetFields is used to inject dependencies into other objects such as Sources, EventHandlers and Predicates
64+
// Deprecated: the caller should handle injected fields itself.
6465
SetFields func(i interface{}) error
6566

6667
// mu is used to synchronize Controller setup

pkg/manager/internal.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ func (cm *controllerManager) Add(r Runnable) error {
220220
return nil
221221
}
222222

223+
// Deprecated: use the equivalent Options field to set a field. This method will be removed in v0.10.
223224
func (cm *controllerManager) SetFields(i interface{}) error {
224225
if _, err := inject.InjectorInto(cm.SetFields, i); err != nil {
225226
return err

pkg/runtime/inject/inject.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,8 @@ import (
2626

2727
"sigs.k8s.io/controller-runtime/pkg/cache"
2828
"sigs.k8s.io/controller-runtime/pkg/client"
29-
logf "sigs.k8s.io/controller-runtime/pkg/internal/log"
3029
)
3130

32-
// log is specifically to add a warning message for injectors.
33-
var log = logf.RuntimeLog.WithName("injectors-warning")
34-
35-
// logWarningMsg logs a warning message if inject is used
36-
func logWarningMsg() {
37-
log.Info("Injectors are deprecated, and will be removed in v0.10.x")
38-
}
39-
4031
// Cache is used by the ControllerManager to inject Cache into Sources, EventHandlers, Predicates, and
4132
// Reconciles
4233
type Cache interface {
@@ -47,7 +38,6 @@ type Cache interface {
4738
// false if i does not implement Cache.
4839
func CacheInto(c cache.Cache, i interface{}) (bool, error) {
4940
if s, ok := i.(Cache); ok {
50-
logWarningMsg()
5141
return true, s.InjectCache(c)
5242
}
5343
return false, nil
@@ -62,7 +52,6 @@ type APIReader interface {
6252
// Returns false if i does not implement APIReader
6353
func APIReaderInto(reader client.Reader, i interface{}) (bool, error) {
6454
if s, ok := i.(APIReader); ok {
65-
logWarningMsg()
6655
return true, s.InjectAPIReader(reader)
6756
}
6857
return false, nil
@@ -78,7 +67,6 @@ type Config interface {
7867
// false if i does not implement Config.
7968
func ConfigInto(config *rest.Config, i interface{}) (bool, error) {
8069
if s, ok := i.(Config); ok {
81-
logWarningMsg()
8270
return true, s.InjectConfig(config)
8371
}
8472
return false, nil
@@ -94,7 +82,6 @@ type Client interface {
9482
// false if i does not implement Client.
9583
func ClientInto(client client.Client, i interface{}) (bool, error) {
9684
if s, ok := i.(Client); ok {
97-
logWarningMsg()
9885
return true, s.InjectClient(client)
9986
}
10087
return false, nil
@@ -110,7 +97,6 @@ type Scheme interface {
11097
// false if i does not implement Scheme.
11198
func SchemeInto(scheme *runtime.Scheme, i interface{}) (bool, error) {
11299
if is, ok := i.(Scheme); ok {
113-
logWarningMsg()
114100
return true, is.InjectScheme(scheme)
115101
}
116102
return false, nil
@@ -126,7 +112,6 @@ type Stoppable interface {
126112
// Returns false if i does not implement Stoppable.
127113
func StopChannelInto(stop <-chan struct{}, i interface{}) (bool, error) {
128114
if s, ok := i.(Stoppable); ok {
129-
logWarningMsg()
130115
return true, s.InjectStopChannel(stop)
131116
}
132117
return false, nil
@@ -141,7 +126,6 @@ type Mapper interface {
141126
// Returns false if i does not implement Mapper.
142127
func MapperInto(mapper meta.RESTMapper, i interface{}) (bool, error) {
143128
if m, ok := i.(Mapper); ok {
144-
logWarningMsg()
145129
return true, m.InjectMapper(mapper)
146130
}
147131
return false, nil
@@ -159,7 +143,6 @@ type Injector interface {
159143
// false if i does not implement Injector.
160144
func InjectorInto(f Func, i interface{}) (bool, error) {
161145
if ii, ok := i.(Injector); ok {
162-
logWarningMsg()
163146
return true, ii.InjectFunc(f)
164147
}
165148
return false, nil
@@ -175,7 +158,6 @@ type Logger interface {
175158
// returning true if a InjectLogger was called, and false otherwise.
176159
func LoggerInto(l logr.Logger, i interface{}) (bool, error) {
177160
if injectable, wantsLogger := i.(Logger); wantsLogger {
178-
logWarningMsg()
179161
return true, injectable.InjectLogger(l)
180162
}
181163
return false, nil

0 commit comments

Comments
 (0)