Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add ci tests for k0s #1152

Merged
merged 11 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export ANSIBLE_INVENTORY_UNPARSED_WARNING="False"
export K8S_AUTH_KUBECONFIG="$(expand_path ./kubeconfig)"
# k0s
export DISABLE_TELEMETRY="true"
export DISABLE_UPGRADE_CHECK="true"
36 changes: 36 additions & 0 deletions .github/tests/config-k0s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
ci_test: true

bootstrap_distribution: k0s
bootstrap_github_username: onedr0p
bootstrap_github_repository_name: flux-cluster-template
bootstrap_github_repository_branch: main
bootstrap_age_public_key: $BOOTSTRAP_AGE_PUBLIC_KEY
bootstrap_timezone: Etc/UTC
bootstrap_acme_email: fake
bootstrap_acme_production_enabled: false
bootstrap_flux_github_webhook_token: fake
bootstrap_cloudflare_domain: fake
bootstrap_cloudflare_token: fake
bootstrap_cloudflare_account_tag: fake
bootstrap_cloudflare_tunnel_secret: fake
bootstrap_cloudflare_tunnel_id: fake
bootstrap_node_cidr: 10.10.10.0/24
bootstrap_kubeapi_addr: 10.10.10.254
bootstrap_k8s_gateway_addr: 10.10.10.253
bootstrap_external_ingress_addr: 10.10.10.252
bootstrap_internal_ingress_addr: 10.10.10.251
bootstrap_cilium_loadbalancer_mode: dsr
bootstrap_ipv6_enabled: false
bootstrap_cluster_cidr: 10.42.0.0/16
bootstrap_service_cidr: 10.43.0.0/16
bootstrap_local_storage_path: /var/openebs/local
bootstrap_nodes:
master:
- name: k8s-0
address: 10.10.10.100
username: fake
worker:
- name: k8s-1
address: 10.10.10.101
username: fake
File renamed without changes.
File renamed without changes.
19 changes: 13 additions & 6 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ jobs:
name: e2e-configure
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config-files:
- config-ipv4
- config-ipv6
addon-files:
- addons
fail-fast: false
- k0s
- k3s-ipv4
- k3s-ipv6
addon-files: ["addons"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -96,11 +96,17 @@ jobs:
shell: bash
run: |
task init
cp ./.github/tests/${{ matrix.config-files }}.yaml ./bootstrap/vars/config.yaml
cp ./.github/tests/config-${{ matrix.config-files }}.yaml ./bootstrap/vars/config.yaml
cp ./.github/tests/${{ matrix.addon-files }}.yaml ./bootstrap/vars/addons.yaml
export BOOTSTRAP_AGE_PUBLIC_KEY=$(sed -n 's/# public key: //gp' age.key)
envsubst < ./bootstrap/vars/config.yaml | sponge ./bootstrap/vars/config.yaml

- name: Export Env from config.yaml
shell: bash
id: config-env
run: |
echo "distribution=$(yq '.bootstrap_distribution' ./bootstrap/vars/config.yaml)" >> $GITHUB_OUTPUT

- name: Run configure
shell: bash
run: task --yes configure
Expand All @@ -110,6 +116,7 @@ jobs:
run: ./scripts/kubeconform.sh ./kubernetes

- name: List Hosts with Ansible
if: ${{ steps.config-env.outputs.distribution == 'k3s' || steps.config-env.outputs.distribution == 'k0s' }}
shell: bash
run: task ansible:list

Expand Down
1 change: 1 addition & 0 deletions .taskfiles/K0s/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: "3"

env:
DISABLE_TELEMETRY: "true"
DISABLE_UPGRADE_CHECK: "true"

tasks:

Expand Down
6 changes: 6 additions & 0 deletions bootstrap/tasks/addons/coredns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template unencrypted files for {{ addon_namespace }}/{{ addon_name }}
when: item.state == 'file' and 'sops' not in item.path
Expand All @@ -19,6 +21,8 @@
dest: "{{ repository_path }}/kubernetes/apps/{{ addon_namespace }}/{{ addon_name }}/{{ item.path | replace('.j2', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template encrypted files for {{ addon_namespace }}/{{ addon_name }}
block:
Expand All @@ -32,3 +36,5 @@
mode: "0644"
force: true
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"
6 changes: 6 additions & 0 deletions bootstrap/tasks/addons/csi_driver_nfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template unencrypted files for {{ addon_namespace }}/{{ addon_name }}
when: item.state == 'file' and 'sops' not in item.path
Expand All @@ -19,6 +21,8 @@
dest: "{{ repository_path }}/kubernetes/apps/{{ addon_namespace }}/{{ addon_name }}/{{ item.path | replace('.j2', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template encrypted files for {{ addon_namespace }}/{{ addon_name }}
block:
Expand All @@ -32,3 +36,5 @@
mode: "0644"
force: true
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"
6 changes: 6 additions & 0 deletions bootstrap/tasks/addons/discord_template_notifier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template unencrypted files for {{ addon_namespace }}/{{ addon_name }}
when: item.state == 'file' and 'sops' not in item.path
Expand All @@ -19,6 +21,8 @@
dest: "{{ repository_path }}/kubernetes/apps/{{ addon_namespace }}/{{ addon_name }}/{{ item.path | replace('.j2', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template encrypted files for {{ addon_namespace }}/{{ addon_name }}
block:
Expand All @@ -32,3 +36,5 @@
mode: "0644"
force: true
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"
6 changes: 6 additions & 0 deletions bootstrap/tasks/addons/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template unencrypted files for {{ addon_namespace }}/{{ addon_name }}
when: item.state == 'file' and 'sops' not in item.path
Expand All @@ -19,6 +21,8 @@
dest: "{{ repository_path }}/kubernetes/apps/{{ addon_namespace }}/{{ addon_name }}/{{ item.path | replace('.j2', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template encrypted files for {{ addon_namespace }}/{{ addon_name }}
block:
Expand All @@ -32,3 +36,5 @@
mode: "0644"
force: true
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"
6 changes: 6 additions & 0 deletions bootstrap/tasks/addons/homepage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template unencrypted files for {{ addon_namespace }}/{{ addon_name }}
when: item.state == 'file' and 'sops' not in item.path
Expand All @@ -19,6 +21,8 @@
dest: "{{ repository_path }}/kubernetes/apps/{{ addon_namespace }}/{{ addon_name }}/{{ item.path | replace('.j2', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

# https://github.com/ansible-collections/community.sops/issues/153
- name: Template encrypted files for {{ addon_namespace }}/{{ addon_name }}
Expand All @@ -33,3 +37,5 @@
mode: "0644"
force: true
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"
6 changes: 6 additions & 0 deletions bootstrap/tasks/addons/kube_prometheus_stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template unencrypted files for {{ addon_namespace }}/{{ addon_name }}
when: item.state == 'file' and 'sops' not in item.path
Expand All @@ -19,6 +21,8 @@
dest: "{{ repository_path }}/kubernetes/apps/{{ addon_namespace }}/{{ addon_name }}/{{ item.path | replace('.j2', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template encrypted files for {{ addon_namespace }}/{{ addon_name }}
block:
Expand All @@ -32,3 +36,5 @@
mode: "0644"
force: true
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"
6 changes: 6 additions & 0 deletions bootstrap/tasks/addons/kubernetes_dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template unencrypted files for {{ addon_namespace }}/{{ addon_name }}
when: item.state == 'file' and 'sops' not in item.path
Expand All @@ -19,6 +21,8 @@
dest: "{{ repository_path }}/kubernetes/apps/{{ addon_namespace }}/{{ addon_name }}/{{ item.path | replace('.j2', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template encrypted files for {{ addon_namespace }}/{{ addon_name }}
block:
Expand All @@ -32,3 +36,5 @@
mode: "0644"
force: true
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"
6 changes: 6 additions & 0 deletions bootstrap/tasks/addons/system_upgrade_controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template unencrypted files for {{ addon_namespace }}/{{ addon_name }}
when: item.state == 'file' and 'sops' not in item.path
Expand All @@ -19,6 +21,8 @@
dest: "{{ repository_path }}/kubernetes/apps/{{ addon_namespace }}/{{ addon_name }}/{{ item.path | replace('.j2', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template encrypted files for {{ addon_namespace }}/{{ addon_name }}
block:
Expand All @@ -32,3 +36,5 @@
mode: "0644"
force: true
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"
6 changes: 6 additions & 0 deletions bootstrap/tasks/addons/volsync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template unencrypted files for {{ addon_namespace }}/{{ addon_name }}
when: item.state == 'file' and 'sops' not in item.path
Expand All @@ -19,6 +21,8 @@
dest: "{{ repository_path }}/kubernetes/apps/{{ addon_namespace }}/{{ addon_name }}/{{ item.path | replace('.j2', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template encrypted files for {{ addon_namespace }}/{{ addon_name }}
block:
Expand All @@ -32,3 +36,5 @@
mode: "0644"
force: true
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"
6 changes: 6 additions & 0 deletions bootstrap/tasks/addons/weave_gitops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
state: directory
mode: "0755"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template unencrypted files for {{ addon_namespace }}/{{ addon_name }}
when: item.state == 'file' and 'sops' not in item.path
Expand All @@ -19,6 +21,8 @@
dest: "{{ repository_path }}/kubernetes/apps/{{ addon_namespace }}/{{ addon_name }}/{{ item.path | replace('.j2', '') }}"
mode: "0644"
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"

- name: Template encrypted files for {{ addon_namespace }}/{{ addon_name }}
block:
Expand All @@ -32,3 +36,5 @@
mode: "0644"
force: true
with_community.general.filetree: ["../templates/addons/{{ addon_name }}/"]
loop_control:
label: "{{ item.path }}"
6 changes: 6 additions & 0 deletions bootstrap/tasks/ansible/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
with_community.general.filetree:
- "../templates/ansible/shared/"
- "../templates/ansible/{{ bootstrap_distribution }}/"
loop_control:
label: "{{ item.path }}"

- name: Template Ansible unencrypted files
when:
Expand All @@ -21,6 +23,8 @@
with_community.general.filetree:
- "../templates/ansible/shared/"
- "../templates/ansible/{{ bootstrap_distribution }}/"
loop_control:
label: "{{ item.path }}"

- name: Template Ansible encrypted files
block:
Expand All @@ -38,3 +42,5 @@
with_community.general.filetree:
- "../templates/ansible/shared/"
- "../templates/ansible/{{ bootstrap_distribution }}/"
loop_control:
label: "{{ item.path }}"
Loading