예제 #1
0
    def __init__(self) -> None:
        super().__init__()

        try:
            import pykube
        except ImportError:
            pass
        else:
            self.activity_handlers.append(handlers.ActivityHandler(
                id=handlers.HandlerId('login_via_pykube'),
                fn=cast(callbacks.ActivityFn, piggybacking.login_via_pykube),
                activity=handlers.Activity.AUTHENTICATION,
                errors=handlers.ErrorsMode.IGNORED,
                timeout=None, retries=None, backoff=None, cooldown=None,
                _fallback=True,
            ))
        try:
            import kubernetes
        except ImportError:
            pass
        else:
            self.activity_handlers.append(handlers.ActivityHandler(
                id=handlers.HandlerId('login_via_client'),
                fn=cast(callbacks.ActivityFn, piggybacking.login_via_client),
                activity=handlers.Activity.AUTHENTICATION,
                errors=handlers.ErrorsMode.IGNORED,
                timeout=None, retries=None, backoff=None, cooldown=None,
                _fallback=True,
            ))
예제 #2
0
파일: indexing.py 프로젝트: silveryfu/kopf
 def __getitem__(self, id: str) -> Index[Any, Any]:
     return self.__indexers[handlers.HandlerId(id)].index