Skip to content

Commit

Permalink
Merge branch 'master' into new_flannel
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Feb 27, 2024
2 parents 69969fe + 5e675f4 commit b0c6847
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 42 deletions.
68 changes: 39 additions & 29 deletions tasks/Debian.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
---
- name: Add repo key
get_url:
url: "https://packages.cloud.google.com/apt/doc/apt-key.gpg"
dest: /etc/apt/trusted.gpg.d/google.gpg
mode: '0644'
force: true
register: add_key
ignore_errors: yes
- block:

- name: Set kube_minor_version
set_fact:
kube_minor_version: "{{ kube_version.split('.')[0] }}.{{ kube_version.split('.')[1] }}"

- name: Add repo key
get_url:
url: "https://pkgs.k8s.io/core:/stable:/v{{ kube_minor_version }}/deb/Release.key"
dest: /etc/apt/trusted.gpg.d/kubernetes.asc
mode: '0644'

- name: Add kubernetes repo
apt_repository: repo='deb https://pkgs.k8s.io/core:/stable:/v{{ kube_minor_version }}/deb/ /' state=present update_cache=yes

when: "kube_version is version('1.24', '>=')"

- block:

- name: Add repo key
get_url:
url: "https://packages.cloud.google.com/apt/doc/apt-key.gpg"
dest: /etc/apt/trusted.gpg.d/google.gpg
mode: '0644'
force: true
register: add_key
ignore_errors: yes

- name: Add repo key copy with asc extension to workarond issues
copy:
src: /etc/apt/trusted.gpg.d/google.gpg
dest: /etc/apt/trusted.gpg.d/google.asc
mode: '0644'
remote_src: yes
when: add_key is changed

- name: Add kubernetes repo
apt_repository: repo='deb http://apt.kubernetes.io/ kubernetes-xenial main' state=present update_cache=yes

# Sometimes google key fails with error 500
# https://github.com/kubernetes/release/issues/100
# So we copied it at GRyCAP and use it in case of error
- name: Add repo key backup
get_url:
url: "http://ftpgrycap.i3m.upv.es/ubuntu/google-apt-key.gpg"
dest: /etc/apt/trusted.gpg.d/google.asc
mode: '0644'
when: add_key is failed

- name: Add repo key copy with asc extension to workarond issues
copy:
src: /etc/apt/trusted.gpg.d/google.gpg
dest: /etc/apt/trusted.gpg.d/google.asc
mode: '0644'
remote_src: yes
when: add_key is changed

- name: Add kubernetes repo
apt_repository: repo='deb http://apt.kubernetes.io/ kubernetes-xenial main' state=present update_cache=yes
when: "kube_version is version('1.24', '<')"

- name: Install kubernetes packages
apt: name=kubelet={{ kube_version }}*,kubeadm={{ kube_version }}*,kubectl={{ kube_version }}*
Expand Down
51 changes: 41 additions & 10 deletions tasks/RedHat.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,50 @@
---
- copy:
dest: /etc/yum.repos.d/kubernetes.repo
content: |
- block:

- name: Set kube_minor_version
set_fact:
kube_minor_version: "{{ kube_version.split('.')[0] }}.{{ kube_version.split('.')[1] }}"

- name: Set repo file
copy:
dest: /etc/yum.repos.d/kubernetes.repo
content: |
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
baseurl=https://pkgs.k8s.io/core:/stable:/v{{ kube_minor_version }}/rpm/
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
gpgkey=https://pkgs.k8s.io/core:/stable:/v{{ kube_minor_version }}/rpm/repodata/repomd.xml.key
exclude=kubelet kubeadm kubectl cri-tools kubernetes-cni
- name: import gpg key
rpm_key:
key: https://pkgs.k8s.io/core:/stable:/v{{ kube_minor_version }}/rpm/repodata/repomd.xml.key
state: present

when: "kube_version is version('1.24', '>=')"

- block:

- name: Set repo file
copy:
dest: /etc/yum.repos.d/kubernetes.repo
content: |
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
- name: import gpg key
rpm_key:
key: https://packages.cloud.google.com/yum/doc/yum-key.gpg
state: present

- name: import gpg key
rpm_key:
key: https://packages.cloud.google.com/yum/doc/yum-key.gpg
state: present
when: "kube_version is version('1.24', '<')"

- name: Install kubernetes packages
package: name=psmisc,kubelet-{{kube_version}},kubeadm-{{kube_version}},kubectl-{{kube_version}},yum-plugin-versionlock state=present update_cache=yes
Expand All @@ -24,7 +55,7 @@
when: kube_version == "latest"

- name: Version lock kubernetes packages
command: yum versionlock add kubelet kubeadm kubectl
command: yum versionlock add kubelet kubeadm kubectl cri-tools kubernetes-cni
register: yum_versionlock
changed_when: "'versionlock added: 1' in yum_versionlock.stdout_lines"
ignore_errors: yes
Expand Down
2 changes: 1 addition & 1 deletion tests/test-crio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
kube_deploy_dashboard: true
kube_install_ingress: true
kube_public_dns_name: test.domain.com
kube_version: 1.25.3
kube_version: 1.28.3
kube_cri_runtime: crio
kubelet_extra_args_dict:
node-labels: somelabel
2 changes: 1 addition & 1 deletion tests/test-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
kube_deploy_dashboard: true
kube_install_ingress: true
kube_public_dns_name: test.domain.com
kube_version: 1.25.3
kube_version: 1.26.3
kube_cri_runtime: docker
kube_cri_runtime_install: false
kube_install_docker_pip: true
Expand Down
2 changes: 1 addition & 1 deletion tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
kube_deploy_dashboard: true
kube_install_ingress: true
kube_public_dns_name: test.domain.com
kube_version: 1.25.3
kube_version: 1.27.3
kube_cri_runtime: containerd
kube_install_docker_pip: true
kubelet_extra_args_dict:
Expand Down

0 comments on commit b0c6847

Please sign in to comment.