File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5858 # NOTE(bacongobbler): use deis/registry_proxy to work around Docker --insecure-registry requirements
5959 - name : " DEIS_REGISTRY_SERVICE_HOST"
6060 value : " localhost"
61+ - name : " K8S_API_VERIFY_TLS"
62+ value : " {{ .Values.k8s_api_verify_tls }}"
6163 - name : " DEIS_REGISTRY_SERVICE_PORT"
6264 value : " {{ .Values.global.host_port }}"
6365 - name : " APP_STORAGE"
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ app_pull_policy: "Always"
99# disabled - turns off open registration
1010# admin_only - allows for registration by an admin only.
1111registration_mode : " enabled"
12+ # Option to disable ssl verification to connect to k8s api server
13+ k8s_api_verify_tls : " true"
1214
1315global :
1416 # Set the storage backend
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ class Meta:
4747 @property
4848 def _scheduler (self ):
4949 mod = importlib .import_module (settings .SCHEDULER_MODULE )
50- return mod .SchedulerClient (settings .SCHEDULER_URL )
50+ return mod .SchedulerClient (settings .SCHEDULER_URL , settings . K8S_API_VERIFY_TLS )
5151
5252 def _fetch_service_config (self , app ):
5353 try :
Original file line number Diff line number Diff line change 247247 os .environ .get ('KUBERNETES_SERVICE_PORT' , '443' )
248248)
249249
250+ K8S_API_VERIFY_TLS = bool (strtobool (os .environ .get ('K8S_API_VERIFY_TLS' , 'true' )))
251+
250252# security keys and auth tokens
251253random_secret = 'CHANGEME_sapm$s%upvsw5l_zuy_&29rkywd^78ff(qi*#@&*^'
252254SECRET_KEY = os .environ .get ('DEIS_SECRET_KEY' , random_secret )
Original file line number Diff line number Diff line change 1717resource_mapping = OrderedDict ()
1818
1919
20- def get_session ():
20+ def get_session (k8s_api_verify_tls ):
2121 global session
2222 if session is None :
2323 with open ('/var/run/secrets/kubernetes.io/serviceaccount/token' ) as token_file :
@@ -28,18 +28,21 @@ def get_session():
2828 'Content-Type' : 'application/json' ,
2929 'User-Agent' : user_agent ('Deis Controller' , deis_version )
3030 }
31- session .verify = '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'
31+ if k8s_api_verify_tls :
32+ session .verify = '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'
33+ else :
34+ session .verify = False
3235 return session
3336
3437
3538class KubeHTTPClient (object ):
3639 # ISO-8601 which is used by kubernetes
3740 DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
3841
39- def __init__ (self , url ):
42+ def __init__ (self , url , k8s_api_verify_tls = True ):
4043 global resource_mapping
4144 self .url = url
42- self .session = get_session ()
45+ self .session = get_session (k8s_api_verify_tls )
4346
4447 # map the various k8s Resources to an internal property
4548 from scheduler .resources import Resource # lazy load
Original file line number Diff line number Diff line change @@ -907,7 +907,7 @@ def session():
907907
908908
909909class MockSchedulerClient (KubeHTTPClient ):
910- def __init__ (self , url ):
910+ def __init__ (self , url , k8s_api_verify_tls = True ):
911911 super ().__init__ (url )
912912
913913 # set version data
You can’t perform that action at this time.
0 commit comments