|
| 1 | +# Divi Demo Service |
| 2 | +apiVersion: v1 |
| 3 | +kind: Service |
| 4 | +metadata: |
| 5 | + name: d5-demo-server |
| 6 | + namespace: d5d-app |
| 7 | +spec: |
| 8 | + selector: |
| 9 | + app: d5-demo-server |
| 10 | + ports: |
| 11 | + - port: 9000 |
| 12 | + targetPort: 9000 |
| 13 | + name: fastcgi |
| 14 | +--- |
| 15 | + |
| 16 | +apiVersion: apps/v1 |
| 17 | +kind: Deployment |
| 18 | +metadata: |
| 19 | + name: d5-demo-server |
| 20 | + namespace: d5d-app |
| 21 | + labels: |
| 22 | + app: d5-demo-server |
| 23 | +spec: |
| 24 | + replicas: {{ .Values.REPLICAS }} |
| 25 | + strategy: |
| 26 | + rollingUpdate: |
| 27 | + maxSurge: 0 |
| 28 | + maxUnavailable: 1 |
| 29 | + selector: |
| 30 | + matchLabels: |
| 31 | + app: d5-demo-server |
| 32 | + template: |
| 33 | + metadata: |
| 34 | + labels: |
| 35 | + app: d5-demo-server |
| 36 | + spec: |
| 37 | + affinity: |
| 38 | + podAffinity: |
| 39 | + requiredDuringSchedulingIgnoredDuringExecution: |
| 40 | + - labelSelector: |
| 41 | + matchExpressions: |
| 42 | + - key: app.kubernetes.io/name |
| 43 | + operator: In |
| 44 | + values: |
| 45 | + - ingress-nginx |
| 46 | + namespaces: |
| 47 | + - ingress-nginx |
| 48 | + topologyKey: kubernetes.io/hostname |
| 49 | + podAntiAffinity: |
| 50 | + requiredDuringSchedulingIgnoredDuringExecution: |
| 51 | + - labelSelector: |
| 52 | + matchExpressions: |
| 53 | + - key: app |
| 54 | + operator: In |
| 55 | + values: |
| 56 | + - d5-demo-server |
| 57 | + namespaces: |
| 58 | + - d5d-app |
| 59 | + topologyKey: kubernetes.io/hostname |
| 60 | + initContainers: |
| 61 | + - name: init |
| 62 | + env: |
| 63 | + - name: NODE_NAME |
| 64 | + valueFrom: |
| 65 | + fieldRef: |
| 66 | + fieldPath: spec.nodeName |
| 67 | + - name: DEMO_SERVER_PATH |
| 68 | + value: {{ .Values.INSTALL_PATH | squote }} |
| 69 | + - name: VIRTUAL_HOST |
| 70 | + value: {{ .Values.VIRTUAL_HOST | squote }} |
| 71 | + - name: DEMO_SERVER_REPO_URL |
| 72 | + value: {{ .Values.DEMO_SERVER_REPO_URL | squote }} |
| 73 | + - name: IMAGE_VERSION |
| 74 | + value: {{ .Values.DEMO_SERVER_VERSION | squote }} |
| 75 | + - name: DEMO_SERVER_INIT |
| 76 | + value: '1' |
| 77 | + - name: DIVI_VERSION |
| 78 | + value: {{ .Values.DIVI_VERSION | squote }} |
| 79 | + - name: PHP_OPCACHE_FILE_CACHE |
| 80 | + value: {{ ternary "/var/cache/php" "" (eq "production" .Values.WP_ENV) | squote }} |
| 81 | + - name: PHP_OPCACHE_VALIDATE_TIMESTAMPS |
| 82 | + value: {{ ternary "false" "true" (eq "production" .Values.WP_ENV) | squote }} |
| 83 | + image: {{ .Values.DEMO_SERVER_IMAGE | squote }} |
| 84 | + command: ['/etc/cont-init.d/init'] |
| 85 | + resources: |
| 86 | + requests: |
| 87 | + cpu: 100m |
| 88 | + memory: 100Mi |
| 89 | + limits: |
| 90 | + cpu: '4' |
| 91 | + memory: 2G |
| 92 | + volumeMounts: |
| 93 | + - name: wordpress |
| 94 | + mountPath: /srv |
| 95 | + - name: config |
| 96 | + mountPath: /config |
| 97 | + readOnly: true |
| 98 | + containers: |
| 99 | + - name: app |
| 100 | + env: |
| 101 | + - name: NODE_NAME |
| 102 | + valueFrom: |
| 103 | + fieldRef: |
| 104 | + fieldPath: spec.nodeName |
| 105 | + - name: DEMO_SERVER_PATH |
| 106 | + value: {{ .Values.INSTALL_PATH | squote }} |
| 107 | + - name: VIRTUAL_HOST |
| 108 | + value: {{ .Values.VIRTUAL_HOST | squote }} |
| 109 | + - name: DEMO_SERVER_REPO_URL |
| 110 | + value: {{ .Values.DEMO_SERVER_REPO_URL | squote }} |
| 111 | + - name: IMAGE_VERSION |
| 112 | + value: {{ .Values.DEMO_SERVER_VERSION | squote }} |
| 113 | + - name: PHP_OPCACHE_FILE_CACHE |
| 114 | + value: {{ ternary "/var/cache/php" "" (eq "production" .Values.WP_ENV) | squote }} |
| 115 | + - name: PHP_OPCACHE_VALIDATE_TIMESTAMPS |
| 116 | + value: {{ ternary "false" "true" (eq "production" .Values.WP_ENV) | squote }} |
| 117 | + - name: DIVI_VERSION |
| 118 | + value: {{ .Values.DIVI_VERSION | squote }} |
| 119 | + - name: DEMO_SERVER_PHP |
| 120 | + value: '1' |
| 121 | + |
| 122 | + image: {{ .Values.DEMO_SERVER_IMAGE | squote }} |
| 123 | + livenessProbe: |
| 124 | + exec: |
| 125 | + command: |
| 126 | + - 'bash' |
| 127 | + - '-c' |
| 128 | + - 'SCRIPT_NAME=/healthz' |
| 129 | + - 'SCRIPT_FILENAME={{ .Values.INSTALL_PATH }}/web/healthz.php' |
| 130 | + - 'REQUEST_METHOD=GET' |
| 131 | + - 'cgi-fcgi' |
| 132 | + - '-bind' |
| 133 | + - '-connect' |
| 134 | + - '127.0.0.1:9000' |
| 135 | + periodSeconds: 30 |
| 136 | + ports: |
| 137 | + - name: fastcgi |
| 138 | + containerPort: 9000 |
| 139 | + readinessProbe: |
| 140 | + exec: |
| 141 | + command: |
| 142 | + - 'bash' |
| 143 | + - '-c' |
| 144 | + - 'SCRIPT_NAME=/healthz' |
| 145 | + - 'SCRIPT_FILENAME={{ .Values.INSTALL_PATH }}/web/healthz.php' |
| 146 | + - 'REQUEST_METHOD=GET' |
| 147 | + - 'cgi-fcgi' |
| 148 | + - '-bind' |
| 149 | + - '-connect' |
| 150 | + - '127.0.0.1:9000' |
| 151 | + periodSeconds: 10 |
| 152 | + resources: |
| 153 | + requests: |
| 154 | + cpu: 100m |
| 155 | + memory: 100Mi |
| 156 | + limits: |
| 157 | + cpu: '5' |
| 158 | + memory: 2G |
| 159 | + startupProbe: |
| 160 | + exec: |
| 161 | + command: |
| 162 | + - cat |
| 163 | + - {{ .Values.INSTALL_PATH }}/web/healthz.php |
| 164 | + failureThreshold: 30 |
| 165 | + periodSeconds: 10 |
| 166 | + volumeMounts: |
| 167 | + - name: wordpress |
| 168 | + mountPath: /srv |
| 169 | + - name: config |
| 170 | + mountPath: /config |
| 171 | + readOnly: true |
| 172 | + |
| 173 | + - name: database |
| 174 | + env: |
| 175 | + - name: NODE_NAME |
| 176 | + valueFrom: |
| 177 | + fieldRef: |
| 178 | + fieldPath: spec.nodeName |
| 179 | + - name: DEMO_SERVER_PATH |
| 180 | + value: {{ .Values.INSTALL_PATH | squote }} |
| 181 | + - name: VIRTUAL_HOST |
| 182 | + value: {{ .Values.VIRTUAL_HOST | squote }} |
| 183 | + - name: DEMO_SERVER_REPO_URL |
| 184 | + value: {{ .Values.DEMO_SERVER_REPO_URL | squote }} |
| 185 | + - name: IMAGE_VERSION |
| 186 | + value: {{ .Values.DEMO_SERVER_VERSION | squote }} |
| 187 | + - name: PHP_OPCACHE_FILE_CACHE |
| 188 | + value: {{ ternary "/var/cache/php" "" (eq "production" .Values.WP_ENV) | squote }} |
| 189 | + - name: PHP_OPCACHE_VALIDATE_TIMESTAMPS |
| 190 | + value: {{ ternary "false" "true" (eq "production" .Values.WP_ENV) | squote }} |
| 191 | + - name: DEMO_SERVER_DATABASE |
| 192 | + value: '1' |
| 193 | + |
| 194 | + image: {{ .Values.DEMO_SERVER_IMAGE | squote }} |
| 195 | + livenessProbe: |
| 196 | + exec: |
| 197 | + command: |
| 198 | + - 'mysqladmin' |
| 199 | + - 'ping' |
| 200 | + initialDelaySeconds: 5 |
| 201 | + periodSeconds: 20 |
| 202 | + ports: |
| 203 | + - name: mysql |
| 204 | + containerPort: 3306 |
| 205 | + readinessProbe: |
| 206 | + exec: |
| 207 | + command: |
| 208 | + - 'mysqladmin' |
| 209 | + - 'ping' |
| 210 | + initialDelaySeconds: 5 |
| 211 | + periodSeconds: 10 |
| 212 | + resources: |
| 213 | + requests: |
| 214 | + cpu: 100m |
| 215 | + memory: 100Mi |
| 216 | + limits: |
| 217 | + cpu: '2' |
| 218 | + memory: 1G |
| 219 | + startupProbe: |
| 220 | + exec: |
| 221 | + command: |
| 222 | + - 'mysqladmin' |
| 223 | + - 'ping' |
| 224 | + failureThreshold: 30 |
| 225 | + initialDelaySeconds: 5 |
| 226 | + periodSeconds: 10 |
| 227 | + volumeMounts: |
| 228 | + - name: wordpress |
| 229 | + mountPath: /srv |
| 230 | + - name: config |
| 231 | + mountPath: /config |
| 232 | + readOnly: true |
| 233 | + |
| 234 | + - name: redis |
| 235 | + env: |
| 236 | + - name: NODE_NAME |
| 237 | + valueFrom: |
| 238 | + fieldRef: |
| 239 | + fieldPath: spec.nodeName |
| 240 | + - name: DEMO_SERVER_PATH |
| 241 | + value: {{ .Values.INSTALL_PATH | squote }} |
| 242 | + - name: VIRTUAL_HOST |
| 243 | + value: {{ .Values.VIRTUAL_HOST | squote }} |
| 244 | + - name: DEMO_SERVER_REPO_URL |
| 245 | + value: {{ .Values.DEMO_SERVER_REPO_URL | squote }} |
| 246 | + - name: IMAGE_VERSION |
| 247 | + value: {{ .Values.DEMO_SERVER_VERSION | squote }} |
| 248 | + - name: PHP_OPCACHE_FILE_CACHE |
| 249 | + value: {{ ternary "/var/cache/php" "" (eq "production" .Values.WP_ENV) | squote }} |
| 250 | + - name: PHP_OPCACHE_VALIDATE_TIMESTAMPS |
| 251 | + value: {{ ternary "false" "true" (eq "production" .Values.WP_ENV) | squote }} |
| 252 | + - name: DEMO_SERVER_REDIS |
| 253 | + value: '1' |
| 254 | + |
| 255 | + image: {{ .Values.DEMO_SERVER_IMAGE | squote }} |
| 256 | + livenessProbe: |
| 257 | + exec: |
| 258 | + command: |
| 259 | + - 'redis-cli' |
| 260 | + - 'ping' |
| 261 | + initialDelaySeconds: 5 |
| 262 | + periodSeconds: 20 |
| 263 | + ports: |
| 264 | + - name: mysql |
| 265 | + containerPort: 3306 |
| 266 | + readinessProbe: |
| 267 | + exec: |
| 268 | + command: |
| 269 | + - 'redis-cli' |
| 270 | + - 'ping' |
| 271 | + initialDelaySeconds: 5 |
| 272 | + periodSeconds: 10 |
| 273 | + resources: |
| 274 | + requests: |
| 275 | + cpu: 100m |
| 276 | + memory: 100Mi |
| 277 | + limits: |
| 278 | + cpu: '2' |
| 279 | + memory: 1G |
| 280 | + startupProbe: |
| 281 | + exec: |
| 282 | + command: |
| 283 | + - 'redis-cli' |
| 284 | + - 'ping' |
| 285 | + failureThreshold: 30 |
| 286 | + initialDelaySeconds: 5 |
| 287 | + periodSeconds: 10 |
| 288 | + volumeMounts: |
| 289 | + - name: wordpress |
| 290 | + mountPath: /srv |
| 291 | + - name: config |
| 292 | + mountPath: /config |
| 293 | + readOnly: true |
| 294 | + |
| 295 | + volumes: |
| 296 | + - name: wordpress |
| 297 | + hostPath: |
| 298 | + path: /srv |
| 299 | + type: DirectoryOrCreate |
| 300 | + - name: config |
| 301 | + secret: |
| 302 | + secretName: secrets |
0 commit comments