Exemplo n.º 1
0
async def startup(settings: kopf.OperatorSettings, **kwargs):
    config.load()
    if (
        config.WEBHOOK_PASSWORD is not None
        and config.WEBHOOK_URL is not None
        and config.WEBHOOK_USERNAME is not None
    ):
        webhook_client.configure(
            config.WEBHOOK_URL, config.WEBHOOK_USERNAME, config.WEBHOOK_PASSWORD
        )

    settings.persistence.diffbase_storage = kopf.AnnotationsDiffBaseStorage(
        prefix=KOPF_STATE_STORE_PREFIX, key="last", v1=False
    )
    settings.persistence.finalizer = f"operator.{API_GROUP}/finalizer"
    settings.persistence.progress_storage = kopf.AnnotationsProgressStorage(
        prefix=KOPF_STATE_STORE_PREFIX, v1=False
    )

    # Timeout passed along to the Kubernetes API as timeoutSeconds=x
    settings.watching.server_timeout = 300
    # Total number of seconds for a whole watch request per aiohttp:
    # https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientTimeout.total
    settings.watching.client_timeout = 300
    # Timeout for attempting to connect to the peer per aiohttp:
    # https://docs.aiohttp.org/en/stable/client_reference.html#aiohttp.ClientTimeout.sock_connect
    settings.watching.connect_timeout = 30
    # Wait for that many seconds between watching events
    settings.watching.reconnect_backoff = 1
Exemplo n.º 2
0
Arquivo: l7mp.py Projeto: l7mp/l7mp
def startup_fn(settings: kopf.OperatorSettings, logger, **kw):
    settings.persistence.finalizer = 'operator.l7mp.io/kopf-finalizer'
    settings.persistence.progress_storage = kopf.AnnotationsProgressStorage(
        prefix='operator.l7mp.io')
    settings.persistence.diffbase_storage = kopf.AnnotationsDiffBaseStorage(
        prefix='operator.l7mp.io',
    )
def configure(settings: kopf.OperatorSettings, logger: kopf.Logger,
              **_: Any) -> None:
    settings.persistence.progress_storage = kopf.MultiProgressStorage([
        kopf.AnnotationsProgressStorage(prefix="orbit.aws"),
        kopf.StatusProgressStorage(field="status.orbit-aws"),
    ])
    settings.persistence.finalizer = "podsetting-operator.orbit.aws/kopf-finalizer"
    settings.posting.level = logging.getLevelName(
        os.environ.get("EVENT_LOG_LEVEL", "INFO"))
Exemplo n.º 4
0
def configure(settings: kopf.OperatorSettings, logger: kopf.Logger, **_: Any) -> None:
    settings.admission.server = kopf.WebhookServer(
        cafile="/certs/ca.crt",
        certfile="/certs/tls.crt",
        pkeyfile="/certs/tls.key",
        port=443,
    )
    settings.persistence.progress_storage = kopf.MultiProgressStorage(
        [
            kopf.AnnotationsProgressStorage(prefix="orbit.aws"),
            kopf.StatusProgressStorage(field="status.orbit-aws"),
        ]
    )
    settings.persistence.finalizer = "podsetting-pod-webhook.orbit.aws/kopf-finalizer"
    settings.posting.level = logging.getLevelName(os.environ.get("EVENT_LOG_LEVEL", "INFO"))
Exemplo n.º 5
0
 def configure(settings: kopf.OperatorSettings, **_):
     settings.persistence.progress_storage = kopf.AnnotationsProgressStorage(
     )
     settings.posting.level = log_level