K8s package split (#167)

* split

* get only first ipv6 for apiserver

* delete manifets by kubelet

* switch to helm module

Co-authored-by: Dmitry Skokov <d.skokov@rbkmoney.com>
This commit is contained in:
vilorij 2021-02-12 11:03:36 +03:00 committed by Antsiferov Grigory
parent 0934174c36
commit 20fdb5e1df
4 changed files with 19 additions and 10 deletions

View File

@ -12,7 +12,7 @@ apiServer:
apiVersion: kubeadm.k8s.io/v1beta2
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controlPlaneEndpoint: '[{{ grains['fqdn_ip6']|join|string }}]:6443'
controlPlaneEndpoint: '[{{ grains['fqdn_ip6'] | first() }}]:6443'
kind: ClusterConfiguration
featureGates:
IPv6DualStack: true

View File

@ -1,6 +1,9 @@
{% if "k8s-master" in grains.get('role', []) %}
"helm repo add cilium https://helm.cilium.io":
cmd.run:
cilium_repository_is_managed:
helm.repo_managed:
- present:
- name: cilium
url: https://helm.cilium.io
- require:
- cmd: kubeadm_init
@ -10,12 +13,15 @@
- template: jinja
cilium_deploy:
cmd.run:
helm.release_present:
- name: cilium
- chart: cilium/cilium
- namespace: kube-system
- version: {{ pillar['kubernetes']['cilium']['version'] }}
- values: /tmp/cilium.yaml
- kvflags:
kubeconfig: /etc/kubernetes/admin.conf
- require:
- cmd: "helm repo add cilium https://helm.cilium.io"
- helm: cilium_repository_is_managed
- file: "/tmp/cilium.yaml"
- name: |
helm --kubeconfig /etc/kubernetes/admin.conf install \
cilium cilium/cilium --version {{ pillar['kubernetes']['cilium']['version'] }} \
--namespace kube-system -f /tmp/cilium.yaml
{% endif %}

View File

@ -105,6 +105,8 @@ kube_join_key:
{% endif %}
{% if "k8s-worker" in grains.get('role', []) %}
/etc/kubernetes/manifests/.keep_sys-cluster_kubelet-0:
file.absent
{% for mastername, com in salt['mine.get']('*', 'kube_join_command') | dictsort() %}
{% set command = com %}
{{ command }} {% if confmap.criService == 'crio' %}--cri-socket /var/run/crio/crio.sock{% endif %}:
@ -112,5 +114,6 @@ kube_join_key:
- creates: /etc/kubernetes/kubelet.conf
- require:
- file: /etc/kubernetes/manifests/.keep_sys-cluster_kubernetes-0
- file: /etc/kubernetes/manifests/.keep_sys-cluster_kubelet-0
{% endfor %}
{% endif %}

View File

@ -1,6 +1,6 @@
{% set confmap = salt['grains.filter_by']({
'Gentoo': {
'KubePkgs': ['sys-cluster/kubernetes','app-admin/helm','app-emulation/cri-tools','app-emulation/cri-o','app-emulation/crun'],
'KubePkgs': ['sys-cluster/kubeadm','sys-cluster/kubectl','sys-cluster/kubelet','app-admin/helm','app-emulation/cri-tools','app-emulation/cri-o','app-emulation/crun'],
'criService': 'crio',
},
'Debian': {