From 0a686fa3b2da1b5434715b375a771aea1d1d56be Mon Sep 17 00:00:00 2001 From: Patrick Hermann Date: Sat, 19 Oct 2024 08:09:34 +0000 Subject: [PATCH] upgraded --- README.md | 24 +++- Taskfile.yaml | 1 + collection.yaml | 204 ---------------------------------- defaults/main.yaml | 4 +- molecule/default/converge.yml | 41 +++---- molecule/default/kubeconfig | 19 ---- tests/rke2-cilium.yaml | 11 -- 7 files changed, 35 insertions(+), 269 deletions(-) delete mode 100644 collection.yaml delete mode 100644 molecule/default/kubeconfig delete mode 100644 tests/rke2-cilium.yaml diff --git a/README.md b/README.md index a178c2b..bc0cad5 100644 --- a/README.md +++ b/README.md @@ -181,20 +181,34 @@ ansible-playbook -i inv play.yaml -vv ```bash cat < ./play.yaml -- hosts: all +--- +- name: Converge + hosts: all + gather_facts: true become: true vars: + rke_state: present #absent rke_version: 2 - rke2_k8s_version: 1.26.0 + rke2_k8s_version: 1.30.4 rke2_airgapped_installation: true - rke2_release_kind: rke2r2 # rke2r1 + rke2_release_kind: rke2r1 #rke2r2 + rke2_cni: cilium disable_rke2_components: - rke2-ingress-nginx - rke-snapshot-controller cluster_setup: multinode - install_containerd: false # bring your own containerd - containerdRootPath: /var/lib/containerd/ # directory must not exist + rke2_cni: cilium + values_cilium: | + --- + eni: + enabled: true + + helmChartConfig: + cilium: + name: rke2-cilium + namespace: kube-system + release_values: "{{ values_cilium }}" roles: - role: deploy-configure-rke diff --git a/Taskfile.yaml b/Taskfile.yaml index f5f9c98..60146e1 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -21,6 +21,7 @@ tasks: cmds: - pip install -U setuptools pip 'molecule' - pip install molecule-docker + - pip install netaddr - molecule --version setup-venv: diff --git a/collection.yaml b/collection.yaml deleted file mode 100644 index 3778416..0000000 --- a/collection.yaml +++ /dev/null @@ -1,204 +0,0 @@ ---- -name: deploy_rke -version: 1.29.4-5 -namespace: sthings -requirements: | - roles: - - src: https://github.com/stuttgart-things/deploy-configure-rke.git - scm: git - version: main - - src: https://github.com/stuttgart-things/configure-rke-node.git - scm: git - version: main - - src: https://github.com/stuttgart-things/install-requirements.git - scm: git - version: main - - src: https://github.com/stuttgart-things/download-install-binary.git - scm: git - version: 2024.04.19 - - src: https://github.com/stuttgart-things/create-os-user.git - scm: git - version: 2024.04.25 - - src: https://github.com/stuttgart-things/install-configure-docker.git - scm: git - version: 2024.04.30 - -vars: {} -playbooks: - - name: rke2 - play: | - - hosts: all - become: true - vars: - rke_version: 2 - rke2_k8s_version: 1.29.4 - rke2_airgapped_installation: true - rke2_release_kind: rke2r1 - disable_rke2_components: - - rke2-ingress-nginx - - rke-snapshot-controller - cluster_setup: multinode - - roles: - - role: sthings.deploy_rke.deploy_configure_rke - - - name: rke1 - play: | - - hosts: all - become: true - vars: - rke_docker_version: '=5:23.0.6-1~ubuntu.22.04~jammy' - rke_docker_ce_version: '5:23.0.6*' - rke_version: 1 - rke_user_name: rke - rke_installer_version: 1.4.8 - rke_kubernetes_version: v1.26.7-rancher1-1 - project_folder: rancher-things - rke_create_rke_user: true - network_plugin: calico - rke2_airgapped_installation: false - - roles: - - role: sthings.deploy_rke.deploy_configure_rke - - - name: deploy-to-k8s - play: | - --- - - hosts: "{{ target_host | default('localhost') }}" - vars_files: - - "{{ path | default('.') }}/{{ profile }}.yaml" - - #path_to_kubeconfig: ~/.kube/rancher - - tasks: - - name: Create pre manifests - ansible.builtin.include_tasks: manifests.yaml - loop: "{{ q('ansible.builtin.dict', pre_manifests) }}" - when: pre_manifests is defined - - - name: Configure and (un)install helm charts - block: - - name: Install helm requirements - ansible.builtin.include_tasks: helm-config.yaml - - - name: Deploy helm chart(s) - ansible.builtin.include_tasks: helm.yaml - loop: "{{ q('ansible.builtin.dict', helm_releases) }}" - when: helm_releases is defined - - - name: Create post manifests - ansible.builtin.include_tasks: manifests.yaml - loop: "{{ q('ansible.builtin.dict', post_manifests) }}" - when: post_manifests is defined - - - name: helm-config - play: | - --- - - name: Add helm chart repositories - kubernetes.core.helm_repository: - name: "{{ item.key }}" - repo_url: "{{ item.value.url }}" - force_update: true - loop: "{{ q('ansible.builtin.dict', helm_repositories) }}" - when: helm_repositories is defined and state == "present" - - - name: Install Helm Diff - kubernetes.core.helm_plugin: - plugin_path: "https://github.com/databus23/helm-diff" - state: present - when: state == "present" - - - - name: helm - play: | - --- - - name: Create values on disk - ansible.builtin.copy: - content: "{{ item.value.release_values }}" #().0 - dest: "/tmp/{{ item.key }}-values.yaml.j2" - when: state == "present" and item.value.values is defined - - - name: Deploy helm charts - kubernetes.core.helm: - kubeconfig: "{{ path_to_kubeconfig }}" - name: "{{ item.key }}" - chart_ref: "{{ item.value.ref }}" - chart_version: "{{ item.value.version | default('latest') }}" - release_namespace: "{{ item.value.namespace }}" - create_namespace: true - state: "{{ state | default('present') }}" - values: "{{ lookup('template', '/tmp/{{ item.key }}-values.yaml.j2') | from_yaml | default(omit) }}" - wait: "{{ item.values.wait | default(omit) }}" - when: helm_releases is defined - ignore_errors: "{{ item.value.ignore | default(omit) }}" - - - name: manifests - play: | - --- - - name: Create template on disk - ansible.builtin.copy: - content: "{{ item.value }}" - dest: "/tmp/{{ item.key }}.yaml.j2" - when: state == "present" - - - name: Deploy additional manifests - kubernetes.core.k8s: - kubeconfig: "{{ path_to_kubeconfig }}" - state: "{{ state | default('present') }}" - definition: "{{ lookup('template', '/tmp/{{ item.key }}.yaml.j2') | from_yaml }}" - - - name: ingress-nginx - play: | - --- - helm_repositories: - ingress-nginx: - url: https://kubernetes.github.io/ingress-nginx - - helm_releases: - ingress-nginx: - ref: ingress-nginx/ingress-nginx - version: 4.10.1 - namespace: ingress-nginx - ignore: false - wait: true - release_values: {} - - - name: metallb - play: | - --- - helm_repositories: - bitnami: - url: https://charts.bitnami.com/bitnami - - helm_releases: - metallb: - ref: bitnami/metallb - version: 6.1.4 - namespace: metallb-system - ignore: true - wait: true - release_values: {} - - post_manifests: - ip_pool: | - apiVersion: metallb.io/v1beta1 - kind: IPAddressPool - metadata: - name: ip-pool - namespace: metallb-system - labels: - app: metallb - spec: - addresses: - - 10.31.102.112-10.31.102.112 - poolAdvertisement: | - apiVersion: metallb.io/v1beta1 - kind: L2Advertisement - metadata: - name: pool-advertisement - namespace: metallb-system - labels: - app: metallb - spec: - ipAddressPools: - - ip-pool diff --git a/defaults/main.yaml b/defaults/main.yaml index afeac2d..7b46042 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -14,7 +14,7 @@ cluster_setup: multinode rke_installscript_url: https://get.rke2.io update_packages: true rke2_os_packages: curl -rke2_cni: canal +rke2_cni: cilium kubeconfig_mode_644: true rke2_type: server rke2_imagelist: rke2-images-all.linux-amd64.txt @@ -244,4 +244,4 @@ helmChartConfig: values_cilium: | --- eni: - enabled: true \ No newline at end of file + enabled: true diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 9160033..76b9db8 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -3,44 +3,29 @@ hosts: all gather_facts: true become: true - # tasks: - # - name: Replace this task with one that validates your content - # ansible.builtin.shell: | - # sudo apt-get update -y vars: - #rke_state: absent + rke_state: present #absent rke_version: 2 - rke2_k8s_version: 1.26.0 + rke2_k8s_version: 1.30.4 rke2_airgapped_installation: true - rke2_release_kind: rke2r2 # rke2r1 + rke2_release_kind: rke2r1 # rke2r2 rke2_cni: cilium disable_rke2_components: - rke2-ingress-nginx - rke-snapshot-controller cluster_setup: multinode + rke2_cni: cilium + values_cilium: | + --- + eni: + enabled: true - - - + helmChartConfig: + cilium: + name: rke2-cilium + namespace: kube-system + release_values: "{{ values_cilium }}" roles: - role: deploy-configure-rke - -# - hosts: all -# become: true - -# vars: -# rke_version: 2 -# rke2_k8s_version: 1.26.0 -# rke2_airgapped_installation: true -# rke2_release_kind: rke2r2 # rke2r1 -# disable_rke2_components: -# - rke2-ingress-nginx -# - rke-snapshot-controller -# cluster_setup: multinode -# install_containerd: false # bring your own containerd -# containerdRootPath: /var/lib/containerd/ # directory must not exist - -# roles: -# - role: deploy-configure-rke \ No newline at end of file diff --git a/molecule/default/kubeconfig b/molecule/default/kubeconfig deleted file mode 100644 index 32c356f..0000000 --- a/molecule/default/kubeconfig +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJlakNDQVIrZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWtNU0l3SUFZRFZRUUREQmx5YTJVeUxYTmwKY25abGNpMWpZVUF4TnpJNU16RTVOVFEwTUI0WERUSTBNVEF4T1RBMk16SXlORm9YRFRNME1UQXhOekEyTXpJeQpORm93SkRFaU1DQUdBMVVFQXd3WmNtdGxNaTF6WlhKMlpYSXRZMkZBTVRjeU9UTXhPVFUwTkRCWk1CTUdCeXFHClNNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJHQkJyNHJsckZ6VGpxSTlJNmFqMmRmQ1JYYVZpVUU5U1gzQXU4N0cKSzZJeGVpclRDdWpLbElhVVJ6b0ovRThHczVxR2FzaEwvcUhXcEU2L2xqYUJVM3VqUWpCQU1BNEdBMVVkRHdFQgovd1FFQXdJQ3BEQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01CMEdBMVVkRGdRV0JCUXBxV0h6eC9zNTdKTTVEVnBSCnllQm9pYmJCQmpBS0JnZ3Foa2pPUFFRREFnTkpBREJHQWlFQWkzOHZkdGpwY09jN0NvQzRzcms5VU1LSzc4VksKc0FjUVRrc01QbVJPaWVVQ0lRRE1DcUZOQlVtODJucTNaVU1HUTB6MFpXRHljMnBZMk1JZE1hcFFPZlBHbkE9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== - server: https://10.31.102.137:6443 - name: default -contexts: -- context: - cluster: default - user: default - name: default -current-context: default -kind: Config -preferences: {} -users: -- name: default - user: - client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrakNDQVRpZ0F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QWdFR0NDcUdTTTQ5QXdFSEEwSUFCT01LdXZ5d2d2bXNkaEpRbGVHdVpiUm1wQmRDTVhnVmJtT1RNazdVClcvR1lDNVQ4ZXVlVnpLejc2VE1kQnpMbmtNdnVhUXAwaUg2ZTlNa2N5eFZpUWhtalFqQkFNQTRHQTFVZER3RUIKL3dRRUF3SUNwREFQQmdOVkhSTUJBZjhFQlRBREFRSC9NQjBHQTFVZERnUVdCQlJRbkExeUhXeUlnTHk0ci9ERQpWQWdvMTIzeTdUQUtCZ2dxaGtqT1BRUURBZ05KQURCR0FpRUFuOUJ4MjRwMFk0VlA5aEFWdHdscEVoWEpwcmNqCkhlYmFid1oxU3k5eXdUd0NJUURReXMvTXpMWWtSQjFSNTdEUDU1QjJLQ3VYd2VraXZ5WGVCV3RuQUhZSy9RPT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo= - client-key-data: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSUN6L01CVlErZ1BhQTI5NzQzNmlxSHhOckE4MWpsakFNY1FaT0FzL0oxdnBvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFN0hoSE5ma0s2N1lhRnRscDFrd3JPZkI0V3BMeENseVZITmdadU5sdTZwaHhKMlZ4Y0g4Nwphc1FCaXpROTIrV0Joa3JYZVMvcUh0elNKZlM0Ly9nVk1nPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo= diff --git a/tests/rke2-cilium.yaml b/tests/rke2-cilium.yaml deleted file mode 100644 index 7915924..0000000 --- a/tests/rke2-cilium.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: helm.cattle.io/v1 -kind: HelmChartConfig -metadata: - name: rke2-cilium - namespace: kube-system -spec: - valuesContent: |- - --- - eni: - enabled: false