Skip to content

Commit

Permalink
[ci] make test hello speak https (#10192)
Browse files Browse the repository at this point in the history
* [tls] make hello use tls

* change pylint ignore message
  • Loading branch information
daniel-goldstein authored Mar 17, 2021
1 parent 5d89225 commit 022d02f
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 10 deletions.
2 changes: 2 additions & 0 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2811,6 +2811,8 @@ steps:
mkdir -p ./ci/test ./hail/python
cp /repo/hail/ci/test/resources/build.yaml ./
cp -R /repo/hail/ci/test/resources ./ci/test/
cp /repo/hail/tls/Dockerfile ./ci/test/resources/Dockerfile.certs
cp /repo/hail/tls/create_certs.py ./ci/test/resources/
cp /repo/hail/pylintrc ./
cp /repo/hail/setup.cfg ./
cp -R /repo/hail/docker ./
Expand Down
30 changes: 30 additions & 0 deletions ci/test/resources/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,36 @@ steps:
publishAs: service-base
dependsOn:
- base_image
- kind: buildImage
name: create_certs_image
dockerFile: ci/test/resources/Dockerfile.certs
contextPath: ci/test/resources
publishAs: test_hello_create_certs_image
dependsOn:
- service_base_image
- kind: runImage
name: create_certs
image:
valueFrom: create_certs_image.image
script: |
set -ex
python3 create_certs.py \
{{ default_ns.name }} \
config.yaml \
/ssl-config-hail-root/hail-root-key.pem \
/ssl-config-hail-root/hail-root-cert.pem
serviceAccount:
name: admin
namespace:
valueFrom: default_ns.name
secrets:
- name: ssl-config-hail-root
namespace:
valueFrom: default_ns.name
mountPath: /ssl-config-hail-root
dependsOn:
- default_ns
- create_certs_image
- kind: buildImage
name: hello_image
dockerFile: ci/test/resources/Dockerfile
Expand Down
4 changes: 4 additions & 0 deletions ci/test/resources/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
principals:
- name: hello
domain: hello
kind: json
10 changes: 8 additions & 2 deletions ci/test/resources/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ spec:
- name: session-secret-key
mountPath: /session-secret-key
readOnly: true
- name: ssl-config
mountPath: /ssl-config
readOnly: true
env:
- name: HAIL_IP
valueFrom:
Expand All @@ -74,6 +77,10 @@ spec:
secret:
optional: false
secretName: session-secret-key
- name: ssl-config
secret:
optional: false
secretName: ssl-config-hello
---
apiVersion: v1
kind: Service
Expand All @@ -83,8 +90,7 @@ metadata:
app: hello
spec:
ports:
- name: http
port: 80
- port: 443
protocol: TCP
targetPort: 5000
selector:
Expand Down
9 changes: 6 additions & 3 deletions ci/test/resources/hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from aiohttp import web

from hailtop.config import get_deploy_config
from hailtop.tls import internal_server_ssl_context
from gear import setup_aiohttp_session


Expand All @@ -14,15 +15,17 @@


@routes.get('/healthcheck')
async def get_healthcheck(request): # pylint: disable=W0613
async def get_healthcheck(request): # pylint: disable=unused-argument
return web.Response()


@routes.get('/sha')
async def get_sha(request):
async def get_sha(request): # pylint: disable=unused-argument
return web.Response(text=SHA)


setup_aiohttp_session(app)
app.add_routes(routes)
web.run_app(deploy_config.prefix_application(app, 'hello'), host='0.0.0.0', port=5000)
web.run_app(
deploy_config.prefix_application(app, 'hello'), host='0.0.0.0', port=5000, ssl_context=internal_server_ssl_context()
)
10 changes: 8 additions & 2 deletions ci/test/resources/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ spec:
- name: session-secret-key
mountPath: /session-secret-key
readOnly: true
- name: ssl-config
mountPath: /ssl-config
readOnly: true
env:
- name: HAIL_IP
value: "{{ global.ip }}"
Expand All @@ -67,6 +70,10 @@ spec:
secret:
optional: false
secretName: session-secret-key
- name: ssl-config
secret:
optional: false
secretName: ssl-config-hello
---
apiVersion: v1
kind: Service
Expand All @@ -76,8 +83,7 @@ metadata:
app: hello-stateful-set
spec:
ports:
- name: http
port: 80
- port: 443
protocol: TCP
targetPort: 5000
selector:
Expand Down
3 changes: 1 addition & 2 deletions router/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ metadata:
app: hello
spec:
ports:
- name: http
port: 80
- port: 443
protocol: TCP
targetPort: 5000
selector:
Expand Down
2 changes: 1 addition & 1 deletion router/router.nginx.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ server {
server_name hello.*;

location / {
proxy_pass http://hello/;
proxy_pass https://hello/;
include /etc/nginx/proxy.conf;
}

Expand Down

0 comments on commit 022d02f

Please sign in to comment.