forked from kubernetes-sigs/kubespray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kubeadm: allow to provide patch inline in inventories
Specifying one directory for kubeadm patches is not ideal: 1. It does not allow working with multiples inventories easily 2. No ansible templating of the patch 3. Ansible path searching can sometimes be confusing Instead, provide the patch directly in a variable, and add some quality of life to handle components targeting and patch ordering more explicitly (`target` and `type` which are translated to the kubeadm scheme which is based on the file name)
- Loading branch information
Showing
6 changed files
with
29 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
kubeadm_patches_dir: "{{ kube_config_dir }}/patches" | ||
kubeadm_patches: [] | ||
# kubeadm_patches: | ||
# - target: kube-apiserver|kube-controller-manager|kube-scheduler|etcd|kubeletconfiguration | ||
# type: strategic(default)|json|merge | ||
# patch: | ||
# metadata: | ||
# annotations: | ||
# example.com/test: "true" | ||
# labels: | ||
# example.com/prod_level: "{{ prod_level }}" | ||
# - ... | ||
# Patches are applied in the order they are specified. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
--- | ||
- name: Kubeadm | Create directory to store kubeadm patches | ||
file: | ||
path: "{{ kubeadm_patches.dest_dir }}" | ||
path: "{{ kubeadm_patches_dir }}" | ||
state: directory | ||
mode: "0640" | ||
when: kubeadm_patches is defined and kubeadm_patches.enabled | ||
when: kubeadm_patches | length > 0 | ||
|
||
- name: Kubeadm | Copy kubeadm patches from inventory files | ||
copy: | ||
src: "{{ kubeadm_patches.source_dir }}/" | ||
dest: "{{ kubeadm_patches.dest_dir }}" | ||
content: "{{ item.patch | to_yaml }}" | ||
dest: "{{ kubeadm_patches_dir }}/{{ item.target }}{{ suffix }}+{{ item.type | d('strategic') }}.yaml" | ||
owner: "root" | ||
mode: "0644" | ||
when: kubeadm_patches is defined and kubeadm_patches.enabled | ||
loop: "{{ kubeadm_patches }}" | ||
loop_control: | ||
index_var: suffix |