Newer
Older
# App of Apps des application du SI Sol kubernétisées
Ce dépôt contient toutes les applications du SI sol qui ont été kubernétisées. Il est géré par un administrateur système. Ce README vous aidera à déployer ces applications en utilisant le modèle "App of Apps" avec Argo CD.
- Argo CD doit être déjà installé sur votre cluster Kubernetes.
- Vous devez avoir les privilèges administrateur pour créer et gérer les applications dans Argo CD.
La structure typique du dépôt Git pour ce modèle est la suivante :
```bash
├── Chart.yaml
├── templates
│ ├── app1.yaml
│ ├── app2.yaml
│ ├── app3.yaml
│ └── appN.yaml
└── values.yaml
- **Chart.yaml** : Fichier boiler-plate pour Helm.
- **templates/** : Contient un fichier pour chaque application enfant.
- **values.yaml** : Contient les valeurs par défaut pour les applications.
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: app1
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
destination:
namespace: argocd
server: {{ .Values.spec.destination.server }}
project: default
source:
path: app1
repoURL: https://github.com/votre-org/votre-repo.git
targetRevision: HEAD
syncPolicy:
automated:
prune: true
```
```yaml
spec:
destination:
server: https://kubernetes.default.svc
```
Pour créer et synchroniser l'application parent, utilisez les commandes suivantes :
```sh
argocd app create apps \
--dest-namespace argocd \
--dest-server https://kubernetes.default.svc \
--repo https://forgemia.inra.fr/sol_k8s/app-of-apps-argocd.git \
--path apps
Pour synchroniser les applications enfants via la ligne de commande :
```sh
argocd app sync -l app.kubernetes.io/instance=apps
```
1. **Créer l'Application Parent** :
- Allez dans l'interface web d'Argo CD.
- Cliquez sur "NEW APP".
- Remplissez les champs nécessaires avec les informations suivantes :
- **Application Name** : `apps`
- **Project** : `default`
- **Sync Policy** : `Manual`
- **Repository URL** : `https://forgemia.inra.fr/sol_k8s/app-of-apps-argocd.git`
- **Revision** : `HEAD`
- **Path** : `.`
- **Destination Server** : `https://kubernetes.default.svc`
- **Destination Namespace** : `argocd`
- Cliquez sur "Create".
2. **Synchroniser les Applications Enfants** :
- Dans l'interface web, filtrez les applications avec le label correct :
- **Label** : `app.kubernetes.io/instance=apps`
- Sélectionnez les applications "out of sync" et cliquez sur "SYNC".
Pour s'assurer que les applications enfants et toutes leurs ressources sont supprimées lorsque l'application parent est supprimée, ajoutez le finalizer approprié dans votre définition d'application :
```yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: app1
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
...
```
- [Argo CD Documentation](https://argo-cd.readthedocs.io/en/stable/operator-manual/cluster-bootstrapping/)
Le fichier private-repo-forgemia-creds-sealed.yaml contient le secret permettant de se connecter aux dépots sous <https://forgemia.inra.fr/infosol-sisol/webapps/>, c'est un "credential template" (<https://argo-cd.readthedocs.io/en/release-2.0/user-guide/private-repositories/#credential-templates>) .
Pour le créer, créer un token sur forgemia, puis :
```yaml
apiVersion: v1
stringData:
password: LE_TOKEN
type: git
url: https://forgemia.inra.fr/infosol-sisol/webapps/
username: dummy
kind: Secret
metadata:
creationTimestamp: null
labels:
argocd.argoproj.io/secret-type: repo-creds
name: private-repo-forgemia-creds
namespace: argocd
```
et :
```bash
kubeseal -f private-repo-forgemia-creds.yaml > private-repo-forgemia-creds-sealed.yaml