mirror of
https://github.com/alibaba/higress.git
synced 2026-05-28 14:47:29 +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 err != nil {
|
||||||
if k8serrors.IsNotFound(err) {
|
if k8serrors.IsNotFound(err) {
|
||||||
// If there is no matching secret, try to get it from configmap.
|
// If there is no matching secret, try to get it from configmap.
|
||||||
secretName = httpsCredentialConfig.MatchSecretNameByDomain(rule.Host)
|
matchSecretName := httpsCredentialConfig.MatchSecretNameByDomain(rule.Host)
|
||||||
|
if matchSecretName != "" {
|
||||||
|
namespace, secret := cert.ParseTLSSecret(matchSecretName)
|
||||||
|
if namespace == "" {
|
||||||
secretNamespace = c.options.SystemNamespace
|
secretNamespace = c.options.SystemNamespace
|
||||||
namespace, secret := cert.ParseTLSSecret(secretName)
|
} else {
|
||||||
if namespace != "" {
|
|
||||||
secretNamespace = namespace
|
secretNamespace = namespace
|
||||||
|
}
|
||||||
secretName = secret
|
secretName = secret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -417,11 +417,14 @@ func (c *controller) ConvertGateway(convertOptions *common.ConvertOptions, wrapp
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if k8serrors.IsNotFound(err) {
|
if k8serrors.IsNotFound(err) {
|
||||||
// If there is no matching secret, try to get it from configmap.
|
// If there is no matching secret, try to get it from configmap.
|
||||||
secretName = httpsCredentialConfig.MatchSecretNameByDomain(rule.Host)
|
matchSecretName := httpsCredentialConfig.MatchSecretNameByDomain(rule.Host)
|
||||||
|
if matchSecretName != "" {
|
||||||
|
namespace, secret := cert.ParseTLSSecret(matchSecretName)
|
||||||
|
if namespace == "" {
|
||||||
secretNamespace = c.options.SystemNamespace
|
secretNamespace = c.options.SystemNamespace
|
||||||
namespace, secret := cert.ParseTLSSecret(secretName)
|
} else {
|
||||||
if namespace != "" {
|
|
||||||
secretNamespace = namespace
|
secretNamespace = namespace
|
||||||
|
}
|
||||||
secretName = secret
|
secretName = secret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user