Commit cc69900d authored by Dmytro Bogatov's avatar Dmytro Bogatov 💕

Use daemonsets for websites, deploy june19.

parent b9daaf08
Pipeline #4490 passed with stage
in 2 seconds
......@@ -8,7 +8,6 @@ shopt -s globstar
cd "${0%/*}"
CWD=$(pwd)
REPLICAS="3"
KEBEFILE="--kubeconfig=${CWD}/kubeconfig.yaml"
source .secret.sh
......@@ -92,7 +91,7 @@ generate-service () {
service=$1
image=$2
replicas=$REPLICAS
replicated=true
auth=""
rps="10"
......@@ -100,7 +99,7 @@ generate-service () {
mkdir -p services/$service/ingress
cp sources/service/{service,deployment}.yaml services/$service
cp sources/service/{service,deployment,daemonset}.yaml services/$service
cp sources/service/ingress/{main,rule-*}.yaml services/$service/ingress
if [ "$service" == "webcam-dbogatov-org" ] || [ "$service" == "token-dbogatov-org" ]
......@@ -113,9 +112,9 @@ generate-service () {
rps="100"
fi
if [ "$service" == "ore-dbogatov-org" ]
if [ "$service" == "ore-dbogatov-org" ] || [ "$service" == "legacy-dbogatov-org" ]
then
replicas="1"
replicated=false
fi
if [ "$service" == "moon-travel-com-ua" ]
......@@ -140,17 +139,24 @@ generate-service () {
digest="${digest#\"}"
image=${image%:*}@$digest
sed -i -e "s#__IMAGE__#$image#g" services/$service/{service,deployment}.yaml
sed -i -e "s#__NAME__#$service#g" services/$service/{service,deployment}.yaml
sed -i -e "s#__URL__#$URL#g" services/$service/{service,deployment}.yaml
sed -i -e "s#__REPLICAS__#$replicas#g" services/$service/{service,deployment}.yaml
sed -i -e "s#__AUTH__#$auth#g" services/$service/{service,deployment}.yaml
sed -i -e "s#__IMAGE__#$image#g" services/$service/{service,deployment,daemonset}.yaml
sed -i -e "s#__NAME__#$service#g" services/$service/{service,deployment,daemonset}.yaml
sed -i -e "s#__URL__#$URL#g" services/$service/{service,deployment,daemonset}.yaml
sed -i -e "s#__AUTH__#$auth#g" services/$service/{service,deployment,daemonset}.yaml
sed -i -e "s#__REPLICAS__#$replicas#g" services/$service/{service,daemonset,daemonset}.yaml
if [ "$replicated" = true ]
then
rm services/$service/deployment.yaml
else
rm services/$service/daemonset.yaml
fi
generate-ingress "$URL" "$service" "$auth" "$rps"
if [ "$service" == "shevastream-com" ]
then
cat sources/shevastream/deployment.yaml >> services/$service/deployment.yaml
cat sources/shevastream/daemonset.yaml >> services/$service/daemonset.yaml
fi
}
......
......@@ -51,7 +51,7 @@ APITOKEN=$(cat ~/.config/digital-ocean/token)
# PROVISION
CLUSTER_ID=$(curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $APITOKEN" -d '{"name": "'"$NAME"'","region": "nyc1","version": "'"$VERSION"'","node_pools": [{"size": "s-1vcpu-2gb","count": 4,"name": "main-pool"}]}' "https://api.digitalocean.com/v2/kubernetes/clusters" | jq -r '.kubernetes_cluster.id')
CLUSTER_ID=$(curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $APITOKEN" -d '{"name": "'"$NAME"'","region": "nyc1","version": "'"$VERSION"'","node_pools": [{"size": "s-1vcpu-2gb","count": 3,"name": "main-pool"}]}' "https://api.digitalocean.com/v2/kubernetes/clusters" | jq -r '.kubernetes_cluster.id')
echo "Cluster ID: $CLUSTER_ID"
STATE="init"
while [ "$STATE" != "running" ]
......@@ -116,8 +116,6 @@ echo "Generating config files"
echo "Applying config files"
kubectl $KEBEFILE apply -R -f sources/nginx/
kubectl $KEBEFILE apply -R -f services/
kubectl $KEBEFILE apply -R -f ./dashboard/ingress.yaml
......
......@@ -90,7 +90,7 @@ subjects:
# ------------------- Dashboard Deployment ------------------- #
kind: Deployment
apiVersion: apps/v1beta2
apiVersion: apps/v1
metadata:
labels:
k8s-app: kubernetes-dashboard
......@@ -109,7 +109,7 @@ spec:
spec:
containers:
- name: kubernetes-dashboard
image: k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0
image: k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1
ports:
- containerPort: 8443
protocol: TCP
......@@ -143,6 +143,8 @@ spec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
# nodeSelector:
# node-role.kubernetes.io/master: ""
---
# ------------------- Dashboard Service ------------------- #
......
......@@ -59,7 +59,7 @@ DOMAINS["dmytro.app"]=$AVALUE
DOMAINS["bogatov.app"]=$AVALUE
DOMAINS["bogatov.dev"]=$AVALUE
DOMAINS["orlova.app"]=$AVALUE
# DOMAINS["orlova.app"]=$AVALUE
DOMAINS["netwatch.app"]=$AVALUE
DOMAINS["bogatov.kiev.ua"]=$AVALUE
DOMAINS["darinagulley.com"]=$AVALUE
......
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: __NAME__
namespace: websites
labels:
application: __NAME__
spec:
selector:
matchLabels:
application: __NAME__
template:
metadata:
labels:
application: __NAME__
spec:
imagePullSecrets:
- name: regsecret
containers:
- name: __NAME__
image: __IMAGE__
imagePullPolicy: Always
......@@ -6,7 +6,7 @@ metadata:
labels:
application: __NAME__
spec:
replicas: __REPLICAS__
replicas: 1
selector:
matchLabels:
application: __NAME__
......
volumeMounts:
- name: appsettings
mountPath: "/run/secrets/settings/"
volumeMounts:
- name: appsettings
mountPath: "/run/secrets/settings/"
volumes:
- name: appsettings
secret:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment