Skip to content

Commit 7e7535d

Browse files
AlexFenlonJim Ryan
andauthored
set staticSSLPath to a variable for reuse (nginx#6872)
Co-authored-by: Jim Ryan <[email protected]>
1 parent 2767500 commit 7e7535d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

cmd/nginx-ingress/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func main() {
8888
parsedFlags := os.Args[1:]
8989

9090
buildOS := os.Getenv("BUILD_OS")
91+
controllerNamespace := os.Getenv("POD_NAMESPACE")
9192

9293
config, kubeClient := mustCreateConfigAndKubeClient(ctx)
9394
mustValidateKubernetesVersionInfo(ctx, kubeClient)
@@ -146,6 +147,8 @@ func main() {
146147

147148
isWildcardEnabled := processWildcardSecret(ctx, kubeClient, nginxManager)
148149

150+
staticSSLPath := nginxManager.GetSecretsDir()
151+
149152
globalConfigurationValidator := createGlobalConfigurationValidator()
150153

151154
mustProcessGlobalConfiguration(ctx)
@@ -177,7 +180,7 @@ func main() {
177180
EnableCertManager: *enableCertManager,
178181
DynamicSSLReload: *enableDynamicSSLReload,
179182
DynamicWeightChangesReload: *enableDynamicWeightChangesReload,
180-
StaticSSLPath: nginxManager.GetSecretsDir(),
183+
StaticSSLPath: staticSSLPath,
181184
NginxVersion: nginxVersion,
182185
AppProtectBundlePath: appProtectBundlePath,
183186
}
@@ -211,8 +214,6 @@ func main() {
211214
NginxVersion: nginxVersion,
212215
})
213216

214-
controllerNamespace := os.Getenv("POD_NAMESPACE")
215-
216217
transportServerValidator := cr_validation.NewTransportServerValidator(*enableTLSPassthrough, *enableSnippets, *nginxPlus)
217218
virtualServerValidator := cr_validation.NewVirtualServerValidator(
218219
cr_validation.IsPlus(*nginxPlus),

internal/configs/version1/template_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
"github.com/nginxinc/kubernetes-ingress/internal/nginx"
1313
)
1414

15+
var fakeManager = nginx.NewFakeManager("/etc/nginx")
16+
1517
func TestMain(m *testing.M) {
1618
v := m.Run()
1719

@@ -2017,6 +2019,7 @@ var (
20172019
}
20182020

20192021
mainCfg = MainConfig{
2022+
StaticSSLPath: fakeManager.GetSecretsDir(),
20202023
DefaultHTTPListenerPort: 80,
20212024
DefaultHTTPSListenerPort: 443,
20222025
ServerNamesHashMaxSize: "512",
@@ -2061,6 +2064,7 @@ var (
20612064
}
20622065

20632066
mainCfgR31 = MainConfig{
2067+
StaticSSLPath: fakeManager.GetSecretsDir(),
20642068
DefaultHTTPListenerPort: 80,
20652069
DefaultHTTPSListenerPort: 443,
20662070
ServerNamesHashMaxSize: "512",
@@ -2090,6 +2094,7 @@ var (
20902094
}
20912095

20922096
mainCfgHTTP2On = MainConfig{
2097+
StaticSSLPath: fakeManager.GetSecretsDir(),
20932098
DefaultHTTPListenerPort: 80,
20942099
DefaultHTTPSListenerPort: 443,
20952100
HTTP2: true,
@@ -2130,6 +2135,7 @@ var (
21302135
}
21312136

21322137
mainCfgCustomTLSPassthroughPort = MainConfig{
2138+
StaticSSLPath: fakeManager.GetSecretsDir(),
21332139
ServerNamesHashMaxSize: "512",
21342140
ServerTokens: "off",
21352141
WorkerProcesses: "auto",
@@ -2157,6 +2163,7 @@ var (
21572163
}
21582164

21592165
mainCfgWithoutTLSPassthrough = MainConfig{
2166+
StaticSSLPath: fakeManager.GetSecretsDir(),
21602167
ServerNamesHashMaxSize: "512",
21612168
ServerTokens: "off",
21622169
WorkerProcesses: "auto",
@@ -2184,6 +2191,7 @@ var (
21842191
}
21852192

21862193
mainCfgDefaultTLSPassthroughPort = MainConfig{
2194+
StaticSSLPath: fakeManager.GetSecretsDir(),
21872195
ServerNamesHashMaxSize: "512",
21882196
ServerTokens: "off",
21892197
WorkerProcesses: "auto",
@@ -2211,6 +2219,7 @@ var (
22112219
}
22122220

22132221
mainCfgCustomDefaultHTTPAndHTTPSListenerPorts = MainConfig{
2222+
StaticSSLPath: fakeManager.GetSecretsDir(),
22142223
DefaultHTTPListenerPort: 8083,
22152224
DefaultHTTPSListenerPort: 8443,
22162225
ServerNamesHashMaxSize: "512",
@@ -2238,6 +2247,7 @@ var (
22382247
}
22392248

22402249
mainCfgCustomDefaultHTTPListenerPort = MainConfig{
2250+
StaticSSLPath: fakeManager.GetSecretsDir(),
22412251
DefaultHTTPListenerPort: 8083,
22422252
DefaultHTTPSListenerPort: 443,
22432253
ServerNamesHashMaxSize: "512",
@@ -2265,6 +2275,7 @@ var (
22652275
}
22662276

22672277
mainCfgCustomDefaultHTTPSListenerPort = MainConfig{
2278+
StaticSSLPath: fakeManager.GetSecretsDir(),
22682279
DefaultHTTPListenerPort: 80,
22692280
DefaultHTTPSListenerPort: 8443,
22702281
ServerNamesHashMaxSize: "512",

0 commit comments

Comments
 (0)