@@ -102,12 +102,11 @@ type podEndpoint struct {
102
102
}
103
103
104
104
type specialSecrets struct {
105
- defaultServerSecret string
106
- wildcardTLSSecret string
107
- licenseSecret string
108
- clientAuthSecret string
109
- mgmtTrustedCertSecret string
110
- otelTrustedCertSecret string
105
+ defaultServerSecret string
106
+ wildcardTLSSecret string
107
+ licenseSecret string
108
+ clientAuthSecret string
109
+ trustedCertSecret string
111
110
}
112
111
113
112
type controllerMetadata struct {
@@ -255,7 +254,7 @@ func NewLoadBalancerController(input NewLoadBalancerControllerInput) *LoadBalanc
255
254
if input .IsNginxPlus {
256
255
specialSecrets .licenseSecret = fmt .Sprintf ("%s/%s" , input .ControllerNamespace , input .NginxConfigurator .MgmtCfgParams .Secrets .License )
257
256
specialSecrets .clientAuthSecret = fmt .Sprintf ("%s/%s" , input .ControllerNamespace , input .NginxConfigurator .MgmtCfgParams .Secrets .ClientAuth )
258
- specialSecrets .mgmtTrustedCertSecret = fmt .Sprintf ("%s/%s" , input .ControllerNamespace , input .NginxConfigurator .MgmtCfgParams .Secrets .TrustedCert )
257
+ specialSecrets .trustedCertSecret = fmt .Sprintf ("%s/%s" , input .ControllerNamespace , input .NginxConfigurator .MgmtCfgParams .Secrets .TrustedCert )
259
258
}
260
259
lbc := & LoadBalancerController {
261
260
client : input .KubeClient ,
@@ -925,7 +924,7 @@ func (lbc *LoadBalancerController) updateAllConfigs() {
925
924
if _ , hasCRL := secret .Data [configs .CACrlKey ]; hasCRL {
926
925
lbc .configurator .MgmtCfgParams .Secrets .TrustedCRL = secret .Name
927
926
}
928
- lbc .specialSecrets .mgmtTrustedCertSecret = fmt .Sprintf ("%s/%s" , secret .Namespace , secret .Name )
927
+ lbc .specialSecrets .trustedCertSecret = fmt .Sprintf ("%s/%s" , secret .Namespace , secret .Name )
929
928
lbc .handleSpecialSecretUpdate (secret , reloadNginx )
930
929
}
931
930
// update special ClientAuth secret in mgmtConfigParams
@@ -1844,9 +1843,7 @@ func (lbc *LoadBalancerController) isSpecialSecret(secretName string) bool {
1844
1843
return true
1845
1844
case lbc .specialSecrets .clientAuthSecret :
1846
1845
return true
1847
- case lbc .specialSecrets .mgmtTrustedCertSecret :
1848
- return true
1849
- case lbc .specialSecrets .otelTrustedCertSecret :
1846
+ case lbc .specialSecrets .trustedCertSecret :
1850
1847
return true
1851
1848
default :
1852
1849
return false
@@ -1921,12 +1918,7 @@ func (lbc *LoadBalancerController) handleSpecialSecretUpdate(secret *api_v1.Secr
1921
1918
if ok := lbc .performNGINXReload (secret ); ! ok {
1922
1919
return
1923
1920
}
1924
- case lbc .specialSecrets .mgmtTrustedCertSecret :
1925
- lbc .updateAllConfigs ()
1926
- if ok := lbc .performNGINXReload (secret ); ! ok {
1927
- return
1928
- }
1929
- case lbc .specialSecrets .otelTrustedCertSecret :
1921
+ case lbc .specialSecrets .trustedCertSecret :
1930
1922
lbc .updateAllConfigs ()
1931
1923
if ok := lbc .performNGINXReload (secret ); ! ok {
1932
1924
return
@@ -1952,9 +1944,7 @@ func (lbc *LoadBalancerController) writeSpecialSecrets(secret *api_v1.Secret, sp
1952
1944
return false
1953
1945
}
1954
1946
case secrets .SecretTypeCA :
1955
- if lbc .specialSecrets .mgmtTrustedCertSecret != "" {
1956
- lbc .configurator .AddOrUpdateCASecret (secret , fmt .Sprintf ("mgmt/%s" , configs .CACrtKey ), fmt .Sprintf ("mgmt/%s" , configs .CACrlKey ))
1957
- }
1947
+ lbc .configurator .AddOrUpdateCASecret (secret , fmt .Sprintf ("mgmt/%s" , configs .CACrtKey ), fmt .Sprintf ("mgmt/%s" , configs .CACrlKey ))
1958
1948
case api_v1 .SecretTypeTLS :
1959
1949
// if the secret name matches the specified
1960
1950
if secretNsName == mgmtClientAuthNamespaceName {
@@ -1991,7 +1981,7 @@ func (lbc *LoadBalancerController) specialSecretValidation(secretNsName string,
1991
1981
return false
1992
1982
}
1993
1983
}
1994
- if secretNsName == lbc .specialSecrets .mgmtTrustedCertSecret {
1984
+ if secretNsName == lbc .specialSecrets .trustedCertSecret {
1995
1985
err := secrets .ValidateCASecret (secret )
1996
1986
if err != nil {
1997
1987
nl .Errorf (lbc .Logger , "Couldn't validate the special Secret %v: %v" , secretNsName , err )
@@ -2007,14 +1997,6 @@ func (lbc *LoadBalancerController) specialSecretValidation(secretNsName string,
2007
1997
return false
2008
1998
}
2009
1999
}
2010
- if secretNsName == lbc .specialSecrets .otelTrustedCertSecret {
2011
- err := secrets .ValidateCASecret (secret )
2012
- if err != nil {
2013
- nl .Errorf (lbc .Logger , "Couldn't validate the special Secret %v: %v" , secretNsName , err )
2014
- lbc .recorder .Eventf (lbc .metadata .pod , api_v1 .EventTypeWarning , nl .EventReasonRejected , "the special Secret %v was rejected, using the previous version: %v" , secretNsName , err )
2015
- return false
2016
- }
2017
- }
2018
2000
return true
2019
2001
}
2020
2002
0 commit comments