Skip to content

Use AppsV1Api to be compatible with kubernetes 1.16+#18

Open
strongpauly wants to merge 3 commits intosideshowbandana:masterfrom
strongpauly:master
Open

Use AppsV1Api to be compatible with kubernetes 1.16+#18
strongpauly wants to merge 3 commits intosideshowbandana:masterfrom
strongpauly:master

Conversation

@strongpauly
Copy link

Support for ExtensionsV1beta1Api has been removed in kubernetes 1.16. Migrate to use AppsV1Api instead.

@rafilkmp3
Copy link

@strongpauly not worked here

IndexError: list index out of range
Traceback (most recent call last):
  File "./k8s-sqs-autoscaler", line 71, in <module>
    sqs.run(options)
  File "/usr/src/app/sqs/sqs.py", line 101, in run
    SQSPoller(options).run()
  File "/usr/src/app/sqs/sqs.py", line 92, in run
    self.poll()
  File "/usr/src/app/sqs/sqs.py", line 41, in poll
    self.scale_down()
  File "/usr/src/app/sqs/sqs.py", line 61, in scale_down
    deployment = self.deployment()
  File "/usr/src/app/sqs/sqs.py", line 76, in deployment
    return deployments.items[0]
IndexError: list index out of range
Traceback (most recent call last):

@strongpauly
Copy link
Author

Which kubernetes version are you using on your cluster? I guess this would be an issue with the current code too if the end point didn't return a valid deployment.

@rafilkmp3
Copy link

@strongpauly Im current using k8s 1.18

After enable Debug I got when function try to update deployment

Scaling Down
Traceback (most recent call last):
  File "./k8s-sqs-autoscaler", line 71, in <module>
    sqs.run(options)
  File "/Users/rafael.sathler/projetos/la-fabrica-de-putas/k8s-sqs-autoscaler/sqs/sqs.py", line 103, in run
    SQSPoller(options).run()
  File "/Users/rafael.sathler/projetos/la-fabrica-de-putas/k8s-sqs-autoscaler/sqs/sqs.py", line 94, in run
    self.poll()
  File "/Users/rafael.sathler/projetos/la-fabrica-de-putas/k8s-sqs-autoscaler/sqs/sqs.py", line 42, in poll
    self.scale_down()
  File "/Users/rafael.sathler/projetos/la-fabrica-de-putas/k8s-sqs-autoscaler/sqs/sqs.py", line 66, in scale_down
    self.update_deployment(deployment)
  File "/Users/rafael.sathler/projetos/la-fabrica-de-putas/k8s-sqs-autoscaler/sqs/sqs.py", line 82, in update_deployment
    api_response = self.apps_v1.patch_namespaced_deployment(
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api/apps_v1_api.py", line 4511, in patch_namespaced_deployment
    return self.patch_namespaced_deployment_with_http_info(name, namespace, body, **kwargs)  # noqa: E501
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api/apps_v1_api.py", line 4622, in patch_namespaced_deployment_with_http_info
    return self.api_client.call_api(
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 348, in call_api
    return self.__call_api(resource_path, method,
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 180, in __call_api
    response_data = self.request(
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py", line 407, in request
    return self.rest_client.PATCH(url,
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 294, in PATCH
    return self.request("PATCH", url,
  File "/usr/local/lib/python3.8/site-packages/kubernetes/client/rest.py", line 233, in request
    raise ApiException(http_resp=r)
kubernetes.client.exceptions.ApiException: (404)
Reason: Not Found

@strongpauly
Copy link
Author

Two different errors then? Is the first simply this: #9 ?

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

Successfully merging this pull request may close these issues.

3 participants