mirror of
https://github.com/alibaba/higress.git
synced 2026-02-06 15:10:54 +08:00
fix: fallbackForInvalidSecret to return original secret (#1245)
This commit is contained in:
@@ -431,11 +431,14 @@ func (c *controller) ConvertGateway(convertOptions *common.ConvertOptions, wrapp
|
||||
if err != nil {
|
||||
if k8serrors.IsNotFound(err) {
|
||||
// If there is no matching secret, try to get it from configmap.
|
||||
secretName = httpsCredentialConfig.MatchSecretNameByDomain(rule.Host)
|
||||
secretNamespace = c.options.SystemNamespace
|
||||
namespace, secret := cert.ParseTLSSecret(secretName)
|
||||
if namespace != "" {
|
||||
secretNamespace = namespace
|
||||
matchSecretName := httpsCredentialConfig.MatchSecretNameByDomain(rule.Host)
|
||||
if matchSecretName != "" {
|
||||
namespace, secret := cert.ParseTLSSecret(matchSecretName)
|
||||
if namespace == "" {
|
||||
secretNamespace = c.options.SystemNamespace
|
||||
} else {
|
||||
secretNamespace = namespace
|
||||
}
|
||||
secretName = secret
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,11 +417,14 @@ func (c *controller) ConvertGateway(convertOptions *common.ConvertOptions, wrapp
|
||||
if err != nil {
|
||||
if k8serrors.IsNotFound(err) {
|
||||
// If there is no matching secret, try to get it from configmap.
|
||||
secretName = httpsCredentialConfig.MatchSecretNameByDomain(rule.Host)
|
||||
secretNamespace = c.options.SystemNamespace
|
||||
namespace, secret := cert.ParseTLSSecret(secretName)
|
||||
if namespace != "" {
|
||||
secretNamespace = namespace
|
||||
matchSecretName := httpsCredentialConfig.MatchSecretNameByDomain(rule.Host)
|
||||
if matchSecretName != "" {
|
||||
namespace, secret := cert.ParseTLSSecret(matchSecretName)
|
||||
if namespace == "" {
|
||||
secretNamespace = c.options.SystemNamespace
|
||||
} else {
|
||||
secretNamespace = namespace
|
||||
}
|
||||
secretName = secret
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user