From 3888a29bb11f7568797d8b1c2a1f7d4a11b461d5 Mon Sep 17 00:00:00 2001 From: Techno Tim Date: Sat, 27 Jan 2024 15:35:47 -0600 Subject: [PATCH 1/5] fix(ci): only run CI for PRs (#430) * fix(ci): only run CI for PRs * fix(ci): ensure that branch is up to date * fix(ci): ensure that branch is up to date --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77f933352..c47ece0da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: "CI" on: pull_request: - push: - branches: - - master + types: + - opened + - synchronize paths-ignore: - '**/README.md' jobs: From 3f06a11c8d729258bed5b476015a621aeac26802 Mon Sep 17 00:00:00 2001 From: Gereon Vey Date: Sat, 27 Jan 2024 23:30:13 +0100 Subject: [PATCH 2/5] fetch kubeconfig from master after deployment (#431) Co-authored-by: Techno Tim --- .gitignore | 1 + site.yml | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index 78f3d0bbe..89c5d4d29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .env/ *.log ansible.cfg +kubeconfig diff --git a/site.yml b/site.yml index 2aa46e7be..e57deabca 100644 --- a/site.yml +++ b/site.yml @@ -46,3 +46,14 @@ roles: - role: k3s_server_post become: true + +- name: Storing kubeconfig in the playbook directory + hosts: master + environment: "{{ proxy_env | default({}) }}" + tasks: + - name: Copying kubeconfig from {{ hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname'] }} + ansible.builtin.fetch: + src: "{{ ansible_user_dir }}/.kube/config" + dest: ./kubeconfig + flat: true + when: ansible_hostname == hostvars[groups[group_name_master | default('master')][0]]['ansible_hostname'] From 61bf3971eff3d4f10d87de5fa5e780d54fb40535 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 27 Jan 2024 17:26:12 -0600 Subject: [PATCH 3/5] chore(deps): bump actions/checkout from 2.5.0 to 4.1.1 (#424) Bumps [actions/checkout](https://github.com/actions/checkout) from 2.5.0 to 4.1.1. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/e2f20e631ae6d7dd3b768f56a5d2af784dd54791...b4ffde65f46336ab88eb53be808477a3936bae11) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Techno Tim --- .github/workflows/cache.yml | 2 +- .github/workflows/lint.yml | 4 ++-- .github/workflows/test.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index 6322657fb..2eaf3bc56 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Check out the codebase - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v3 2.5.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3 4.1.1 with: ref: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6787f7882..8739c8c57 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Check out the codebase - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v3 2.5.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3 4.1.1 with: ref: ${{ github.event.pull_request.head.sha }} @@ -45,7 +45,7 @@ jobs: runs-on: self-hosted steps: - name: Checkout code - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v3 2.5.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3 4.1.1 - name: Ensure SHA pinned actions uses: zgosalvez/github-actions-ensure-sha-pinned-actions@af2eb3226618e2494e3d9084f515ad6dcf16e229 # 2.0.1 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1fc10b7fb..16e0595a6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Check out the codebase - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v3 2.5.0 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3 4.1.1 with: ref: ${{ github.event.pull_request.head.sha }} From 3aeb7d69eaf75f49670c95ea58ef7a4c8e7a68bb Mon Sep 17 00:00:00 2001 From: egandro Date: Sun, 28 Jan 2024 01:50:13 +0100 Subject: [PATCH 4/5] added fix for metallb version upgrades (#394) * added fix for metallb version upgrades * use bash to allow pipefail --------- Co-authored-by: Harald Fielker Co-authored-by: Techno Tim --- roles/k3s_server_post/tasks/metallb.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/roles/k3s_server_post/tasks/metallb.yml b/roles/k3s_server_post/tasks/metallb.yml index 24219479e..07a23b0f2 100644 --- a/roles/k3s_server_post/tasks/metallb.yml +++ b/roles/k3s_server_post/tasks/metallb.yml @@ -8,6 +8,27 @@ with_items: "{{ groups[group_name_master | default('master')] }}" run_once: true +- name: Delete outdated metallb replicas + shell: |- + set -o pipefail + + REPLICAS=$(k3s kubectl --namespace='metallb-system' get replicasets \ + -l 'component=controller,app=metallb' \ + -o jsonpath='{.items[0].spec.template.spec.containers[0].image}, {.items[0].metadata.name}' 2>/dev/null || true) + REPLICAS_SETS=$(echo ${REPLICAS} | grep -v '{{ metal_lb_controller_tag_version }}' | sed -e "s/^.*\s//g") + if [ -n "${REPLICAS_SETS}" ] ; then + for REPLICAS in "${REPLICAS_SETS}" + do + k3s kubectl --namespace='metallb-system' \ + delete rs "${REPLICAS}" + done + fi + args: + executable: /bin/bash + changed_when: false + run_once: true + with_items: "{{ groups[group_name_master | default('master')] }}" + - name: Copy metallb CRs manifest to first master template: src: "metallb.crs.j2" From 05fb6b566dbea8cbc241619853a2dfef359d55db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 28 Jan 2024 01:57:41 +0000 Subject: [PATCH 5/5] chore(deps): bump actions/setup-python from 2.3.3 to 5.0.0 (#423) --- .github/workflows/cache.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index 2eaf3bc56..a6d005abe 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -16,7 +16,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@75f3110429a8c05be0e1bf360334e4cced2b63fa # 2.3.3 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # 5.0.0 with: python-version: ${{ env.PYTHON_VERSION }} cache: 'pip' # caching pip dependencies diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8739c8c57..a280ac357 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@75f3110429a8c05be0e1bf360334e4cced2b63fa # 2.3.3 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # 5.0.0 with: python-version: ${{ env.PYTHON_VERSION }} cache: 'pip' # caching pip dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 16e0595a6..05e21c85a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,7 +57,7 @@ jobs: EOF - name: Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@75f3110429a8c05be0e1bf360334e4cced2b63fa # 2.3.3 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # 5.0.0 with: python-version: ${{ env.PYTHON_VERSION }} cache: 'pip' # caching pip dependencies