Skip to content
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

Return a meaningful error when there is no cert and key for the default server #184

Merged
merged 1 commit into from Sep 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion nginx-controller/main.go
Expand Up @@ -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: <namespace>/<name>.
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() {
Expand Down Expand Up @@ -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)
Expand Down