Features/support kubeadm patches v1beta3 (#9326)
* Support kubeadm patches in v1beta3 * Update kubeadm patches sample files in inventory * Fix pre-commit syntax * Set kubeadm_patches enabled to false in sample inventory
This commit is contained in:
parent
ad3f503c0c
commit
d689f57c94
10 changed files with 77 additions and 1 deletions
|
@ -339,3 +339,9 @@ event_ttl_duration: "1h0m0s"
|
||||||
auto_renew_certificates: false
|
auto_renew_certificates: false
|
||||||
# First Monday of each month
|
# First Monday of each month
|
||||||
# auto_renew_certificates_systemd_calendar: "Mon *-*-1,2,3,4,5,6,7 03:{{ groups['kube_control_plane'].index(inventory_hostname) }}0:00"
|
# auto_renew_certificates_systemd_calendar: "Mon *-*-1,2,3,4,5,6,7 03:{{ groups['kube_control_plane'].index(inventory_hostname) }}0:00"
|
||||||
|
|
||||||
|
# kubeadm patches path
|
||||||
|
kubeadm_patches:
|
||||||
|
enabled: false
|
||||||
|
source_dir: "{{ inventory_dir }}/patches"
|
||||||
|
dest_dir: "{{ kube_config_dir }}/patches"
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: kube-controller-manager
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: 'true'
|
||||||
|
prometheus.io/port: '10257'
|
8
inventory/sample/patches/kube-scheduler+merge.yaml
Normal file
8
inventory/sample/patches/kube-scheduler+merge.yaml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: kube-scheduler
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: 'true'
|
||||||
|
prometheus.io/port: '10259'
|
|
@ -228,3 +228,9 @@ auto_renew_certificates_systemd_calendar: "{{ 'Mon *-*-1,2,3,4,5,6,7 03:' ~
|
||||||
# If we have requirement like without renewing certs upgrade the cluster,
|
# If we have requirement like without renewing certs upgrade the cluster,
|
||||||
# we can opt out from the default behavior by setting kubeadm_upgrade_auto_cert_renewal to false
|
# we can opt out from the default behavior by setting kubeadm_upgrade_auto_cert_renewal to false
|
||||||
kubeadm_upgrade_auto_cert_renewal: true
|
kubeadm_upgrade_auto_cert_renewal: true
|
||||||
|
|
||||||
|
# kubeadm patches path
|
||||||
|
kubeadm_patches:
|
||||||
|
enabled: true
|
||||||
|
source_dir: "{{ inventory_dir }}/patches"
|
||||||
|
dest_dir: "{{ kube_config_dir }}/patches"
|
|
@ -150,6 +150,21 @@
|
||||||
- apiserver_sans_check.changed
|
- apiserver_sans_check.changed
|
||||||
- not kube_external_ca_mode
|
- not kube_external_ca_mode
|
||||||
|
|
||||||
|
- name: kubeadm | Create directory to store kubeadm patches
|
||||||
|
file:
|
||||||
|
path: "{{ kubeadm_patches.dest_dir }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0640
|
||||||
|
when: kubeadm_patches is defined and kubeadm_patches.enabled
|
||||||
|
|
||||||
|
- name: kubeadm | Copy kubeadm patches from inventory files
|
||||||
|
copy:
|
||||||
|
src: "{{ kubeadm_patches.source_dir }}/"
|
||||||
|
dest: "{{ kubeadm_patches.dest_dir }}"
|
||||||
|
owner: "root"
|
||||||
|
mode: 0644
|
||||||
|
when: kubeadm_patches is defined and kubeadm_patches.enabled
|
||||||
|
|
||||||
- name: kubeadm | Initialize first master
|
- name: kubeadm | Initialize first master
|
||||||
command: >-
|
command: >-
|
||||||
timeout -k 300s 300s
|
timeout -k 300s 300s
|
||||||
|
|
|
@ -28,6 +28,10 @@ nodeRegistration:
|
||||||
kubeletExtraArgs:
|
kubeletExtraArgs:
|
||||||
cloud-provider: external
|
cloud-provider: external
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if kubeadm_patches is defined and kubeadm_patches.enabled %}
|
||||||
|
patches:
|
||||||
|
directory: {{ kubeadm_patches.dest_dir }}
|
||||||
|
{% endif %}
|
||||||
---
|
---
|
||||||
apiVersion: kubeadm.k8s.io/v1beta3
|
apiVersion: kubeadm.k8s.io/v1beta3
|
||||||
kind: ClusterConfiguration
|
kind: ClusterConfiguration
|
||||||
|
|
|
@ -26,3 +26,7 @@ nodeRegistration:
|
||||||
{% else %}
|
{% else %}
|
||||||
taints: []
|
taints: []
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if kubeadm_patches is defined and kubeadm_patches.enabled %}
|
||||||
|
patches:
|
||||||
|
directory: {{ kubeadm_patches.dest_dir }}
|
||||||
|
{% endif %}
|
|
@ -10,3 +10,9 @@ kube_override_hostname: >-
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{ inventory_hostname }}
|
{{ inventory_hostname }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
# kubeadm patches path
|
||||||
|
kubeadm_patches:
|
||||||
|
enabled: true
|
||||||
|
source_dir: "{{ inventory_dir }}/patches"
|
||||||
|
dest_dir: "{{ kube_config_dir }}/patches"
|
|
@ -52,7 +52,7 @@
|
||||||
kubeadm_token: "{{ temp_token.stdout }}"
|
kubeadm_token: "{{ temp_token.stdout }}"
|
||||||
when: kubeadm_token is not defined
|
when: kubeadm_token is not defined
|
||||||
|
|
||||||
- name: Set kubeadm api version to v1beta2
|
- name: Set kubeadm api version to v1beta3
|
||||||
set_fact:
|
set_fact:
|
||||||
kubeadmConfig_api_version: v1beta3
|
kubeadmConfig_api_version: v1beta3
|
||||||
|
|
||||||
|
@ -64,6 +64,21 @@
|
||||||
mode: 0640
|
mode: 0640
|
||||||
when: not is_kube_master
|
when: not is_kube_master
|
||||||
|
|
||||||
|
- name: kubeadm | Create directory to store kubeadm patches
|
||||||
|
file:
|
||||||
|
path: "{{ kubeadm_patches.dest_dir }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0640
|
||||||
|
when: kubeadm_patches is defined and kubeadm_patches.enabled
|
||||||
|
|
||||||
|
- name: kubeadm | Copy kubeadm patches from inventory files
|
||||||
|
copy:
|
||||||
|
src: "{{ kubeadm_patches.source_dir }}/"
|
||||||
|
dest: "{{ kubeadm_patches.dest_dir }}"
|
||||||
|
owner: "root"
|
||||||
|
mode: 0644
|
||||||
|
when: kubeadm_patches is defined and kubeadm_patches.enabled
|
||||||
|
|
||||||
- name: Join to cluster if needed
|
- name: Join to cluster if needed
|
||||||
environment:
|
environment:
|
||||||
PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}:/sbin"
|
PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}:/sbin"
|
||||||
|
|
|
@ -26,3 +26,7 @@ nodeRegistration:
|
||||||
- effect: NoSchedule
|
- effect: NoSchedule
|
||||||
key: node-role.kubernetes.io/calico-rr
|
key: node-role.kubernetes.io/calico-rr
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if kubeadm_patches is defined and kubeadm_patches.enabled %}
|
||||||
|
patches:
|
||||||
|
directory: {{ kubeadm_patches.dest_dir }}
|
||||||
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue