khuedoan-homelab/system/bootstrap.yml
Khue Doan 8d00d55eb1 refactor(argocd)!: merge bootstrap and system
This is a breaking change and requires cluster rebuild (carefully
replacing the ApplicationSets may should work but I didn't bother at the
current alpha stage):

- ApplicationSets are merged into a single root one
  to use the progressive sync feature when it's ready.
- Switched to server side apply to avoid CRDs not ready issues.

Also replace the apply script with Ansible, since the Ansible Helm
dependency update feature was released.
2024-04-17 15:21:11 +07:00

37 lines
1.1 KiB
YAML

- name: Bootstrapping the cluster
hosts: localhost
tasks:
- name: Create ArgoCD namespace
kubernetes.core.k8s:
api_version: v1
kind: Namespace
name: argocd
state: present
- name: Check if this is the first installation
kubernetes.core.k8s_info:
kind: Pod
label_selectors:
- app.kubernetes.io/instance=gitea
field_selectors:
- status.phase=Running
register: first_install
- name: Render ArgoCD manifests from Helm chart
kubernetes.core.helm_template:
chart_ref: ./argocd
include_crds: true
release_name: argocd
release_namespace: argocd
dependency_update: true
values_files:
- "argocd/{{ (first_install.resources | length == 0) | ternary('values-seed.yaml', 'values.yaml') }}"
register: argocd_manifests
- name: Apply ArgoCD manifests
kubernetes.core.k8s:
resource_definition: "{{ argocd_manifests.stdout }}"
apply: true
server_side_apply:
field_manager: argocd-controller