Compare commits

..

2 Commits

Author SHA1 Message Date
Brad Davidson
7ad41853e0 Do not update memory storage with a nil secret (#205)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-15 11:19:38 -07:00
Brad Davidson
d9174a1f59 Fix panic on nil secret (#204)
Use configured secret namespace/name in error message, to avoid panicing if the secret is invalid because it is nil

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2025-09-12 14:11:40 -07:00
4 changed files with 6 additions and 3 deletions

View File

@@ -17,4 +17,4 @@ jobs:
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: 'go.mod'
- run: go env -w GOTOOLCHAIN=go1.25.0+auto && go test -v -race -cover ./...
- run: go test -v -race -cover ./...

2
go.mod
View File

@@ -2,7 +2,7 @@ module github.com/rancher/dynamiclistener
go 1.24.0
toolchain go1.25.1
toolchain go1.24.3
require (
github.com/rancher/wrangler/v3 v3.2.2-rc.3

View File

@@ -212,7 +212,7 @@ func (s *storage) saveInK8s(secret *v1.Secret) (*v1.Secret, error) {
// ensure that the merged secret actually contains data before overwriting the existing fields
if !cert.IsValidTLSSecret(secret) {
logrus.Warnf("Skipping save of TLS secret for %s/%s due to missing certificate data", secret.Namespace, secret.Name)
logrus.Warnf("Skipping save of TLS secret for %s/%s due to missing certificate data", s.namespace, s.name)
return targetSecret, nil
}

View File

@@ -47,6 +47,9 @@ func (m *memory) Update(secret *v1.Secret) error {
}
func isChanged(old, new *v1.Secret) bool {
if new == nil {
return false
}
if old == nil {
return true
}