Avoid panic when secret is nil

This commit is contained in:
Darren Shepherd 2021-06-15 22:40:41 -07:00
parent dc7452dbb8
commit ff22834bde

View File

@ -179,7 +179,7 @@ func populateCN(secret *v1.Secret, cn ...string) *v1.Secret {
// IsStatic returns true if the Secret has an attribute indicating that it contains
// a static (aka user-provided) certificate, which should not be modified.
func IsStatic(secret *v1.Secret) bool {
if secret.Annotations != nil {
if secret != nil && secret.Annotations != nil {
return secret.Annotations[Static] == "true"
}
return false