crate-operator icon indicating copy to clipboard operation
crate-operator copied to clipboard

Operator throws error that it cannot find StatefulSet

Open rgelsi opened this issue 3 years ago • 1 comments

I get the following error message since version 2.13.0 of the operator:

kopf.objects         [ERROR   ] Timer 'ping_cratedb' failed with an exception. Will retry.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/kopf/_core/actions/execution.py", line 283, in execute_handler_once
    result = await invoke_handler(
  File "/usr/local/lib/python3.8/site-packages/kopf/_core/actions/execution.py", line 378, in invoke_handler
    result = await invocation.invoke(
  File "/usr/local/lib/python3.8/site-packages/kopf/_core/actions/invocation.py", line 117, in invoke
    result = await fn(**kwargs)  # type: ignore
  File "main.py", line 188, in ping_cratedb
    await ping_cratedb_status(namespace, name, logger)
  File "/usr/local/lib/python3.8/site-packages/crate/operator/handlers/handle_ping_cratedb_status.py", line 45, in ping_cratedb_status
    desired_instances = await get_desired_nodes_count(namespace, name)
  File "/usr/local/lib/python3.8/site-packages/crate/operator/operations.py", line 76, in get_desired_nodes_count
    statefulset = await apps.read_namespaced_stateful_set(
  File "/usr/local/lib/python3.8/site-packages/kubernetes_asyncio/client/api_client.py", line 189, in __call_api
    raise e
  File "/usr/local/lib/python3.8/site-packages/kubernetes_asyncio/client/api_client.py", line 182, in __call_api
    response_data = await self.request(
  File "/usr/local/lib/python3.8/site-packages/kubernetes_asyncio/client/rest.py", line 193, in GET
    return (await self.request("GET", url,
  File "/usr/local/lib/python3.8/site-packages/kubernetes_asyncio/client/rest.py", line 187, in request
    raise ApiException(http_resp=r)
kubernetes_asyncio.client.exceptions.ApiException: (404)
Reason: Not Found
HTTP response headers: <CIMultiDictProxy('Audit-Id': 'd3d05d53-6632-4a88-b1c6-608ccee8275d', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': '1a3ff758-6cfc-4d4d-94e5-00a5c2db0c49', 'X-Kubernetes-Pf-Prioritylevel-Uid': '37b126f9-ff88-4ed8-8297-6ddbfc19e47c', 'Date': 'Wed, 22 Jun 2022 12:36:27 GMT', 'Content-Length': '264')>
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"statefulsets.apps \"crate-data-hot-cratedb-cluster\" not found","reason":"NotFound","details":{"name":"crate-data-hot-cratedb-cluster","group":"apps","kind":"statefulsets"},"code":404}

As far as I have understood, the StatefulSet name to check was incorrectly hard-coded to "crate-data-hot-{name}" in change_compute.py

Operator Version: 2.13.0 CrateDB Version: 4.8.1 Kubernetes Version: 1.21.0

rgelsi avatar Jun 22 '22 12:06 rgelsi

I've encountered this, and also a failure in the cluster creation method, when using a minikube cluster with version 1.25+. I don't see those errors on, say, a minikube cluster running Kubernetes v1.23.2. After some deeper diving, I noticed that some resources like the PodDisruptionBudget were not being created. The Kubernetes API has introduced deprecations and removals for several beta APIs. After updating the crate operator locally to use non-beta APIs, these errors went away for me. I'm currently blocked on validating further due to https://github.com/crate/crate-operator/issues/460.

remear avatar Jan 27 '23 18:01 remear