@@ -78,7 +78,7 @@ func (r *Runner) Name() string {
7878}
7979
8080// Start starts the gateway-api translator runner
81- func (r * Runner ) Start (ctx context.Context ) ( err error ) {
81+ func (r * Runner ) Start (ctx context.Context ) error {
8282 r .Logger = r .Logger .WithName (r .Name ()).WithValues ("runner" , r .Name ())
8383
8484 go r .startWasmCache (ctx )
@@ -88,7 +88,7 @@ func (r *Runner) Start(ctx context.Context) (err error) {
8888
8989 go r .subscribeAndTranslate (c )
9090 r .Logger .Info ("started" )
91- return
91+ return nil
9292}
9393
9494func (r * Runner ) startWasmCache (ctx context.Context ) {
@@ -362,18 +362,19 @@ func (r *Runner) subscribeAndTranslate(sub <-chan watchable.Snapshot[string, *re
362362 r .Logger .Info ("shutting down" )
363363}
364364
365- func (r * Runner ) loadTLSConfig (ctx context.Context ) (tlsConfig * tls.Config , salt []byte , err error ) {
365+ func (r * Runner ) loadTLSConfig (ctx context.Context ) (* tls.Config , []byte , error ) {
366366 switch {
367367 case r .EnvoyGateway .Provider .IsRunningOnKubernetes ():
368- salt , err = hmac (ctx , r .ControllerNamespace )
368+ salt , err : = hmac (ctx , r .ControllerNamespace )
369369 if err != nil {
370370 return nil , nil , fmt .Errorf ("failed to get hmac secret: %w" , err )
371371 }
372372
373- tlsConfig , err = crypto .LoadTLSConfig (serveTLSCertFilepath , serveTLSKeyFilepath , serveTLSCaFilepath )
373+ tlsConfig , err : = crypto .LoadTLSConfig (serveTLSCertFilepath , serveTLSKeyFilepath , serveTLSCaFilepath )
374374 if err != nil {
375375 return nil , nil , fmt .Errorf ("failed to create tls config: %w" , err )
376376 }
377+ return tlsConfig , salt , nil
377378
378379 case r .EnvoyGateway .Provider .IsRunningOnHost ():
379380 // Get config
@@ -390,7 +391,7 @@ func (r *Runner) loadTLSConfig(ctx context.Context) (tlsConfig *tls.Config, salt
390391
391392 // Read HMAC secret
392393 hmacPath := filepath .Join (paths .CertDir ("envoy-oidc-hmac" ), "hmac-secret" )
393- salt , err = os .ReadFile (hmacPath )
394+ salt , err : = os .ReadFile (hmacPath )
394395 if err != nil {
395396 return nil , nil , fmt .Errorf ("failed to get hmac secret: %w" , err )
396397 }
@@ -400,15 +401,15 @@ func (r *Runner) loadTLSConfig(ctx context.Context) (tlsConfig *tls.Config, salt
400401 keyPath := filepath .Join (certDir , "tls.key" )
401402 caPath := filepath .Join (certDir , "ca.crt" )
402403
403- tlsConfig , err = crypto .LoadTLSConfig (certPath , keyPath , caPath )
404+ tlsConfig , err : = crypto .LoadTLSConfig (certPath , keyPath , caPath )
404405 if err != nil {
405406 return nil , nil , fmt .Errorf ("failed to create tls config: %w" , err )
406407 }
408+ return tlsConfig , salt , nil
407409
408410 default :
409411 return nil , nil , fmt .Errorf ("no valid tls certificates" )
410412 }
411- return
412413}
413414
414415func unstructuredToPolicyStatus (policyStatus map [string ]any ) gwapiv1.PolicyStatus {
@@ -684,7 +685,7 @@ func (r *Runner) deleteKeys(kc *KeyCache) {
684685
685686// hmac returns the HMAC secret generated by the CertGen job.
686687// hmac will be used as a hash salt to generate unguessable downloading paths for Wasm modules.
687- func hmac (ctx context.Context , namespace string ) (hmac []byte , err error ) {
688+ func hmac (ctx context.Context , namespace string ) ([]byte , error ) {
688689 // Get the HMAC secret.
689690 // HMAC secret is generated by the CertGen job and stored in a secret
690691 cfg , err := ctrl .GetConfig ()
@@ -707,5 +708,5 @@ func hmac(ctx context.Context, namespace string) (hmac []byte, err error) {
707708 return nil , fmt .Errorf (
708709 "HMAC secret not found in secret %s/%s" , namespace , hmacSecretName )
709710 }
710- return
711+ return hmac , err
711712}
0 commit comments