main.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. # Ensures a project exists and is configured in accordance with ICHP rules:
  3. #
  4. # - has correct RBAC (user role binding)
  5. # - has network policies
  6. # - has quota and limitranges
  7. # - has an EgressIP allocated
  8. #
  9. # Requires the following structure:
  10. #
  11. # role:
  12. # state: present or absent
  13. # requester: the user requesting the project
  14. # name: the name of the project
  15. # displayname: optional displayname (defaults to name)
  16. # rbac_level: cluster role to assign to requester
  17. # egress_ip: an available egress IP to allocate to the project
  18. # quota: compute resourcequotas
  19. # requests: compute reservation
  20. # cpu: max cpu reserved (1500m, 1.5 CPU)
  21. # memory: max memory reserved (2048Mi, 2Gi)
  22. # limits: compute limits
  23. # cpu: max cpu consumed (4000m, 4 CPUs)
  24. # memory: max memory consumed (4096Mi, 4Gi)
  25. # lrange: compute limitranges, for both container and pod
  26. # default: default limits and requests
  27. # limit:
  28. # cpu: role.lrange.min.cpu * role.lrange.ratio.cpu
  29. # memory: role.lrange.min.memory * role.lrange.ratio.memory
  30. # request:
  31. # cpu: defaults to whatever role.lrange.min.cpu is
  32. # memory: defaults to whatever role.lrange.min.memory is
  33. # max: maximum limits
  34. # cpu: maximum cpu limit (4000m, 4 cpus)
  35. # memory: maximum memory limit (4096Mi, 4Gi)
  36. # min: minimum requests
  37. # cpu: minimum requested cpu (50m, 5%)
  38. # memory: minimum requested memory (64Mi)
  39. # ratio: max limit-to-request ratio (x-to-1)
  40. # cpu: cpu lrr (4)
  41. # memory: memory lrr (4)
  42. #
  43. # IMPORTANT: XXX: ALL COMPUTE UNITS MUST BE IN milicores AND Mi!
  44. #
  45. # TODO: verify stuff before applying template
  46. #
  47. - name: Show the values at verbosity 1+
  48. ansible.builtin.debug:
  49. var: role
  50. verbosity: 1
  51. - name: Apply the project template to the cluster.
  52. kubernetes.core.k8s:
  53. kubeconfig: tmp/kubeconfig-ocp4
  54. validate_certs: no
  55. template: templates/project-template.yml
  56. state: "{{ role.state | default('present') }}"
  57. ...