Describe the bug
If an application has been deployed with a (liveness/readiness) probe of a given type, then changing that type fails on kubetools deploy.
To Reproduce
Steps to reproduce the behavior:
Deploy an application with probes of type exec
Change the probes to be of type httpGet
Try to re-deploy the application
An exception is raised (see stack below) and the deployment fails.
Expected behavior
The deployed application is updated to use the new (httpGet) probe type
Traceback (most recent call last):
File "${HOME}/.virtualenvs/kubetools/bin/kubetools", line 33, in <module>
sys.exit(load_entry_point('kubetools', 'console_scripts', 'kubetools')())
File "${HOME}/.virtualenvs/kubetools/bin/kubetools", line 25, in importlib_load_entry_point
return next(matches).load()
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/importlib_metadata/__init__.py", line 208, in load
module = import_module(match.group('module'))
File "${HOME}/.pyenv/versions/3.7.14/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "${HOME}/apps/kubetools/kubetools/cli/__main__.py", line 9, in <module>
run_cli(cli_bootstrap)
File "${HOME}/apps/kubetools/kubetools/main.py", line 14, in run_cli
func()
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "${HOME}/apps/kubetools/kubetools/cli/deploy.py", line 200, in deploy
delete_completed_jobs=delete_completed_jobs,
File "${HOME}/apps/kubetools/kubetools/deploy/commands/deploy.py", line 241, in execute_deploy
update_deployment(build.env, build.namespace, deployment)
File "${HOME}/apps/kubetools/kubetools/kubernetes/api.py", line 238, in update_deployment
namespace=namespace,
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/kubernetes/client/api/apps_v1_api.py", line 4627, in patch_namespaced_deployment
return self.patch_namespaced_deployment_with_http_info(name, namespace, body, **kwargs) # noqa: E501
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/kubernetes/client/api/apps_v1_api.py", line 4756, in patch_namespaced_deployment_with_http_info
collection_formats=collection_formats)
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 353, in call_api
_preload_content, _request_timeout, _host)
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 184, in __call_api
_request_timeout=_request_timeout)
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 413, in request
body=body)
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/kubernetes/client/rest.py", line 302, in PATCH
body=body)
File "${HOME}/.virtualenvs/kubetools/lib/python3.7/site-packages/kubernetes/client/rest.py", line 235, in request
raise ApiException(http_resp=r)
kubernetes.client.exceptions.ApiException: (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Server': 'openresty/1.15.8.1', 'Date': 'Tue, 20 Dec 2022 18:24:37 GMT', 'Content-Type': 'application/json', 'Content-Length': '779', 'Connection': 'keep-alive', 'Audit-Id': '4ebb7e84-e16a-4252-8016-91d383b5a867', 'X-Content-Type-Options': 'nosniff', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Deployment.apps \"my-app\" is invalid: [spec.template.spec.containers[0].livenessProbe.httpGet: Forbidden: may not specify more than 1 handler type, spec.template.spec.containers[0].readinessProbe.httpGet: Forbidden: may not specify more than 1 handler type]","reason":"Invalid","details":{"name":"my-app","group":"apps","kind":"Deployment","causes":[{"reason":"FieldValueForbidden","message":"Forbidden: may not specify more than 1 handler type","field":"spec.template.spec.containers[0].livenessProbe.httpGet"},{"reason":"FieldValueForbidden","message":"Forbidden: may not specify more than 1 handler type","field":"spec.template.spec.containers[0].readinessProbe.httpGet"}]},"code":422}
Describe the bug If an application has been deployed with a (liveness/readiness) probe of a given type, then changing that type fails on
kubetools deploy
.To Reproduce Steps to reproduce the behavior:
probes
of typeexec
httpGet
Expected behavior The deployed application is updated to use the new (
httpGet
) probe type