@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
16
17
+ // Deprecated: Injectors are deprecated, and will be removed in v0.10.
17
18
package inject
18
19
19
20
import (
@@ -24,8 +25,11 @@ import (
24
25
25
26
"sigs.k8s.io/controller-runtime/pkg/cache"
26
27
"sigs.k8s.io/controller-runtime/pkg/client"
28
+ logf "sigs.k8s.io/controller-runtime/pkg/internal/log"
27
29
)
28
30
31
+ var log = logf .RuntimeLog .WithName ("inject-interface-warning" )
32
+
29
33
// Cache is used by the ControllerManager to inject Cache into Sources, EventHandlers, Predicates, and
30
34
// Reconciles
31
35
type Cache interface {
@@ -35,6 +39,7 @@ type Cache interface {
35
39
// CacheInto will set informers on i and return the result if it implements Cache. Returns
36
40
// false if i does not implement Cache.
37
41
func CacheInto (c cache.Cache , i interface {}) (bool , error ) {
42
+ log .Info ("Injectors are deprecated, and will be removed in v0.10" )
38
43
if s , ok := i .(Cache ); ok {
39
44
return true , s .InjectCache (c )
40
45
}
@@ -49,6 +54,7 @@ type APIReader interface {
49
54
// APIReaderInto will set APIReader on i and return the result if it implements APIReaderInto.
50
55
// Returns false if i does not implement APIReader
51
56
func APIReaderInto (reader client.Reader , i interface {}) (bool , error ) {
57
+ log .Info ("Injectors are deprecated, and will be removed in v0.10" )
52
58
if s , ok := i .(APIReader ); ok {
53
59
return true , s .InjectAPIReader (reader )
54
60
}
@@ -64,6 +70,7 @@ type Config interface {
64
70
// ConfigInto will set config on i and return the result if it implements Config. Returns
65
71
// false if i does not implement Config.
66
72
func ConfigInto (config * rest.Config , i interface {}) (bool , error ) {
73
+ log .Info ("Injectors are deprecated, and will be removed in v0.10" )
67
74
if s , ok := i .(Config ); ok {
68
75
return true , s .InjectConfig (config )
69
76
}
@@ -79,6 +86,7 @@ type Client interface {
79
86
// ClientInto will set client on i and return the result if it implements Client. Returns
80
87
// false if i does not implement Client.
81
88
func ClientInto (client client.Client , i interface {}) (bool , error ) {
89
+ log .Info ("Injectors are deprecated, and will be removed in v0.10" )
82
90
if s , ok := i .(Client ); ok {
83
91
return true , s .InjectClient (client )
84
92
}
@@ -94,6 +102,7 @@ type Scheme interface {
94
102
// SchemeInto will set scheme and return the result on i if it implements Scheme. Returns
95
103
// false if i does not implement Scheme.
96
104
func SchemeInto (scheme * runtime.Scheme , i interface {}) (bool , error ) {
105
+ log .Info ("Injectors are deprecated, and will be removed in v0.10" )
97
106
if is , ok := i .(Scheme ); ok {
98
107
return true , is .InjectScheme (scheme )
99
108
}
@@ -109,6 +118,7 @@ type Stoppable interface {
109
118
// StopChannelInto will set stop channel on i and return the result if it implements Stoppable.
110
119
// Returns false if i does not implement Stoppable.
111
120
func StopChannelInto (stop <- chan struct {}, i interface {}) (bool , error ) {
121
+ log .Info ("Injectors are deprecated, and will be removed in v0.10" )
112
122
if s , ok := i .(Stoppable ); ok {
113
123
return true , s .InjectStopChannel (stop )
114
124
}
@@ -123,6 +133,7 @@ type Mapper interface {
123
133
// MapperInto will set the rest mapper on i and return the result if it implements Mapper.
124
134
// Returns false if i does not implement Mapper.
125
135
func MapperInto (mapper meta.RESTMapper , i interface {}) (bool , error ) {
136
+ log .Info ("Injectors are deprecated, and will be removed in v0.10" )
126
137
if m , ok := i .(Mapper ); ok {
127
138
return true , m .InjectMapper (mapper )
128
139
}
@@ -140,6 +151,7 @@ type Injector interface {
140
151
// InjectorInto will set f and return the result on i if it implements Injector. Returns
141
152
// false if i does not implement Injector.
142
153
func InjectorInto (f Func , i interface {}) (bool , error ) {
154
+ log .Info ("Injectors are deprecated, and will be removed in v0.10" )
143
155
if ii , ok := i .(Injector ); ok {
144
156
return true , ii .InjectFunc (f )
145
157
}
@@ -155,6 +167,7 @@ type Logger interface {
155
167
// LoggerInto will set the logger on the given object if it implements inject.Logger,
156
168
// returning true if a InjectLogger was called, and false otherwise.
157
169
func LoggerInto (l logr.Logger , i interface {}) (bool , error ) {
170
+ log .Info ("Injectors are deprecated, and will be removed in v0.10" )
158
171
if injectable , wantsLogger := i .(Logger ); wantsLogger {
159
172
return true , injectable .InjectLogger (l )
160
173
}
0 commit comments