Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. patch = {
  2. "spec": {
  3. "template": {
  4. "spec": {
  5. "containers": [
  6. {
  7. "name": "kubedns",
  8. "resources": {
  9. "requests": {
  10. "cpu": "10m",
  11. "memory": "50Mi",
  12. },
  13. "limits": {
  14. "cpu": "100m",
  15. "memory": "100Mi",
  16. }
  17. }
  18. }
  19. ]
  20. }
  21. }
  22. }
  23. }
  24.  
  25. def patch_deployment(name: str, patch: str):
  26. api_instance = client.AppsV1Api()
  27. try:
  28. api_instance.patch_namespaced_deployment(
  29. name=name,
  30. namespace='kube-system',
  31. force=True,
  32. field_manager='right-sizer',
  33. body=patch)
  34. except client.rest.ApiException as e:
  35. logger.error(f"Failed to patch deployment: {name} - error was {e}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement