fix: do not present challenge for Gateway API if feature not enabled

Signed-off-by: Miguel Varela Ramos <miguel@cohere.ai>
This commit is contained in:
Miguel Varela Ramos 2024-07-18 11:49:27 +01:00
parent f357097eb6
commit 8a8df8a3c7
No known key found for this signature in database
GPG Key ID: A6E2B8DFE1668FFD

View File

@ -125,6 +125,9 @@ func (s *Solver) Present(ctx context.Context, issuer v1.GenericIssuer, ch *cmacm
return utilerrors.NewAggregate([]error{podErr, svcErr, ingressErr})
}
if ch.Spec.Solver.HTTP01.GatewayHTTPRoute != nil {
if !s.GatewaySolverEnabled {
return fmt.Errorf("couldn't Present challenge %s/%s: gateway api is not enabled", ch.Namespace, ch.Name)
}
_, gatewayErr = s.ensureGatewayHTTPRoute(ctx, ch, svcName)
return utilerrors.NewAggregate([]error{podErr, svcErr, gatewayErr})
}