mirror of
https://codeberg.org/27/inception-of-things.git
synced 2025-12-31 21:56:41 +01:00
add: gitlab base
This commit is contained in:
21
p3-bonus/confs/argocd-app.yml
Normal file
21
p3-bonus/confs/argocd-app.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
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
|
||||||
|
name: ''
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: true
|
||||||
|
selfHeal: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=true
|
||||||
46
p3-bonus/confs/gitlab-app.yml
Normal file
46
p3-bonus/confs/gitlab-app.yml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: gitlab
|
||||||
|
namespace: argocd
|
||||||
|
annotations:
|
||||||
|
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
|
||||||
|
argocd.argoproj.io/compare-options: IgnoreExtraneous=true
|
||||||
|
spec:
|
||||||
|
project: default
|
||||||
|
source:
|
||||||
|
repoURL: https://charts.gitlab.io/
|
||||||
|
chart: gitlab
|
||||||
|
targetRevision: 7.1.0
|
||||||
|
helm:
|
||||||
|
values: |
|
||||||
|
global:
|
||||||
|
hosts:
|
||||||
|
domain: gitlab-app.com
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
className: traefik
|
||||||
|
configureCertmanager: false
|
||||||
|
|
||||||
|
certmanager-issuer:
|
||||||
|
email: dummy@gitlab-app.com
|
||||||
|
|
||||||
|
nginx-ingress:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
postgresql:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
redis:
|
||||||
|
enabled: true
|
||||||
|
destination:
|
||||||
|
server: https://kubernetes.default.svc
|
||||||
|
namespace: gitlab
|
||||||
|
syncPolicy:
|
||||||
|
automated:
|
||||||
|
prune: false
|
||||||
|
selfHeal: true
|
||||||
|
syncOptions:
|
||||||
|
- CreateNamespace=false
|
||||||
|
- ApplyOutOfSyncOnly=true
|
||||||
|
- RespectIgnoreDifferences=true
|
||||||
93
p3-bonus/scripts/argo-install.sh
Executable file
93
p3-bonus/scripts/argo-install.sh
Executable file
@ -0,0 +1,93 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
k3d cluster create inception-of-things
|
||||||
|
|
||||||
|
# Setup a metrics-server to prevent dumb errors
|
||||||
|
# kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
|
||||||
|
# kubectl patch deployment metrics-server -n kube-system --type='json' \
|
||||||
|
# -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls"}]'
|
||||||
|
|
||||||
|
kubectl create namespace argocd
|
||||||
|
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
|
||||||
|
|
||||||
|
echo ">"
|
||||||
|
echo "> ArgoCD is starting (this takes around ~4 minutes)..."
|
||||||
|
echo ">"
|
||||||
|
|
||||||
|
kubectl wait --namespace argocd \
|
||||||
|
--for=condition=ready pod \
|
||||||
|
--selector=app.kubernetes.io/name=argocd-server \
|
||||||
|
--timeout=600s
|
||||||
|
|
||||||
|
kubectl port-forward svc/argocd-server -n argocd 8080:443 1>/dev/null 2>/dev/null &
|
||||||
|
echo 'ArgoCD is running'
|
||||||
|
|
||||||
|
|
||||||
|
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
|
||||||
|
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||||
|
|
||||||
|
kubectl create namespace dev
|
||||||
|
echo '>'
|
||||||
|
echo '> App is starting (this takes around ~30 seconds)...'
|
||||||
|
echo '>'
|
||||||
|
kubectl apply -n argocd -f "$SCRIPT_DIR/../confs/argocd-app.yml"
|
||||||
|
echo 'App imported in ArgoCD'
|
||||||
|
|
||||||
|
kubectl create namespace gitlab
|
||||||
|
|
||||||
|
echo '>'
|
||||||
|
echo '> Gitlab is starting (this takes around ~10 minutes)...'
|
||||||
|
echo '>'
|
||||||
|
|
||||||
|
helm repo add gitlab https://charts.gitlab.io/ > /dev/null 2>&1
|
||||||
|
help repo update > /dev/null 2>&1
|
||||||
|
helm upgrade --install gitlab gitlab/gitlab \
|
||||||
|
--namespace gitlab \
|
||||||
|
--timeout 600s \
|
||||||
|
--set global.hosts.domain=gitlab-app.com \
|
||||||
|
--set global.ingress.enabled=true \
|
||||||
|
--set global.ingress.className=traefik \
|
||||||
|
--set certmanager.enabled=false \
|
||||||
|
--set certmanager-issuer.email=dummy@gitlab-app.com \
|
||||||
|
--set global.ingress.configureCertmanager=false \
|
||||||
|
--set nginx-ingress.enabled=false \
|
||||||
|
--set postgresql.enabled=true \
|
||||||
|
--set redis.install=true
|
||||||
|
|
||||||
|
kubectl wait --namespace gitlab \
|
||||||
|
--for=condition=available \
|
||||||
|
--timeout=600s \
|
||||||
|
deployment/gitlab-webservice-default
|
||||||
|
|
||||||
|
kubectl port-forward -n gitlab svc/gitlab-webservice-default 8081:8181 1>/dev/null 2>/dev/null &
|
||||||
|
|
||||||
|
TRAEFIK_IP=$(kubectl get service -n kube-system traefik -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||||
|
|
||||||
|
echo Traefik ip is : $TRAEFIK_IP
|
||||||
|
if grep -q argo-app.com /etc/hosts; then
|
||||||
|
sudo sed -i "/argo-app.com/d" /etc/hosts
|
||||||
|
fi
|
||||||
|
echo "$TRAEFIK_IP argo-app.com" | sudo tee -a "/etc/hosts"
|
||||||
|
echo App is now reachable at argo-app.com
|
||||||
|
echo
|
||||||
|
|
||||||
|
if grep -q gitlab-app.com /etc/hosts; then
|
||||||
|
sudo sed -i "/argo-app.com/d" /etc/hosts
|
||||||
|
fi
|
||||||
|
echo "$TRAEFIK_IP gitlab-app.com" | sudo tee -a "/etc/hosts"
|
||||||
|
echo Gitlab is now reachable at gitlab-app.com
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "=== Login into ArgoCD with: ==="
|
||||||
|
echo Username: admin
|
||||||
|
echo -n "Password: "
|
||||||
|
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
|
||||||
|
echo
|
||||||
|
echo "==============================="
|
||||||
|
echo
|
||||||
|
echo "=== Login into Gitlab with: ==="
|
||||||
|
echo Username: admin
|
||||||
|
echo -n "Password: "
|
||||||
|
kubectl -n gitlab get secret gitlab-gitlab-initial-root-password -o jsonpath='{.data.password}' | base64 -d
|
||||||
|
echo
|
||||||
|
echo "==============================="
|
||||||
10
p3-bonus/scripts/uninstall.sh
Executable file
10
p3-bonus/scripts/uninstall.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
|
||||||
|
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
||||||
|
|
||||||
|
kubectl delete -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
|
||||||
|
kubectl delete -n argocd -f "$SCRIPT_DIR/../confs/argocd-app.yml"
|
||||||
|
kubectl delete -n argocd-f "$SCRIPT_DIR/../confs/gitlab-app.yml"
|
||||||
|
kubectl delete namespace argocd
|
||||||
|
kubectl delete namespace dev
|
||||||
|
kubectl delete namespace gitlab
|
||||||
|
k3d cluster delete inception-of-things
|
||||||
Reference in New Issue
Block a user