Fix flexVol serving of nginx certificates

FlexVol requires that you specify certificates as secrets in order to get both the certificate and private key in the appropriate format for nginx to consume. Additionally, flexvol shouldn't interfer with other secrets mounted in it's host directory.
This commit is contained in:
tomdds 2019-12-02 15:41:46 -05:00
parent df6ab4a016
commit 728bb5713f
3 changed files with 12 additions and 9 deletions

View File

@ -40,7 +40,7 @@ data:
listen ${PORT_PREFIX}442 ssl; listen ${PORT_PREFIX}442 ssl;
listen [::]:${PORT_PREFIX}442 ssl ipv6only=on; listen [::]:${PORT_PREFIX}442 ssl ipv6only=on;
ssl_certificate /etc/ssl/atat.crt; ssl_certificate /etc/ssl/atat.crt;
ssl_certificate_key /etc/ssl/atat.crt; ssl_certificate_key /etc/ssl/atat.key;
# additional SSL/TLS settings # additional SSL/TLS settings
include /etc/nginx/snippets/ssl.conf; include /etc/nginx/snippets/ssl.conf;
@ -73,7 +73,7 @@ data:
listen ${PORT_PREFIX}443 ssl; listen ${PORT_PREFIX}443 ssl;
listen [::]:${PORT_PREFIX}443 ssl ipv6only=on; listen [::]:${PORT_PREFIX}443 ssl ipv6only=on;
ssl_certificate /etc/ssl/atat.crt; ssl_certificate /etc/ssl/atat.crt;
ssl_certificate_key /etc/ssl/atat.crt; ssl_certificate_key /etc/ssl/atat.key;
# Request and validate client certificate # Request and validate client certificate
ssl_verify_client on; ssl_verify_client on;
ssl_verify_depth 10; ssl_verify_depth 10;

View File

@ -70,14 +70,14 @@ spec:
mountPath: "/etc/nginx/.htpasswd" mountPath: "/etc/nginx/.htpasswd"
subPath: .htpasswd subPath: .htpasswd
- name: nginx-client-ca-bundle - name: nginx-client-ca-bundle
mountPath: "/etc/ssl/" mountPath: "/etc/ssl/client-ca-bundle.pem"
subPath: "client-ca-bundle.pem"
- name: acme - name: acme
mountPath: "/usr/share/nginx/html/.well-known/acme-challenge/" mountPath: "/usr/share/nginx/html/.well-known/acme-challenge/"
- name: snippets - name: snippets
mountPath: "/etc/nginx/snippets/" mountPath: "/etc/nginx/snippets/"
- name: nginx-secret - name: nginx-secret
mountPath: "/etc/ssl/" mountPath: "/etc/ssl/"
readOnly: true
volumes: volumes:
- name: atst-config - name: atst-config
secret: secret:
@ -89,7 +89,10 @@ spec:
- name: nginx-client-ca-bundle - name: nginx-client-ca-bundle
configMap: configMap:
name: nginx-client-ca-bundle name: nginx-client-ca-bundle
defaultMode: 0666 defaultMode: 0444
items:
- key: "client-ca-bundle.pem"
path: "client-ca-bundle.pem"
- name: nginx-config - name: nginx-config
configMap: configMap:
name: atst-nginx name: atst-nginx
@ -134,9 +137,9 @@ spec:
options: options:
usepodidentity: "true" usepodidentity: "true"
keyvaultname: "atat-vault-test" keyvaultname: "atat-vault-test"
keyvaultobjectnames: "dhparam4096;master-cert" keyvaultobjectnames: "dhparam4096;master-cert;master-cert"
keyvaultobjectaliases: "dhparam.pem;atat.crt" keyvaultobjectaliases: "dhparam.pem;atat.key;atat.crt"
keyvaultobjecttypes: "secret;cert" keyvaultobjecttypes: "secret;secret;secret"
tenantid: $TENANT_ID tenantid: $TENANT_ID
--- ---
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1

View File

@ -10,4 +10,4 @@ spec:
flexVolume: flexVolume:
options: options:
keyvaultname: "atat-vault-test" keyvaultname: "atat-vault-test"
keyvaultobjectnames: "dhparam4096;staging-cert" keyvaultobjectnames: "dhparam4096;staging-cert;staging-cert"