-
Notifications
You must be signed in to change notification settings - Fork 2k
Dynamic reload of SSL certificates for NGINX Plus #4764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
232ae75
refactor helm args for deploy and daemonset, refactor several functio…
oseoin 59c3f8e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] a83ec1e
fix lint warnings
oseoin ec73051
Merge branch 'helm-args-and-config-sig-refactor' of github.com:nginxi…
oseoin 95cec66
lint-fixes
oseoin b32afbc
add flag for dynamic SSL reload
oseoin 99b59e8
skip reload for certs if dynamic reload enabled
oseoin 542e5e8
add dynamic certificate config
oseoin 1d361eb
Merge branch 'main' into dynamic-reload-ssl
oseoin 93c4260
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] d7178c7
lint fixes
oseoin 0f2c0d3
lint fixes
oseoin aa5347a
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin dd41f82
Merge branch 'main' into dynamic-reload-ssl
oseoin 2c59f5a
switch to template based reloading
oseoin 7451781
switch to template based reloading
oseoin a85fa13
Merge branch 'main' into dynamic-reload-ssl
oseoin caead12
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin 584889c
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin 0e832a9
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin aa0823a
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin f454801
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin fb6ea33
Merge branch 'main' into dynamic-reload-ssl
oseoin 726bec6
trigger reloads on config change when dynamic reloads are enabled
oseoin 5db4bf4
trigger reloads on config change when dynamic reloads are enabled
oseoin 6902ceb
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin 2e9d62b
lint changes
oseoin 77f3d0a
add certificate directory information to transportserver
oseoin 7e27fe9
remove redundant manager changes
oseoin ae23006
remove redundant manager changes
oseoin 83eeb3f
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin 16c2a45
fix bad merge
oseoin 26e185e
fix lint issue
oseoin 288b7db
add nolint for comparing file contents
oseoin 91178e5
properly fix G304 in manager.go
oseoin a426dd0
add missing map for streams
oseoin d420a6d
add python test for dynamic SSL reloads
oseoin 32b3a4c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 435e630
fix incorrect parameter value for transportServerConfig
oseoin 2d2725a
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin 83e2558
refine TLS reload count test
oseoin e1be9ea
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 3983f26
add secret checker for transportserver
oseoin 4e113c8
dynamic reload test for virtualserver
oseoin 3bd1d2d
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin 67cf342
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 716c469
re-add secret log quote
oseoin 183503d
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin 30b2f78
fix nil pointer on lbc.configMap
oseoin 420e60e
stable sorting of upstreams for consistent config gen
oseoin d3853bc
transportserver dynamic reload test
oseoin a5b7867
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 4bcf8db
add new tls certs for transportserver reload test
oseoin 6db0b2d
Merge branch 'dynamic-reload-ssl' of github.com:nginxinc/kubernetes-i…
oseoin a98c6d0
Merge branch 'main' into dynamic-reload-ssl
oseoin a36a9f8
docs and upstream order stability for virtual server
oseoin cfd97c3
mr feedback - test renaming
oseoin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Package commonhelpers contains template helpers used in v1 and v2 | ||
package commonhelpers | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
// MakeSecretPath will return the path to the secret with the base secrets | ||
// path replaced with the given variable | ||
func MakeSecretPath(path, defaultPath, variable string, useVariable bool) string { | ||
if useVariable { | ||
return strings.Replace(path, defaultPath, variable, 1) | ||
} | ||
return path | ||
} |
63 changes: 63 additions & 0 deletions
63
internal/configs/commonhelpers/common_template_helpers_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package commonhelpers | ||
|
||
import ( | ||
"bytes" | ||
"html/template" | ||
"testing" | ||
) | ||
|
||
var helperFunctions = template.FuncMap{ | ||
"makeSecretPath": MakeSecretPath, | ||
} | ||
|
||
func TestMakeSecretPath(t *testing.T) { | ||
t.Parallel() | ||
|
||
tmpl := newMakeSecretPathTemplate(t) | ||
testCases := []struct { | ||
Secret string | ||
Path string | ||
Variable string | ||
Enabled bool | ||
expected string | ||
}{ | ||
{ | ||
Secret: "/etc/nginx/secret/thing.crt", | ||
Path: "/etc/nginx/secret", | ||
Variable: "$secrets_path", | ||
Enabled: true, | ||
expected: "$secrets_path/thing.crt", | ||
}, | ||
{ | ||
Secret: "/etc/nginx/secret/thing.crt", | ||
Path: "/etc/nginx/secret", | ||
Variable: "$secrets_path", | ||
Enabled: false, | ||
expected: "/etc/nginx/secret/thing.crt", | ||
}, | ||
{ | ||
Secret: "/etc/nginx/secret/thing.crt", | ||
expected: "/etc/nginx/secret/thing.crt", | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
var buf bytes.Buffer | ||
err := tmpl.Execute(&buf, tc) | ||
if err != nil { | ||
t.Fatalf("Failed to execute the template %v", err) | ||
} | ||
if buf.String() != tc.expected { | ||
t.Errorf("Template generated wrong config, got '%v' but expected '%v'.", buf.String(), tc.expected) | ||
} | ||
} | ||
} | ||
|
||
func newMakeSecretPathTemplate(t *testing.T) *template.Template { | ||
t.Helper() | ||
tmpl, err := template.New("testTemplate").Funcs(helperFunctions).Parse(`{{makeSecretPath .Secret .Path .Variable .Enabled}}`) | ||
if err != nil { | ||
t.Fatalf("Failed to parse template: %v", err) | ||
} | ||
return tmpl | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.