Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] make test hello speak https #10192

Merged
merged 2 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this file do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tells create_certs.py which applications to make certificates for and what the format of the kubernetes secret should be. JSON is used for all of the aiohttp services and nginx is for nginx proxies. This mirrors tls/config.yaml, I just didn't want to throw hello in there with the real services.

- 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