mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +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
|
// It's an error to call Run() more than once for a given ServiceController
|
||||||
// object.
|
// object.
|
||||||
func (s *ServiceController) Run(workers int, stopCh <-chan struct{}) error {
|
func (s *ServiceController) Run(workers int, stopCh <-chan struct{}) error {
|
||||||
|
if err := s.init(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
defer runtime.HandleCrash()
|
defer runtime.HandleCrash()
|
||||||
go s.serviceController.Run(stopCh)
|
go s.serviceController.Run(stopCh)
|
||||||
go s.clusterController.Run(stopCh)
|
go s.clusterController.Run(stopCh)
|
||||||
@ -242,6 +245,18 @@ func (s *ServiceController) Run(workers int, stopCh <-chan struct{}) error {
|
|||||||
return nil
|
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.
|
// 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.
|
// It enforces that the syncService is never invoked concurrently with the same key.
|
||||||
func (s *ServiceController) fedServiceWorker() {
|
func (s *ServiceController) fedServiceWorker() {
|
||||||
@ -317,6 +332,8 @@ func (s *ServiceController) deleteFederationService(cachedService *cachedService
|
|||||||
err := s.deleteClusterService(clusterName, cachedService, cluster.clientset)
|
err := s.deleteClusterService(clusterName, cachedService, cluster.clientset)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
hasErr = true
|
hasErr = true
|
||||||
|
} else if err := s.ensureDnsRecords(clusterName, cachedService); err != nil {
|
||||||
|
hasErr = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if hasErr {
|
if hasErr {
|
||||||
|
Loading…
Reference in New Issue
Block a user