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