add_ttls.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. ---
  2. # To be executed on first master
  3. - slurp:
  4. src: "{{ openshift.common.config_base }}/master/master-config.yaml"
  5. register: g_master_config_output
  6. - set_fact:
  7. accessTokenMaxAgeSeconds: "{{ (g_master_config_output.content|b64decode|from_yaml).oauthConfig.tokenConfig.accessTokenMaxAgeSeconds | default(86400) }}"
  8. authorizeTokenMaxAgeSeconds: "{{ (g_master_config_output.content|b64decode|from_yaml).oauthConfig.tokenConfig.authorizeTokenMaxAgeSeconds | default(500) }}"
  9. controllerLeaseTTL: "{{ (g_master_config_output.content|b64decode|from_yaml).controllerLeaseTTL | default(30) }}"
  10. - name: Re-introduce leases (as a replacement for key TTLs)
  11. command: >
  12. {{ openshift_client_binary }} adm migrate etcd-ttl \
  13. --cert {{ r_etcd_common_master_peer_cert_file }} \
  14. --key {{ r_etcd_common_master_peer_key_file }} \
  15. --cacert {{ r_etcd_common_master_peer_ca_file }} \
  16. --etcd-address 'https://{{ etcd_peer }}:{{ etcd_client_port }}' \
  17. --ttl-keys-prefix {{ item.keys }} \
  18. --lease-duration {{ item.ttl }}
  19. environment:
  20. ETCDCTL_API: 3
  21. PATH: "/usr/local/bin:/var/usrlocal/bin:{{ ansible_env.PATH }}"
  22. with_items:
  23. - keys: "/kubernetes.io/events"
  24. ttl: "1h"
  25. - keys: "/kubernetes.io/masterleases"
  26. ttl: "10s"
  27. - keys: "/openshift.io/oauth/accesstokens"
  28. ttl: "{{ accessTokenMaxAgeSeconds }}s"
  29. - keys: "/openshift.io/oauth/authorizetokens"
  30. ttl: "{{ authorizeTokenMaxAgeSeconds }}s"
  31. - keys: "/openshift.io/leases/controllers"
  32. ttl: "{{ controllerLeaseTTL }}s"