@@ -87,7 +87,7 @@ func NewCloudProvider(config *Config) (cloudprovider.Interface, error) {
87
87
config .CompartmentID = metadata .CompartmentOCID
88
88
}
89
89
90
- if config .VCNID == "" {
90
+ if ! config . LoadBalancer . Disabled && config .VCNID == "" {
91
91
glog .Infof ("No vcn provided in cloud provider config. Falling back to looking up VCN via LB subnet." )
92
92
subnet , err := c .Networking ().GetSubnet (context .Background (), config .LoadBalancer .Subnet1 )
93
93
if err != nil {
@@ -136,17 +136,19 @@ func (cp *CloudProvider) Initialize(clientBuilder controller.ControllerClientBui
136
136
}
137
137
cp .NodeLister = nodeInformer .Lister ()
138
138
139
- var serviceInformer informersv1.ServiceInformer
140
- if cp .config .LoadBalancer .SecurityListManagementMode != ManagementModeNone {
141
- serviceInformer = factory .Core ().V1 ().Services ()
142
- go serviceInformer .Informer ().Run (wait .NeverStop )
143
- glog .Info ("Waiting for service informer cache to sync" )
144
- if ! cache .WaitForCacheSync (wait .NeverStop , serviceInformer .Informer ().HasSynced ) {
145
- utilruntime .HandleError (fmt .Errorf ("Timed out waiting for service informer to sync" ))
146
- }
139
+ if ! cp .config .LoadBalancer .Disabled {
140
+ var serviceInformer informersv1.ServiceInformer
141
+ if cp .config .LoadBalancer .SecurityListManagementMode != ManagementModeNone {
142
+ serviceInformer = factory .Core ().V1 ().Services ()
143
+ go serviceInformer .Informer ().Run (wait .NeverStop )
144
+ glog .Info ("Waiting for service informer cache to sync" )
145
+ if ! cache .WaitForCacheSync (wait .NeverStop , serviceInformer .Informer ().HasSynced ) {
146
+ utilruntime .HandleError (fmt .Errorf ("Timed out waiting for service informer to sync" ))
147
+ }
147
148
149
+ }
150
+ cp .securityListManager = newSecurityListManager (cp .client , serviceInformer .Lister (), cp .config .LoadBalancer .SecurityLists , cp .config .LoadBalancer .SecurityListManagementMode )
148
151
}
149
- cp .securityListManager = newSecurityListManager (cp .client , serviceInformer .Lister (), cp .config .LoadBalancer .SecurityLists , cp .config .LoadBalancer .SecurityListManagementMode )
150
152
}
151
153
152
154
// ProviderName returns the cloud-provider ID.
@@ -158,7 +160,7 @@ func (cp *CloudProvider) ProviderName() string {
158
160
// is supported, false otherwise.
159
161
func (cp * CloudProvider ) LoadBalancer () (cloudprovider.LoadBalancer , bool ) {
160
162
glog .V (6 ).Info ("Claiming to support Load Balancers" )
161
- return cp , true
163
+ return cp , ! cp . config . LoadBalancer . Disabled
162
164
}
163
165
164
166
// Instances returns an instances interface. Also returns true if the interface
0 commit comments