mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
add dns provider initialzation
This commit is contained in:
parent
6e5faf59b2
commit
29cc7c009c
@ -227,6 +227,9 @@ func (s *ServiceController) enqueueService(obj interface{}) {
|
||||
// It's an error to call Run() more than once for a given ServiceController
|
||||
// object.
|
||||
func (s *ServiceController) Run(workers int, stopCh <-chan struct{}) error {
|
||||
if err := s.init(); err != nil {
|
||||
return err
|
||||
}
|
||||
defer runtime.HandleCrash()
|
||||
go s.serviceController.Run(stopCh)
|
||||
go s.clusterController.Run(stopCh)
|
||||
@ -242,6 +245,18 @@ func (s *ServiceController) Run(workers int, stopCh <-chan struct{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ServiceController) init() error {
|
||||
if s.dns == nil {
|
||||
return fmt.Errorf("ServiceController should not be run without a dnsprovider.")
|
||||
}
|
||||
zones, ok := s.dns.Zones()
|
||||
if !ok {
|
||||
return fmt.Errorf("the dns provider does not support zone enumeration, which is required for creating dns records.")
|
||||
}
|
||||
s.dnsZones = zones
|
||||
return nil
|
||||
}
|
||||
|
||||
// fedServiceWorker runs a worker thread that just dequeues items, processes them, and marks them done.
|
||||
// It enforces that the syncService is never invoked concurrently with the same key.
|
||||
func (s *ServiceController) fedServiceWorker() {
|
||||
@ -317,6 +332,8 @@ func (s *ServiceController) deleteFederationService(cachedService *cachedService
|
||||
err := s.deleteClusterService(clusterName, cachedService, cluster.clientset)
|
||||
if err != nil {
|
||||
hasErr = true
|
||||
} else if err := s.ensureDnsRecords(clusterName, cachedService); err != nil {
|
||||
hasErr = true
|
||||
}
|
||||
}
|
||||
if hasErr {
|
||||
|
Loading…
Reference in New Issue
Block a user