@@ -3,7 +3,8 @@ local utils = import '../vendor/kube-prod-runtime/lib/utils.libsonnet';
3
3
4
4
local IMAGE = 'nginx:1.15.12' ;
5
5
local WWW_VOLUME_PATH = '/usr/share/nginx/html' ;
6
- local CONFIG_PATH = '/etc/nginx/conf.d' ;
6
+ local CONFIG_TOP_LEVEL_PATH = '/etc/nginx/nginx.conf' ;
7
+ local CONFIG_DEFAULT_PATH = '/etc/nginx/conf.d' ;
7
8
local HTTP_PORT = 80 ;
8
9
9
10
{
@@ -46,6 +47,38 @@ local HTTP_PORT = 80;
46
47
47
48
configMap: kube.ConfigMap($.name) + $.metadata {
48
49
data+: {
50
+ 'nginx.conf': |||
51
+ user nginx;
52
+ worker_processes 1;
53
+
54
+ error_log /var/log/nginx/error.log warn;
55
+ pid /var/run/nginx.pid;
56
+
57
+
58
+ events {
59
+ worker_connections 1024;
60
+ }
61
+
62
+
63
+ http {
64
+ include /etc/nginx/mime.types;
65
+ default_type application/octet-stream;
66
+
67
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
68
+ '$status $body_bytes_sent "$http_referer" '
69
+ '"$http_user_agent" "$http_x_forwarded_for"';
70
+
71
+ access_log /var/log/nginx/access.log main;
72
+
73
+ sendfile on;
74
+
75
+ keepalive_timeout 65;
76
+
77
+ server_names_hash_bucket_size 256;
78
+
79
+ include /etc/nginx/conf.d/*.conf;
80
+ }
81
+ ||| ,
49
82
'default.conf': |||
50
83
server {
51
84
listen 80;
@@ -135,14 +168,22 @@ local HTTP_PORT = 80;
135
168
landingpage: kube.Container($.app) {
136
169
local container = self ,
137
170
image: IMAGE,
171
+ args: [
172
+ 'nginx' ,
173
+ '-g' ,
174
+ 'daemon off;' ,
175
+ '-c' ,
176
+ CONFIG_TOP_LEVEL_PATH,
177
+ ],
138
178
resources: {
139
179
requests: { cpu: '10m' , memory: '64Mi' },
140
180
},
141
181
ports_+: {
142
182
http: { containerPort: HTTP_PORT },
143
183
},
144
184
volumeMounts_+: {
145
- config: { mountPath: CONFIG_PATH },
185
+ config_top_level: { name: 'config' , mountPath: CONFIG_TOP_LEVEL_PATH, subPath: 'nginx.conf' },
186
+ config_default: { name: 'config' , mountPath: CONFIG_DEFAULT_PATH + '/default.conf' , subPath: 'default.conf' },
146
187
} + if $.index then { www: { mountPath: WWW_VOLUME_PATH } } else {},
147
188
readinessProbe: {
148
189
httpGet: { path: '/' , port: HTTP_PORT },
0 commit comments