def resume(id, namespace, peering_name): """ Resume the resource handling in the cluster. """ config.login() ourselves = peering.Peer( id=id or peering.detect_own_id(), name=peering_name, namespace=namespace, ) ourselves.disappear()
def resume(id, namespace, peering): """ Resume the resource handling in the cluster. """ login() ourselves = Peer( id=id or detect_own_id(), peering=peering, namespace=namespace, ) ourselves.disappear()
def resume(id, namespace, peering_name): """ Resume the resource handling in the cluster. """ config.login() ourselves = peering.Peer( id=id or peering.detect_own_id(), name=peering_name, namespace=namespace, ) loop = asyncio.get_event_loop() loop.run_until_complete(ourselves.disappear())
def freeze(id, message, lifetime, namespace, peering, priority): """ Freeze the resource handling in the cluster. """ login() ourserlves = Peer( id=id or detect_own_id(), peering=peering, namespace=namespace, priority=priority, lifetime=lifetime, ) ourserlves.keepalive()
def test_direct_auth_works_incluster(mocker): # We do not test the client, we assume it works when used properly. core_api = mocker.patch.object(kubernetes.client, 'CoreApi') load_kube_config = mocker.patch.object(kubernetes.config, 'load_kube_config') load_incluster_config = mocker.patch.object(kubernetes.config, 'load_incluster_config') login() assert load_incluster_config.called assert not load_kube_config.called assert core_api.called # to verify that auth worked
def freeze(id, message, lifetime, namespace, peering_name, priority): """ Freeze the resource handling in the cluster. """ config.login() ourserlves = peering.Peer( id=id or peering.detect_own_id(), name=peering_name, namespace=namespace, priority=priority, lifetime=lifetime, ) loop = asyncio.get_event_loop() loop.run_until_complete(ourserlves.keepalive())
def run(paths, modules, peering, priority, standalone, namespace): """ Start an operator process and handle all the requests. """ login() preload( paths=paths, modules=modules, ) return real_run( standalone=standalone, namespace=namespace, priority=priority, peering=peering, )
def run(paths, modules, peering_name, priority, standalone, namespace): """ Start an operator process and handle all the requests. """ config.login() loading.preload( paths=paths, modules=modules, ) return queueing.run( standalone=standalone, namespace=namespace, priority=priority, peering_name=peering_name, )
def test_direct_api_fails(mocker): # We do not test the client, we assume it works when used properly. core_api = mocker.patch.object(kubernetes.client, 'CoreApi') load_kube_config = mocker.patch.object(kubernetes.config, 'load_kube_config') load_incluster_config = mocker.patch.object(kubernetes.config, 'load_incluster_config') core_api.side_effect = kubernetes.client.rest.ApiException(status=401) with pytest.raises(LoginError): login() assert load_incluster_config.called assert not load_kube_config.called assert core_api.called # to verify that auth worked