50 lines
2.4 KiB
Makefile
50 lines
2.4 KiB
Makefile
DESTDIR=./
|
|
|
|
REG_CRED=$(shell kubectl get secret -n tekton -l type=regcred -o jsonpath='{.items[0].metadata.name}')
|
|
SUBNET=$(shell docker network inspect kind --format '{{ (index .IPAM.Config 0).Subnet }}')
|
|
BASEIP=$(shell docker network inspect kind --format '{{ (index .IPAM.Config 0).Subnet }}' | cut -d "/" -f 1)
|
|
|
|
.PHONY: help
|
|
help:
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
.PHONY: deploy
|
|
create-cluster: ## Créer un cluster kubernetes avec Kind
|
|
kind create cluster --name tekton --config kind/kind-tekton.yaml
|
|
@echo "SubNet Docker :" $(SUBNET)
|
|
@echo -e " \x1b[32m✓\x1b[0m Cluster Kind déployé"
|
|
|
|
.PHONY: setup-cluster
|
|
setup-cluster: create cluster
|
|
kubectl apply -k kind/cluster --server-side
|
|
kubectl --namespace ingress-nginx rollout status --timeout 5m deployment/ingress-nginx-controller
|
|
kubectl --namespace metallb-system rollout status --timeout 5m deployment controller
|
|
sed -i "/mse.dev.local/ s/.*/ $(BASEIP)\tmse.dev.local/g" kind/cluster/coredns/custom-dns.yaml
|
|
kubectl apply -f kind/cluster/coredns/custom-dns.yaml
|
|
kubectl -n kube-system rollout restart deployment/coredns
|
|
kubectl -n kube-system rollout status --timeout 5m deployment/coredns
|
|
@yq -i ".spec.addresses = [\"$(SUBNET)\"]" kind/cluster/lb/resources/ipaddresspoool.yaml
|
|
kubectl apply -k kind/cluster/lb --server-side
|
|
|
|
deploy-dev: ## Déploie le projet dans le cluster (nécessite la variable $HARBOR_USER_NAME)
|
|
skaffold dev --cleanup=false
|
|
|
|
delete-cluster: ## Supprime le cluster kubernetes Kind
|
|
kind delete clusters tekton
|
|
|
|
docker-secret:
|
|
cp kustomization/base/tekton/secret/gitea/access_token.dist kustomization/base/tekton/secret/gitea/access_token
|
|
cp kustomization/base/tekton/secret/gitea/basicauth.dist kustomization/base/tekton/secret/gitea/basicauth
|
|
cp kustomization/base/tekton/secret/ssh/id_ed25519.dist kustomization/base/tekton/secret/ssh/id_ed25519
|
|
cp kustomization/base/tekton/secret/ssh/known_hosts.dist kustomization/base/tekton/secret/ssh/known_hosts
|
|
|
|
docker login reg.cadoles.com
|
|
docker --config kustomization/base/tekton/secret/dockerconfig login reg.cadoles.com
|
|
mv kustomization/base/tekton/secret/dockerconfig/config.json kustomization/base/tekton/secret/dockerconfig/.dockerconfigjson
|
|
|
|
.mktools:
|
|
rm -rf .mktools
|
|
curl -q https://forge.cadoles.com/Cadoles/mktools/raw/branch/master/install.sh | $(SHELL)
|
|
|
|
-include .mktools/*.mk
|