Skip to content

Commit

Permalink
Use custom default backend that provides support (#263)
Browse files Browse the repository at this point in the history
* feat: use custom default backend that provides support

We make use of a custom 404 backend that provides some basic help text
This can be extended later to provide debugging information links to docs
  • Loading branch information
drubin authored and edvald committed Oct 23, 2018
1 parent 06786c3 commit b533a6b
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
12 changes: 12 additions & 0 deletions garden-service/static/kubernetes/system/default-backend/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<body>
<h2>Garden</h2>
404 Not Found — We've got some good news and some bad news:
<ul>
<li>Garden is running. 🎉</li>
<li>This URL didn't match any configured ingress route. 🙈</li>
</ul>
We suggest running <code>garden get status</code> to check the exposed endpoints and whether your services are deployed and healthy. 🚀
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM nginx:1.15.3-alpine

ADD nginx.conf /etc/nginx/conf.d/default.conf
ADD 404.html /opt/local/html/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module:
name: default-backend
description: Default backend ingress controller
type: container
services:
- name: default-backend
ports:
- name: http
containerPort: 80
27 changes: 27 additions & 0 deletions garden-service/static/kubernetes/system/default-backend/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# The default server.
server {
listen 80 default_server;
listen 8080;
server_name _;

root /opt/local/html;

error_page 404 /404.html;

# needs to respond to /healthz for http health checks on port 8080
location /healthz {
return 200 'OK!';
# To see reply in browser
add_header Content-Type text/plain;

}
# Everything is a 404
location / {
return 404;
}

# EDIT: You may need this to prevent return 404; recursion
location = /404.html {
internal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ module:
name: ingress-controller
type: helm
chart: stable/nginx-ingress
dependencies:
- default-backend
version: 0.25.1
parameters:
name: ingress-controller
controller:
defaultBackendService: garden-system/default-backend
kind: DaemonSet
daemonset:
useHostPort: true
defaultBackend:
enabled: false

0 comments on commit b533a6b

Please sign in to comment.