diff --git a/p2/confs/app3/service.yml b/p2/confs/app3/service.yml index cefa364..39cdc77 100644 --- a/p2/confs/app3/service.yml +++ b/p2/confs/app3/service.yml @@ -9,3 +9,4 @@ spec: ports: - port: 80 targetPort: 80 + diff --git a/p3/confs/app.yml b/p3/confs/app.yml deleted file mode 100644 index 5d73426..0000000 --- a/p3/confs/app.yml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: app-deployment -spec: - selector: - matchLabels: - app: app - template: - metadata: - labels: - app: app - spec: - containers: - - name: app - image: wil42/playground:v2 - ports: - - containerPort: 8888 diff --git a/p3/confs/argocd-app.yml b/p3/confs/argocd-app.yml new file mode 100644 index 0000000..a9a23c2 --- /dev/null +++ b/p3/confs/argocd-app.yml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: my-app + namespace: argocd +spec: + project: default + source: + repoURL: https://github.com/Namonay/vvaas42.git + targetRevision: HEAD + path: '.' + destination: + server: https://kubernetes.default.svc + namespace: dev + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true \ No newline at end of file diff --git a/p3/confs/ingress.yml b/p3/confs/ingress.yml deleted file mode 100644 index 5feb220..0000000 --- a/p3/confs/ingress.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: app-ingress -spec: - rules: - - host: localhost - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: app-service - port: - number: 80 \ No newline at end of file diff --git a/p3/confs/service.yml b/p3/confs/service.yml deleted file mode 100644 index 7a030bb..0000000 --- a/p3/confs/service.yml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: app-service -spec: - type: ClusterIP - selector: - app: app - ports: - - port: 80 - targetPort: 8888 diff --git a/p3/scripts/argo-install.sh b/p3/scripts/argo-install.sh index b3648a6..c38defd 100755 --- a/p3/scripts/argo-install.sh +++ b/p3/scripts/argo-install.sh @@ -10,16 +10,20 @@ kubectl wait --namespace argocd \ --timeout=300s \ 1>/dev/null 2>/dev/null kubectl port-forward svc/argocd-server -n argocd 8080:443 1>/dev/null 2>/dev/null & -echo 'ArgoCD is running (http://127.0.0.1:8080)' -echo login=admin password=\'$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d)\' +echo 'ArgoCD is running' kubectl create namespace dev -kubectl apply -n dev -f ../confs/app.yml +kubectl apply -n argocd -f ../confs/argocd-app.yml echo 'App is starting...' -kubectl wait --namespace argocd \ +kubectl wait --namespace dev \ --for=condition=ready pod \ - --selector=app.kubernetes.io/name=argocd-server \ + --selector=app.kubernetes.io/name=app-deployment \ --timeout=300s \ 1>/dev/null 2>/dev/null -kubectl apply -n dev -f ../confs/service.yml -kubectl apply -n dev -f ../confs/ingress.yml -echo 'App is running (http://127.0.0.1:80)' \ No newline at end of file +echo 'App imported in ArgoCD' +TRAEFIK_IP=$(kubectl get service -n kube-system traefik -o jsonpath='{.status.loadBalancer.ingress[0].ip}') +echo App is reachable at argo-app.com:8888 +echo Traefik ip is : $TRAEFIK_IP +echo Login into ArgoCD with: +echo Username: admin +ADMIN_PASS=$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d) +echo Password: \'$ADMIN_PASS\' \ No newline at end of file diff --git a/p3/scripts/setup-hostfile.sh b/p3/scripts/setup-hostfile.sh new file mode 100644 index 0000000..3c28a8e --- /dev/null +++ b/p3/scripts/setup-hostfile.sh @@ -0,0 +1,2 @@ +echo "172.19.0.2 argo-app.com" | sudo tee -a "/etc/hosts" +# Edit the IP with the ip in the output of argo-install.sh \ No newline at end of file diff --git a/p3/scripts/uninstall.sh b/p3/scripts/uninstall.sh index 2bbc2bb..846e4ab 100755 --- a/p3/scripts/uninstall.sh +++ b/p3/scripts/uninstall.sh @@ -1,7 +1,5 @@ kubectl delete -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml -kubectl delete -n dev -f ../confs/ingress.yml -kubectl delete -n dev -f ../confs/service.yml -kubectl delete -n dev -f ../confs/app.yml +kubectl delete -n argocd -f ../confs/argocd-app.yml kubectl delete namespace argocd kubectl delete namespace dev k3d cluster delete inception-of-things \ No newline at end of file