-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nginx directory separate html (#481)
* Separate out html from config * Move snippets to files
- Loading branch information
1 parent
815de90
commit c3e89e7
Showing
7 changed files
with
57 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
(import 'config.libsonnet') | ||
+ (import 'configfile.libsonnet') | ||
+ (import 'html.libsonnet') | ||
+ (import 'deployment.libsonnet') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html> | ||
<head><title>Admin</title></head> | ||
<body> | ||
<h1>Admin</h1> | ||
<ul> | ||
%(links)s | ||
</ul> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<li><a href="/%(path)s%(params)s">%(title)s</a></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
worker_processes 5; ## Default: 1 | ||
error_log /dev/stderr; | ||
pid /tmp/nginx.pid; | ||
worker_rlimit_nofile 8192; | ||
|
||
events { | ||
worker_connections 4096; ## Default: 1024 | ||
} | ||
|
||
http { | ||
default_type application/octet-stream; | ||
log_format main '$remote_addr - $remote_user [$time_local] $status ' | ||
'"$request" $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
access_log /dev/stderr main; | ||
sendfile on; | ||
tcp_nopush on; | ||
resolver kube-dns.kube-system.svc.%(cluster_dns_suffix)s; | ||
server { | ||
listen 80; | ||
%(locations)s | ||
location ~ /(index.html)? { | ||
root /var/www/html; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
local k = import 'k.libsonnet'; | ||
local configMap = k.core.v1.configMap; | ||
{ | ||
|
||
nginx_html_config_map: | ||
local vars = { | ||
link_stanzas: [ | ||
(importstr 'files/link.html') % ({ params: '' } + service) | ||
for service in $._config.admin_services | ||
], | ||
links: std.join('\n', self.link_stanzas), | ||
}; | ||
|
||
configMap.new('nginx-config-html') + | ||
configMap.withData({ | ||
'index.html': (importstr 'files/index.html') % vars, | ||
}), | ||
} |