Fix git repository organization;Move cluster api manifests to gitops;Rename gitrepo's
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Danny Bessems 2023-04-01 16:10:38 +02:00
parent 570047df3b
commit 3f9fc4b7aa
5 changed files with 71 additions and 15 deletions

View File

@ -119,18 +119,18 @@
# auto_init: true
# default_branch: main
description: GitOps manifests
- organization: mc
body:
name: GitOps.HelmCharts
# auto_init: true
# default_branch: main
description: Helm charts
- organization: wl
body:
name: GitOps.Config
# auto_init: true
# default_branch: main
description: GitOps manifests
- organization: wl
body:
name: GitOps.HelmCharts
# auto_init: true
# default_branch: main
description: Helm charts
loop_control:
label: "{{ item.organization ~ '/' ~ item.body.name }}"

View File

@ -39,7 +39,7 @@
mode: 0600
vars:
_template:
name: argocd-gitrepo-metacluster
name: argocd-gitrepo-mc-gitopsconfig
namespace: argo-cd
url: https://git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.Config.git
notify:

View File

@ -167,6 +167,21 @@
git push https://administrator:{{ vapp['metacluster.password'] | urlencode }}@git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.ClusterAPI.git --all
chdir: "{{ capi_clustermanifest.path }}"
- name: Configure Cluster API repository
ansible.builtin.template:
src: gitrepo.j2
dest: /var/lib/rancher/k3s/server/manifests/{{ _template.name }}-manifest.yaml
owner: root
group: root
mode: 0600
vars:
_template:
name: argocd-gitrepo-mc-gitopsclusterapi
namespace: argo-cd
url: https://git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.ClusterAPI.git
notify:
- Apply manifests
# Temporarily disabled until manifests are properly managed by gitops
# - name: Cleanup tempfolder
# ansible.builtin.file:
@ -174,6 +189,7 @@
# state: absent
# when: capi_clustermanifest.path is defined
# TODO: Move to gitops
- name: Create in-cluster IpPool
kubernetes.core.k8s:
template: ippool.j2
@ -201,13 +217,37 @@
retries: "{{ playbook.retries }}"
delay: "{{ (storage_benchmark | int) * (playbook.delay.medium | int) }}"
- name: Apply workload cluster manifest
kubernetes.core.k8s:
definition: >-
{{ clusterctl_newcluster.stdout }}
wait: true
kubeconfig: "{{ kubeconfig.path }}"
# TODO: move to git repo
- name: Create application
ansible.builtin.template:
src: application.j2
dest: /var/lib/rancher/k3s/server/manifests/{{ _template.application.name }}-manifest.yaml
owner: root
group: root
mode: 0600
vars:
_template:
application:
name: argocd-application-clusterapi
namespace: argo-cd
cluster:
name: https://kubernetes.default.svc
namespace: default
repository:
url: https://git.{{ vapp['metacluster.fqdn'] }}/mc/GitOps.ClusterAPI.git
path: manifests
revision: main
notify:
- Apply manifests
- name: Trigger handlers
ansible.builtin.meta: flush_handlers
# - name: Apply workload cluster manifest
# kubernetes.core.k8s:
# definition: >-
# {{ clusterctl_newcluster.stdout }}
# wait: true
# kubeconfig: "{{ kubeconfig.path }}"
- name: Wait for cluster to be available
ansible.builtin.shell:

View File

@ -62,7 +62,7 @@
mode: 0600
vars:
_template:
name: argocd-gitrepo-workloadcluster
name: argocd-gitrepo-wl-gitopsconfig
namespace: argo-cd
url: https://git.{{ vapp['metacluster.fqdn'] }}/wl/GitOps.Config.git
notify:

View File

@ -0,0 +1,16 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: {{ _template.application.name }}
namespace: {{ _template.application.namespace }}
spec:
destination:
namespace: {{ _template.cluster.namespace }}
server: {{ _template.cluster.name }}
project: default
source:
repoURL: {{ _template.repository.url }}
path: {{ _template.repository.path }}
targetRevision: {{ _template.repository.revision }}
syncPolicy:
automated: {}