Skip to content

Commit 888f348

Browse files
committed
feat(scheduler): send the Deis Controller and version as the User-Agent to k8s api requests
1 parent 5f2ee41 commit 888f348

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

rootfs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ PyOpenSSL==0.15.1
1414
pytz==2015.7
1515
PyYAML==3.11
1616
requests==2.9.1
17+
requests-toolbelt==0.6.0
1718
simpleflock==0.0.3

rootfs/scheduler/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
from docker import Client
1111
from .states import JobState
1212
import requests
13+
from requests_toolbelt import user_agent
1314
from .utils import dict_merge
1415

16+
from deis import __version__ as deis_version
17+
1518

1619
logger = logging.getLogger(__name__)
1720

@@ -307,6 +310,7 @@ def __init__(self):
307310
session.headers = {
308311
'Authorization': 'Bearer ' + token,
309312
'Content-Type': 'application/json',
313+
'User-Agent': user_agent('Deis Controller', deis_version)
310314
}
311315
# TODO: accessing the k8s api server by IP address rather than hostname avoids
312316
# intermittent DNS errors, but at the price of disabling cert verification.

0 commit comments

Comments
 (0)