initControllers initializes the controllers.
(args *PilotArgs)
| 1164 | |
| 1165 | // initControllers initializes the controllers. |
| 1166 | func (s *Server) initControllers(args *PilotArgs) error { |
| 1167 | log.Info("initializing controllers") |
| 1168 | s.initMulticluster(args) |
| 1169 | |
| 1170 | s.initSDSServer() |
| 1171 | |
| 1172 | if features.EnableNodeUntaintControllers { |
| 1173 | s.initNodeUntaintController(args) |
| 1174 | } |
| 1175 | |
| 1176 | if features.EnableIPAutoallocate { |
| 1177 | // validate the IP autoallocate CIDR prefixes for IPv4 and IPv6 |
| 1178 | if _, err := netip.ParsePrefix(features.IPAutoallocateIPv4Prefix); err != nil { |
| 1179 | return fmt.Errorf("invalid IPv4 prefix %s: %v", features.IPAutoallocateIPv4Prefix, err) |
| 1180 | } |
| 1181 | if _, err := netip.ParsePrefix(features.IPAutoallocateIPv6Prefix); err != nil { |
| 1182 | return fmt.Errorf("invalid IPv6 prefix %s: %v", features.IPAutoallocateIPv6Prefix, err) |
| 1183 | } |
| 1184 | s.initIPAutoallocateController(args) |
| 1185 | } |
| 1186 | |
| 1187 | s.initKubeOptions(args) |
| 1188 | |
| 1189 | if err := s.initConfigController(args); err != nil { |
| 1190 | return fmt.Errorf("error initializing config controller: %v", err) |
| 1191 | } |
| 1192 | if err := s.initServiceControllers(args); err != nil { |
| 1193 | return fmt.Errorf("error initializing service controllers: %v", err) |
| 1194 | } |
| 1195 | return nil |
| 1196 | } |
| 1197 | |
| 1198 | func (s *Server) initNodeUntaintController(args *PilotArgs) { |
| 1199 | if s.kubeClient == nil { |
no test coverage detected