def get_env_vars(self): env_vars = get_internal_env_vars(service_internal_header=InternalServices.DOCKERIZER, namespace=self.namespace, authentication_type=AuthenticationTypes.INTERNAL_TOKEN, include_internal_token=True) if conf.get('REGISTRY_PASSWORD') and conf.get('REGISTRY_USER'): env_vars += [ get_env_var(name='POLYAXON_REGISTRY_USER', value=conf.get('REGISTRY_USER')), get_env_var(name='POLYAXON_REGISTRY_URI', value=conf.get('REGISTRY_LOCAL_URI')), get_from_secret('POLYAXON_REGISTRY_PASSWORD', 'registry-password', settings.POLYAXON_K8S_REGISTRY_SECRET_NAME), ] # Add private registries secrets keys for key in config.keys_startswith(settings.PRIVATE_REGISTRIES_PREFIX): env_vars.append(get_from_secret(key, key)) # Add set env lang get_env_var(name='POLYAXON_JOB_DOCKERIZER_SET_LANG_ENV', value=conf.get('JOB_DOCKERIZER_SET_LANG_ENV')) # Add security context if set if conf.get('JOB_DOCKERIZER_SET_SECURITY_CONTEXT'): get_env_var('POLYAXON_SECURITY_CONTEXT_USER', value=conf.get('SECURITY_CONTEXT_USER')) get_env_var('POLYAXON_SECURITY_CONTEXT_GROUP', value=conf.get('SECURITY_CONTEXT_GROUP')) return env_vars
def get_env_vars(self): env_vars = get_service_env_vars(namespace=self.namespace) for k, v in config.get_requested_data(to_str=True).items(): env_vars.append(get_env_var(name=k, value=v)) # Add private registries secrets keys for key in config.keys_startswith(settings.PRIVATE_REGISTRIES_PREFIX): env_vars.append(get_from_secret(key, key)) # Add repos access token secret key if settings.REPOS_ACCESS_TOKEN: env_vars.append(get_from_secret(settings.REPOS_ACCESS_TOKEN_KEY, settings.REPOS_ACCESS_TOKEN_KEY)) return env_vars
def test_get_from_secret(self): env_var = get_from_secret(key_name='foo', secret_key_name='secret_key', secret_ref_name='secret_ref') assert env_var.name == 'foo' assert isinstance(env_var.value_from, client.V1EnvVarSource) assert env_var.value_from.secret_key_ref.name == 'secret_ref' assert env_var.value_from.secret_key_ref.key == 'secret_key'
def get_env_vars(self): env_vars = get_service_env_vars(namespace=self.namespace) for k, v in config.get_requested_params(to_str=True).items(): env_vars.append(get_env_var(name=k, value=v)) # Add private registries secrets keys for key in config.params_startswith(settings.PRIVATE_REGISTRIES_PREFIX): env_vars.append(get_from_secret(key, key)) return env_vars
def get_env_vars(self): env_vars = get_internal_env_vars( service_internal_header=InternalServices.DOCKERIZER, namespace=self.namespace, authentication_type=AuthenticationTypes.INTERNAL_TOKEN) if conf.get('REGISTRY_PASSWORD') and conf.get('REGISTRY_USER'): env_vars += [ get_env_var(name='POLYAXON_REGISTRY_USER', value=conf.get('REGISTRY_USER')), get_env_var(name='POLYAXON_REGISTRY_URI', value=conf.get('REGISTRY_LOCAL_URI')), get_from_secret('POLYAXON_REGISTRY_PASSWORD', 'registry-password', settings.POLYAXON_K8S_REGISTRY_SECRET_NAME), ] # Add private registries secrets keys for key in config.keys_startswith(settings.PRIVATE_REGISTRIES_PREFIX): env_vars.append(get_from_secret(key, key)) return env_vars