Skip to content

Commit

Permalink
Merge pull request #112 from keithcallenberg/patch-1
Browse files Browse the repository at this point in the history
fix service account setting
  • Loading branch information
yuvipanda committed Dec 9, 2017
2 parents db33084 + cb20653 commit aa03c5c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kubespawner/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def make_pod(
hack_volumes = []
hack_volume_mounts = []

pod.service_account_name = service_account
pod.spec.service_account_name = service_account

if run_privileged:
container_security_context = V1SecurityContext()
Expand Down
44 changes: 44 additions & 0 deletions tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,3 +795,47 @@ def test_make_resources_all():
}
}
}


def test_make_pod_with_service_account():
"""
Test specification of the simplest possible pod specification with non-default service account
"""
assert api_client.sanitize_for_serialization(make_pod(
name='test',
image_spec='jupyter/singleuser:latest',
cmd=['jupyterhub-singleuser'],
port=8888,
image_pull_policy='IfNotPresent',
service_account='test'
)) == {
"metadata": {
"name": "test",
"labels": {},
},
"spec": {
"securityContext": {},
"containers": [
{
"env": [],
"name": "notebook",
"image": "jupyter/singleuser:latest",
"imagePullPolicy": "IfNotPresent",
"args": ["jupyterhub-singleuser"],
"ports": [{
"name": "notebook-port",
"containerPort": 8888
}],
'volumeMounts': [],
"resources": {
"limits": {},
"requests": {}
}
}
],
'volumes': [],
'serviceAccountName': 'test'
},
"kind": "Pod",
"apiVersion": "v1"
}

0 comments on commit aa03c5c

Please sign in to comment.