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

[MRG] Adding Turing cluster to the Federation #1203

Merged
merged 72 commits into from
Jan 15, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
e5aa421
Ignore vscode settings
sgibson91 Oct 15, 2019
3042925
Add Turing config file
sgibson91 Oct 15, 2019
3803833
Add turing_mybinder_org_ingress.yaml file
sgibson91 Oct 15, 2019
3c8b681
Filling in config/turing.yaml
sgibson91 Oct 15, 2019
34a13c8
Add turing secrets
sgibson91 Oct 16, 2019
2f46a52
Add turing k8s auth to deploy.py
sgibson91 Oct 16, 2019
740a190
Correct path to Azure auth key file
sgibson91 Oct 16, 2019
91084fa
Add Turing cluster to Travis deployment:
sgibson91 Oct 16, 2019
b4ce725
Update .travis.yml
sgibson91 Oct 16, 2019
d36d083
Remove turing ingress yaml file
sgibson91 Oct 22, 2019
b04b5ef
Remove unnecessary keys from turing.yaml
sgibson91 Oct 22, 2019
53ff293
Replacing subdomains with temp ones
sgibson91 Oct 22, 2019
c160858
Correct dict key in deploy.py
sgibson91 Oct 22, 2019
16d4058
Correct args to deploy.py
sgibson91 Oct 22, 2019
32cf222
Expose configMap as variable to secret/ban.py
sgibson91 Oct 22, 2019
a33d1b4
Updating deploy.py and ban.py
sgibson91 Oct 22, 2019
bebd871
Merge branch 'master' into sgibson91/add-turing-to-federation
sgibson91 Oct 22, 2019
47efb4b
Revert "Remove unnecessary keys from turing.yaml"
sgibson91 Oct 22, 2019
c876f7a
Revert "Remove turing ingress yaml file"
sgibson91 Oct 22, 2019
ea9cf37
Update secrets/ban.py to match master branch
sgibson91 Nov 25, 2019
f3a13f7
Merge branch 'master' into sgibson91/add-turing-to-federation
sgibson91 Nov 25, 2019
2f9eac5
Remove vscode from .gitignore
sgibson91 Nov 25, 2019
0e52984
Updating secrets/ban.py for turing cluster
sgibson91 Nov 25, 2019
b31a8bd
Update turing config
sgibson91 Nov 25, 2019
d627123
Add empty serviceAccountField for matomo
sgibson91 Nov 26, 2019
c201d2f
Add missing arg to func in deploy.py
sgibson91 Nov 26, 2019
0c6ecdf
Remove events-archiver-secrets volume mount
sgibson91 Nov 26, 2019
ae5fc80
Remove turing ingress yaml
sgibson91 Nov 26, 2019
be56858
Revert "Remove events-archiver-secrets volume mount"
sgibson91 Nov 26, 2019
5c6fdc7
Tweaking Turing
betatim Nov 29, 2019
ca690ef
Update mybinder/requirements.yaml
betatim Nov 29, 2019
ce237c9
Merge pull request #1283 from betatim/turing-tweaking
sgibson91 Dec 2, 2019
7f36411
Remove temp return line
sgibson91 Dec 2, 2019
daa9e1d
Reduce turing pod quota
sgibson91 Dec 3, 2019
e584920
Change turing domain name
sgibson91 Dec 6, 2019
fcca53d
Add certmanager cluster issuer
sgibson91 Dec 6, 2019
a607a18
Add lets encrypt contact email to turing config
sgibson91 Dec 6, 2019
1af09a3
Delete cluster issuer
sgibson91 Dec 6, 2019
f300d01
Use letsencrypt-staging in turing config
sgibson91 Dec 6, 2019
02d07bf
Add cert-manager cluster issuer file
sgibson91 Dec 6, 2019
8bff176
Configure certmanager
sgibson91 Dec 6, 2019
ab79ae3
Configure lets encrypt staging
sgibson91 Dec 6, 2019
6ecab8e
Configure prod lets encrypt
sgibson91 Dec 6, 2019
bc1d204
Include turing cluster in the federation
sgibson91 Dec 6, 2019
1b2214c
Merge branch 'master' into sgibson91/add-turing-to-federation
sgibson91 Dec 6, 2019
f93b9f0
Neaten up deploy.py
sgibson91 Dec 6, 2019
e9d81ca
Add ingress file for redirection to turing.mybinder.org
sgibson91 Dec 10, 2019
603ff21
Rename turing secrets
sgibson91 Dec 10, 2019
660a71d
Update turing hostname in values
sgibson91 Dec 10, 2019
c87ee4e
Add turing.mybinder.org host
sgibson91 Dec 10, 2019
37b18c2
Merge branch 'master' into sgibson91/add-turing-to-federation
sgibson91 Dec 11, 2019
56d2c80
Remove if statement in deploy.py
sgibson91 Dec 11, 2019
2026451
Temporarily change letsencrypt issuer to staging
sgibson91 Dec 11, 2019
922164b
Remove playground and beta hosts
sgibson91 Dec 11, 2019
4785290
Remove ingress shim for certmanager
sgibson91 Dec 11, 2019
5ac8f08
Move cluster issuer into templates folder
sgibson91 Dec 11, 2019
6c3c3ff
Remove ingress config
sgibson91 Dec 11, 2019
4810127
Add if statements to cluster issuer file
sgibson91 Dec 11, 2019
d3f6393
Correct cluster issuer syntax
sgibson91 Dec 11, 2019
c0710f8
Undo if statements in cluster issuer
sgibson91 Dec 11, 2019
d1d1b64
Re-add if statements to cluster issuer file
sgibson91 Dec 11, 2019
912b6ca
Change certificates back to prod
sgibson91 Dec 11, 2019
2c4c10d
Rearrange annotations
sgibson91 Dec 11, 2019
9be810f
Rearrange if statement in cluster issuer
sgibson91 Dec 11, 2019
8a843ac
Change turing A records
sgibson91 Dec 12, 2019
c3f8621
Merge branch 'master' into sgibson91/add-turing-to-federation
sgibson91 Jan 6, 2020
8485ee5
Correct hub url for turing cluster in travis config
sgibson91 Jan 6, 2020
20bf03e
Update host and secret names
sgibson91 Jan 6, 2020
812e82c
Update step numbers in travis config
sgibson91 Jan 7, 2020
0cb52cf
Enable https to fix lets encrypt
sgibson91 Jan 7, 2020
3a7c999
Issue certificates for grafana
sgibson91 Jan 7, 2020
08959f7
Add grafana admin password to turing secrets config
sgibson91 Jan 10, 2020
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ mybinder/requirements.lock
docs/_build
travis/crypt-key
env

.vscode
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ before_deploy:
- |
# Stage 1: Install gcloud SDK
curl -L https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-173.0.0-linux-x86_64.tar.gz | tar --directory ${HOME} --extract --gzip --file -
- |
# Stage 1: Install Azure CLI
curl -L https://aka.ms/InstallAzureCli | bash
- |
# Stage 1: Install Kubectl
mkdir -p ${HOME}/bin
Expand Down Expand Up @@ -90,12 +93,17 @@ before_deploy:
- |
# Stage 5, Step 3: Deploy to production on ovh k8s
python ./deploy.py ovh binder-ovh
- |
# Stage 5, Step 4: Deploy to production on Turing k8s
python ./deploy.py prod turing
- |
# Stage 5, Step 4: Verify production works
travis_retry py.test -vx -n 2 --binder-url=https://gke.mybinder.org --hub-url=https://hub.gke.mybinder.org
- |
# Stage 5, Step 5: Verify production on ovh k8s works
travis_retry py.test -vx -n 2 --binder-url=https://ovh.mybinder.org --hub-url=https://hub-binder.mybinder.ovh
- # Stage 5, Step 6: Verify production on Turing k8s works
sgibson91 marked this conversation as resolved.
Show resolved Hide resolved
travis_retry py.test -vx -n 2 --binder-url=https://turing.mybinder.org --hub-url=https://hub.turing.mybinder.org
sgibson91 marked this conversation as resolved.
Show resolved Hide resolved


env:
Expand Down
190 changes: 190 additions & 0 deletions config/turing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
projectName: turing

binderhub:
config:
BinderHub:
pod_quota: 120
hub_url: https://hub.turing.mybinder.org
badge_base_url: https://mybinder.org
image_prefix: turingmybinderregistry.azurecr.io/binder-prod/binder-prod-
sticky_builds: true
DockerRegistry:
token_url: https://turingmybinderregistry.azurecr.io/oauth2/token?service=turingmybinderregistry.azurecr.io
registry:
url: https://turingmybinderregistry.azurecr.io

replicas: 1

resources:
requests:
cpu: "0.25"
memory: 1Gi
limits:
cpu: "2"
memory: 1Gi

extraVolumes:
- name: secrets
secret:
secretName: events-archiver-secrets
extraVolumeMounts:
- name: secrets
mountPath: /secrets
readOnly: true
extraEnv:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /secrets/service-account.json

ingress:
hosts:
- turing.mybinder.org

jupyterhub:
hub:
resources:
requests:
cpu: "0.25"
memory: 1Gi
limits:
cpu: "2"
memory: 1Gi
singleuser:
memory:
guarantee: 550M
limit: 2G
cpu:
guarantee: 0.01
limit: 1
proxy:
https:
type: offload
chp:
resources:
requests:
memory: 320Mi
cpu: "0.1"
limits:
memory: 320Mi
cpu: "0.5"
nginx:
resources:
requests:
memory: 512Mi
cpu: "0.25"
limits:
memory: 512Mi
cpu: 1

ingress:
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: 'false'
hosts:
- hub.turing.mybinder.org
tls:
- secretName: tls-crt
hosts:
- hub.turing.mybinder.org

scheduling:
userScheduler:
enabled: false
podPriority:
enabled: true
userPlaceholder:
enabled: true
replicas: 5

grafana:
ingress:
annotations:
kubernetes.io/ingress.class: nginx
sgibson91 marked this conversation as resolved.
Show resolved Hide resolved
kubernetes.io/tls-acme: 'false'
hosts:
- grafana-turing.mybinder.org
tls:
- hosts:
- grafana-turing.mybinder.org
secretName: tls-crt-turing
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: prometheus
orgId: 1
type: prometheus
url: https://prometheus-turing.mybinder.org
access: direct
isDefault: true
editable: false

prometheus:
server:
ingress:
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: 'false'
hosts:
- prometheus-turing.mybinder.org
tls:
- hosts:
- prometheus-turing.mybinder.org
secretName: tls-crt-turing

nginx-ingress:
controller:
hostNetwork: true
replicaCount: 1
scope:
enabled: false


static:
ingress:
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: 'false'
hosts:
- static-turing.mybinder.org
tls:
- hosts:
- static-turing.mybinder.org
secretName: tls-crt-turing

redirector:
redirects:
- type: host
betatim marked this conversation as resolved.
Show resolved Hide resolved
# host:
# from: beta-binder.mybinder.ovh
# to: binder.mybinder.ovh
- type: host
host:
from: docs-turing.mybinder.org
to: mybinder.readthedocs.io
- type: host
betatim marked this conversation as resolved.
Show resolved Hide resolved
host:
from: playground-turing.mybinder.org
to: play.nteract.io

matomo:
enabled: false
db:
instanceName: binder-staging:us-central1:matomo
trustedHosts:
- staging-turing.mybinder.org
ingress:
hosts:
- staging-turing.mybinder.org

analyticsPublisher:
enabled: false
project: binder-turing
events:
sourceBucket: mybinder-staging-events-raw-export
destinationBucket: mybinder-staging-events-archive

gcsProxy:
enabled: false
buckets:
- name: mybinder-staging-events-archive
host: archive-analytics-staging-turing.mybinder.org
22 changes: 22 additions & 0 deletions config/turing/turing_mybinder_org_ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: extensions/v1beta1
betatim marked this conversation as resolved.
Show resolved Hide resolved
kind: Ingress
metadata:
name: turing-mybinder-org
annotations:
kubernetes.io/tls-acme: "true"
kubernetes.io/ingress.class: "nginx"
spec:
rules:
# May need to be replaced with a dummy for testing
- host: turing.mybinder.org
http:
paths:
- path: /
backend:
serviceName: binder
servicePort: 8585
tls:
- secretName: kubelego-tls-binder-turing
hosts:
# May need to be replaced with a dummy for testing
- "turing.mybinder.org"
30 changes: 30 additions & 0 deletions deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,34 @@
HERE = os.path.dirname(__file__)
ABSOLUTE_HERE = os.path.dirname(os.path.realpath(__file__))

def setup_auth_turing():
"""
Set up athentication with Turing k8s cluster on Azure.
"""
# Read in auth info
azure_file = os.path.join(ABSOLUTE_HERE, "secrets", "turing-auth-key-prod.json")
with open(azure_file, "r") as stream:
azure = json.load(stream)

# Login in to Azure
login_cmd = [
"az", "login", "--service-principal",
"--username", azure["sp-app-id"],
"--password", azure["sp-app-key"],
"--tenant", azure["tenant"]
]
subprocess.check_output(login_cmd)

# Set kubeconfig
creds_cmd = [
"az", "aks", "get-credentials",
"--name", "prod",
"--resource-group", "binder-prod"

]
stdout = subprocess.check_output(creds_cmd)
print(stdout.decode('utf-8'))


def setup_auth_ovh(release, cluster):
"""
Expand Down Expand Up @@ -181,6 +209,8 @@ def main():

if args.cluster == 'binder-ovh':
setup_auth_ovh(args.release, args.cluster)
elif args.cluster == 'turing':
setup_auth_turing()
else:
setup_auth_gcloud(args.release, args.cluster)

Expand Down
Binary file added secrets/config/turing.yaml
Binary file not shown.
Binary file added secrets/turing-auth-key-prod.json
Binary file not shown.