@@ -30,7 +30,6 @@ func NewDefaultConfig() *Config {
3030 LeaderElectionID : DefaultLeaderElectionID ,
3131 ProbeAddr : DefaultProbeAddr ,
3232 MetricsAddr : DefaultMetricsAddr ,
33- IngressClass : DefaultIngressClass ,
3433 LeaderElection : NewLeaderElection (),
3534 }
3635}
@@ -84,21 +83,13 @@ func NewConfigFromFile(filename string) (*Config, error) {
8483}
8584
8685func (c * Config ) Validate () error {
87-
88- if len (c .GatewayConfigs ) == 0 {
89- return fmt .Errorf ("gateway_configs config is required" )
90- }
91- for _ , gc := range c .GatewayConfigs {
92- if err := c .validateGatewayConfig (gc ); err != nil {
93- return fmt .Errorf ("failed to validate control_planes: %w" , err )
94- }
95- }
9686 if c .ControllerName == "" {
9787 return fmt .Errorf ("controller_name is required" )
9888 }
9989 return nil
10090}
10191
92+ //nolint:unused
10293func (c * Config ) validateGatewayConfig (gc * GatewayConfig ) error {
10394
10495 if gc .Name == "" {
@@ -118,75 +109,6 @@ func (c *Config) validateGatewayConfig(gc *GatewayConfig) error {
118109 return nil
119110}
120111
121- var gatewayNameMap map [string ]* GatewayConfig
122- var gatewayNameList []string
123-
124- func initGatewayNameMap () {
125- if gatewayNameMap == nil {
126- gatewayNameMap = make (map [string ]* GatewayConfig )
127- for _ , gc := range ControllerConfig .GatewayConfigs {
128- gatewayNameMap [gc .Name ] = gc
129- }
130- }
131- }
132-
133- func GetControlPlaneConfigByGatewatName (gatewatName string ) * ControlPlaneConfig {
134- initGatewayNameMap ()
135- if gc , ok := gatewayNameMap [gatewatName ]; ok {
136- return gc .ControlPlane
137- }
138- return nil
139- }
140-
141- func GetGatewayConfig (gatewayName string ) * GatewayConfig {
142- initGatewayNameMap ()
143- if gc , ok := gatewayNameMap [gatewayName ]; ok {
144- return gc
145- }
146- return nil
147- }
148-
149- func GetFirstGatewayConfig () * GatewayConfig {
150- if len (ControllerConfig .GatewayConfigs ) > 0 {
151- return ControllerConfig .GatewayConfigs [0 ]
152- }
153- return nil
154- }
155-
156- func GetGatewayAddresses (gatewayName string ) []string {
157- initGatewayNameMap ()
158- if gc , ok := gatewayNameMap [gatewayName ]; ok {
159- return gc .Addresses
160- }
161- return nil
162- }
163-
164- func GatewayConfigs () []* GatewayConfig {
165- return ControllerConfig .GatewayConfigs
166- }
167-
168- func GatewayNameList () []string {
169- if gatewayNameList == nil {
170- gatewayNameList = make ([]string , 0 , len (ControllerConfig .GatewayConfigs ))
171- for _ , gc := range ControllerConfig .GatewayConfigs {
172- gatewayNameList = append (gatewayNameList , gc .Name )
173- }
174- }
175- return gatewayNameList
176- }
177-
178- func GetIngressClass () string {
179- return ControllerConfig .IngressClass
180- }
181-
182- func GetIngressPublishService () string {
183- return ControllerConfig .IngressPublishService
184- }
185-
186- func GetIngressStatusAddress () []string {
187- return ControllerConfig .IngressStatusAddress
188- }
189-
190112func GetControllerName () string {
191113 return ControllerConfig .ControllerName
192114}
0 commit comments