Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

During the dry run, create can raise a 404 in an empty cluster #18

Open
arcivanov opened this issue Dec 19, 2023 · 0 comments
Open

During the dry run, create can raise a 404 in an empty cluster #18

arcivanov opened this issue Dec 19, 2023 · 0 comments

Comments

@arcivanov
Copy link
Member

arcivanov commented Dec 19, 2023

ServiceAccount sa-name requires Namespace ns-name, but even in dry-run lack of ns-name produces 404.

2023-12-18T22:57:54.987175 kubernator CRITICAL app.py:489 Kubernator terminated with an error: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Audit-Id': '11ee63fd-62c0-461e-b209-d68fd582741f', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': '813454a8-a98c-4aaf-944b-1d9499418db7', 'X-Kubernetes-Pf-Prioritylevel-Uid': '227495d7-da81-476e-bb66-75d306e70451', 'Date': 'Tue, 19 Dec 2023 03:57:54 GMT', 'Content-Length': '192'})
HTTP response body: b'{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"namespaces \\"ns-name\\" not found","reason":"NotFound","details":{"name":"ns-name","kind":"namespaces"},"code":404}\n'
Traceback (most recent call last):
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/plugins/k8s.py", line 357, in _apply_resource
    remote_resource = resource.get()
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/plugins/k8s_api.py", line 398, in get
    return json.loads(self.rdef.get(**kwargs).data)
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 25269, in read_namespaced_service_account
    return self.read_namespaced_service_account_with_http_info(name, namespace, **kwargs)  # noqa: E501
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 25356, in read_namespaced_service_account_with_http_info
    return self.api_client.call_api(
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 348, in call_api
    return self.__call_api(resource_path, method,
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
    response_data = self.request(
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 373, in request
    return self.rest_client.GET(url,
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/rest.py", line 244, in GET
    return self.request("GET", url,
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/rest.py", line 238, in request
    raise ApiException(http_resp=r)
kubernetes.client.exceptions.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Audit-Id': '3db1700d-388e-483f-9acf-dec959fffaa0', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': '813454a8-a98c-4aaf-944b-1d9499418db7', 'X-Kubernetes-Pf-Prioritylevel-Uid': '227495d7-da81-476e-bb66-75d306e70451', 'Date': 'Tue, 19 Dec 2023 03:57:54 GMT', 'Content-Length': '218'})
HTTP response body: b'{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"serviceaccounts \\"sa-name\\" not found","reason":"NotFound","details":{"name":"sa-name","kind":"serviceaccounts"},"code":404}\n'


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/app.py", line 485, in main
    app.run()
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/app.py", line 199, in run
    self._run_handlers(KubernatorPlugin.handle_apply, True, context, None)
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/app.py", line 277, in _run_handlers
    self._set_plugin_context(__reverse, __context, run)
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/app.py", line 282, in _set_plugin_context
    run(h)
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/app.py", line 271, in run
    h_f(*args, **kwargs)
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/plugins/k8s.py", line 253, in handle_apply
    self._apply_resource(dry_run,
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/plugins/k8s.py", line 361, in _apply_resource
    create()
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/plugins/k8s.py", line 345, in create
    create_func()
  File "/home/arcivanov/Documents/src/karellen/kubernator/src/main/python/kubernator/plugins/k8s_api.py", line 410, in create
    return json.loads(rdef.create(**kwargs).data)
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 8518, in create_namespaced_service_account
    return self.create_namespaced_service_account_with_http_info(namespace, body, **kwargs)  # noqa: E501
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/api/core_v1_api.py", line 8617, in create_namespaced_service_account_with_http_info
    return self.api_client.call_api(
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 348, in call_api
    return self.__call_api(resource_path, method,
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
    response_data = self.request(
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/api_client.py", line 391, in request
    return self.rest_client.POST(url,
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/rest.py", line 279, in POST
    return self.request("POST", url,
  File "/home/arcivanov/.pyenv/versions/kubernator/lib/python3.9/site-packages/kubernetes/client/rest.py", line 238, in request
    raise ApiException(http_resp=r)
kubernetes.client.exceptions.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Audit-Id': '11ee63fd-62c0-461e-b209-d68fd582741f', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': '813454a8-a98c-4aaf-944b-1d9499418db7', 'X-Kubernetes-Pf-Prioritylevel-Uid': '227495d7-da81-476e-bb66-75d306e70451', 'Date': 'Tue, 19 Dec 2023 03:57:54 GMT', 'Content-Length': '192'})
HTTP response body: b'{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"namespaces \\"ns-name\\" not found","reason":"NotFound","details":{"name":"ns-name","kind":"namespaces"},"code":404}\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant