Skip to content

Commit 1054fe7

Browse files
committed
Return an meaningful error when there is no cert and key for the default server
1 parent 8be9aa1 commit 1054fe7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nginx-controller/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var (
4848
defaultServerSecret = flag.String("default-server-tls-secret", "",
4949
`Specifies a secret with a TLS certificate and key for SSL termination of
5050
the default server. The value must follow the following format: <namespace>/<name>.
51-
If not specified, the key and the cert from /etc/nginx/default is used.`)
51+
If not specified, the key and the cert from /etc/nginx/secrets/default is used.`)
5252
)
5353

5454
func main() {
@@ -107,6 +107,11 @@ func main() {
107107

108108
bytes := nginx.GenerateCertAndKeyFileContent(secret)
109109
ngxc.AddOrUpdateSecretFile(nginx.DefaultServerSecretName, bytes, nginx.TLSSecretFileMode)
110+
} else {
111+
_, err = os.Stat("/etc/nginx/secrets/default")
112+
if os.IsNotExist(err) {
113+
glog.Fatalf("A TLS cert and key for the default server is not found")
114+
}
110115
}
111116

112117
nginxDone := make(chan error, 1)

0 commit comments

Comments
 (0)