@@ -34,6 +34,9 @@ type DockerRegistryServiceControllerOptions struct {
34
34
35
35
DockercfgController * DockercfgController
36
36
37
+ // AdditionalRegistryURLs is a list of URLs that are always included
38
+ AdditionalRegistryURLs []string
39
+
37
40
// DockerURLsInitialized is used to send a signal to the DockercfgController that it has the correct set of docker urls
38
41
DockerURLsInitialized chan struct {}
39
42
}
@@ -51,12 +54,13 @@ var serviceLocations = []serviceLocation{
51
54
// NewDockerRegistryServiceController returns a new *DockerRegistryServiceController.
52
55
func NewDockerRegistryServiceController (secrets informers.SecretInformer , serviceInformer informers.ServiceInformer , cl kclientset.Interface , options DockerRegistryServiceControllerOptions ) * DockerRegistryServiceController {
53
56
e := & DockerRegistryServiceController {
54
- client : cl ,
55
- clusterDNSSuffix : options .ClusterDNSSuffix ,
56
- dockercfgController : options .DockercfgController ,
57
- registryLocationQueue : workqueue .NewRateLimitingQueue (workqueue .DefaultControllerRateLimiter ()),
58
- secretsToUpdate : workqueue .NewRateLimitingQueue (workqueue .DefaultControllerRateLimiter ()),
59
- dockerURLsInitialized : options .DockerURLsInitialized ,
57
+ client : cl ,
58
+ additionalRegistryURLs : options .AdditionalRegistryURLs ,
59
+ clusterDNSSuffix : options .ClusterDNSSuffix ,
60
+ dockercfgController : options .DockercfgController ,
61
+ registryLocationQueue : workqueue .NewRateLimitingQueue (workqueue .DefaultControllerRateLimiter ()),
62
+ secretsToUpdate : workqueue .NewRateLimitingQueue (workqueue .DefaultControllerRateLimiter ()),
63
+ dockerURLsInitialized : options .DockerURLsInitialized ,
60
64
}
61
65
62
66
// we're only watching two of these, but we already watch all services for the service serving cert signer
@@ -104,6 +108,8 @@ type DockerRegistryServiceController struct {
104
108
105
109
// clusterDNSSuffix is the suffix for in cluster DNS that can be added to service names
106
110
clusterDNSSuffix string
111
+ // additionalRegistryURLs is a list of URLs that are always included
112
+ additionalRegistryURLs []string
107
113
108
114
dockercfgController * DockercfgController
109
115
@@ -134,6 +140,9 @@ func (e *DockerRegistryServiceController) Run(workers int, stopCh <-chan struct{
134
140
defer utilruntime .HandleCrash ()
135
141
defer e .registryLocationQueue .ShutDown ()
136
142
143
+ glog .Infof ("Starting DockerRegistryServiceController controller" )
144
+ defer glog .Infof ("Shutting down DockerRegistryServiceController controller" )
145
+
137
146
// Wait for the store to sync before starting any work in this controller.
138
147
ready := make (chan struct {})
139
148
go e .waitForDockerURLs (ready , stopCh )
@@ -142,14 +151,13 @@ func (e *DockerRegistryServiceController) Run(workers int, stopCh <-chan struct{
142
151
case <- stopCh :
143
152
return
144
153
}
154
+ glog .V (1 ).Infof ("caches synced" )
145
155
146
- glog .V (5 ).Infof ("Starting workers" )
147
156
go wait .Until (e .watchForDockerURLChanges , time .Second , stopCh )
148
157
for i := 0 ; i < workers ; i ++ {
149
158
go wait .Until (e .watchForDockercfgSecretUpdates , time .Second , stopCh )
150
159
}
151
160
<- stopCh
152
- glog .V (1 ).Infof ("Shutting down" )
153
161
}
154
162
155
163
// enqueue adds to our queue. We only have one entry, but we never have to check it since we already know the things
@@ -225,10 +233,11 @@ func (e *DockerRegistryServiceController) watchForDockerURLChanges() {
225
233
226
234
// getDockerRegistryLocations returns the dns form and the ip form of the secret
227
235
func (e * DockerRegistryServiceController ) getDockerRegistryLocations () []string {
228
- ret := []string {}
236
+ ret := append ( []string {}, e . additionalRegistryURLs ... )
229
237
for _ , location := range serviceLocations {
230
238
ret = append (ret , getDockerRegistryLocations (e .serviceLister , location , e .clusterDNSSuffix )... )
231
239
}
240
+ glog .V (4 ).Infof ("found docker registry urls: %v" , ret )
232
241
return ret
233
242
}
234
243
@@ -260,9 +269,10 @@ func (e *DockerRegistryServiceController) syncRegistryLocationChange() error {
260
269
newDockerRegistryLocations := sets .NewString (newLocations ... )
261
270
existingURLs := e .getRegistryURLs ()
262
271
if existingURLs .Equal (newDockerRegistryLocations ) && e .initialSecretsCheckDone {
263
- glog .V (4 ).Infof ("No effective update: %v" , newDockerRegistryLocations )
272
+ glog .V (3 ).Infof ("No effective update: %v" , newDockerRegistryLocations )
264
273
return nil
265
274
}
275
+ glog .V (1 ).Infof ("Updating registry URLs from %v to %v" , existingURLs , newDockerRegistryLocations )
266
276
267
277
// make sure that new dockercfg secrets get the correct locations
268
278
e .dockercfgController .SetDockerURLs (newDockerRegistryLocations .List ()... )
0 commit comments