From 1054fe753094a605c0f3a1f9c387e215397297a3 Mon Sep 17 00:00:00 2001 From: Michael Pleshakov Date: Tue, 5 Sep 2017 23:49:02 -0700 Subject: [PATCH] Return an meaningful error when there is no cert and key for the default server --- nginx-controller/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nginx-controller/main.go b/nginx-controller/main.go index beb7d09982..43f98747a5 100644 --- a/nginx-controller/main.go +++ b/nginx-controller/main.go @@ -48,7 +48,7 @@ var ( defaultServerSecret = flag.String("default-server-tls-secret", "", `Specifies a secret with a TLS certificate and key for SSL termination of the default server. The value must follow the following format: /. - If not specified, the key and the cert from /etc/nginx/default is used.`) + If not specified, the key and the cert from /etc/nginx/secrets/default is used.`) ) func main() { @@ -107,6 +107,11 @@ func main() { bytes := nginx.GenerateCertAndKeyFileContent(secret) ngxc.AddOrUpdateSecretFile(nginx.DefaultServerSecretName, bytes, nginx.TLSSecretFileMode) + } else { + _, err = os.Stat("/etc/nginx/secrets/default") + if os.IsNotExist(err) { + glog.Fatalf("A TLS cert and key for the default server is not found") + } } nginxDone := make(chan error, 1)