Use env vars to set k8s endpoint URL
The old DNS method is optionally enabled in k8s, but the env vars are always there. partial solution to #864
This commit is contained in:
		
							parent
							
								
									30250bdf7f
								
							
						
					
					
						commit
						01fe548abd
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		|  | @ -10,7 +10,10 @@ from util.config.provider.fileprovider import FileConfigProvider | |||
| 
 | ||||
| logger = logging.getLogger(__name__) | ||||
| 
 | ||||
| KUBERNETES_API_HOST = 'kubernetes.default.svc.cluster.local' | ||||
| KUBERNETES_API_HOST = os.environ.get('KUBERNETES_SERVICE_HOST', '') | ||||
| port = os.environ.get('KUBERNETES_SERVICE_PORT') | ||||
| if port: | ||||
|   KUBERNETES_API_HOST += ':' + port | ||||
| 
 | ||||
| SERVICE_ACCOUNT_TOKEN_PATH = '/var/run/secrets/kubernetes.io/serviceaccount/token' | ||||
| 
 | ||||
|  |  | |||
		Reference in a new issue