diff --git a/bin/deploy-kube b/bin/deploy-kube index 29118f27b8..e309a4578c 100755 --- a/bin/deploy-kube +++ b/bin/deploy-kube @@ -4,6 +4,7 @@ # Configure cluster kubectl apply -f etc/kube/franklin.yaml || exit 1 +kubectl apply -f etc/kube/prover.yaml || exit 1 # Generate and apply secrets configuration from prod env . bin/.kube_gen_secret | kubectl apply -f - || exit 1 diff --git a/bin/do-clusters b/bin/do-clusters index b738087354..3902389ebe 100755 --- a/bin/do-clusters +++ b/bin/do-clusters @@ -2,5 +2,17 @@ . .setup_env CLUSTERS=`do-curl -X GET "https://api.digitalocean.com/v2/kubernetes/clusters"` +echo $CLUSTERS | jq '.kubernetes_clusters | map({id: .id, name: .name, region: .region}) | .[]' -echo $CLUSTERS | jq '.kubernetes_clusters | map({id: .id, name: .name, region: .region}) | .[]' \ No newline at end of file +for KUBECONFIG in `ls etc/kube/kubeconfig-*`; do + /usr/local/bin/kubectl get pods +done + +# KUBECONFIG=etc/kube/kubeconfig256.yaml +# for KC in `ls etc/kube/kubeconfig-*`; do +# KUBECONFIG=$KUBECONFIG:$KC +# done +# echo KUBECONFIG=$KUBECONFIG + +# /usr/local/bin/kubectl config view +# /usr/local/bin/kubectl get pods \ No newline at end of file diff --git a/bin/do-up b/bin/do-up index 019ba9cfaa..c0f2828efd 100755 --- a/bin/do-up +++ b/bin/do-up @@ -3,8 +3,8 @@ REGIONS=`cat etc/kube/regions.json | jq 'map( . ) | .[]' | tr -d '"'` CLUSTERS=`do-curl -X GET "https://api.digitalocean.com/v2/kubernetes/clusters"` -COUNT_PER_REGION=1 -COUNT_TOTAL=2 +COUNT_PER_REGION=10 +COUNT_TOTAL=100 PROVISIONED=0 @@ -27,10 +27,13 @@ for R in $REGIONS; do echo "Created cluster $NAME, id = $CLUSTER_ID" fi - do-curl -X GET "https://api.digitalocean.com/v2/kubernetes/clusters/$CLUSTER_ID/kubeconfig" > etc/kube/kubeconfig-$NAME.yaml + KUBECONFIG=etc/kube/kubeconfig-$NAME.yaml + do-curl -X GET "https://api.digitalocean.com/v2/kubernetes/clusters/$CLUSTER_ID/kubeconfig" > $KUBECONFIG - PROVISIONED=$((PROVISIONED + COUNT_PER_REGION)) + . bin/.kube_gen_secret | kubectl apply -f - || exit 1 + kubectl apply -f etc/kube/prover.yaml || exit 1 + PROVISIONED=$((PROVISIONED + COUNT_PER_REGION)) if ((PROVISIONED >= COUNT_TOTAL)) then echo "provisioned $PROVISIONED, enough!" diff --git a/etc/kube/franklin.yaml b/etc/kube/franklin.yaml index ea99891c7a..f03ea5c98e 100644 --- a/etc/kube/franklin.yaml +++ b/etc/kube/franklin.yaml @@ -91,40 +91,3 @@ spec: fieldPath: metadata.name nodeSelector: doks.digitalocean.com/node-pool: server ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: prover -spec: - replicas: 1 - selector: - matchLabels: - app: prover - template: - metadata: - labels: - app: prover - spec: - containers: - - name: prover - image: gluk64/franklin:prover - imagePullPolicy: Always - resources: - requests: - memory: "0.5Gi" - envFrom: - - secretRef: - name: franklin-secret - env: - - name: NODE_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - terminationGracePeriodSeconds: 5 - nodeSelector: - doks.digitalocean.com/node-pool: prover diff --git a/etc/kube/prover.yaml b/etc/kube/prover.yaml new file mode 100644 index 0000000000..1110b78491 --- /dev/null +++ b/etc/kube/prover.yaml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: prover +spec: + replicas: 1 + selector: + matchLabels: + app: prover + template: + metadata: + labels: + app: prover + spec: + containers: + - name: prover + image: gluk64/franklin:prover + imagePullPolicy: Always + resources: + requests: + memory: "0.5Gi" + envFrom: + - secretRef: + name: franklin-secret + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + terminationGracePeriodSeconds: 5 + nodeSelector: + doks.digitalocean.com/node-pool: prover