Ver Fonte

Change cloud in gcloud-deploy (#1729)

* Change roles

* Disable tests for faster iterations

* Remove condiiton

* Test python base64 decode

* Test a different file

* Decode that shit

* Use normal file also

* Print the file

* Remove waste of time

* Remove more waste

* Fix it

* Change space name

* Turn everything back
kiloreux há 5 anos atrás
pai
commit
31e821fa38

+ 11 - 29
packages/@uppy/companion/infra/kube/companion/companion-kube.yaml

@@ -2,7 +2,7 @@ apiVersion: v1
 kind: Service
 metadata:
   name: companion
-  namespace: uppy
+  namespace: companion
   labels: 
     app: companion
 spec:
@@ -17,41 +17,25 @@ apiVersion: apps/v1
 kind: StatefulSet
 metadata:
   name: companion
-  namespace: uppy
+  namespace: companion
 spec:
   selector:
     matchLabels:
       app: companion
-  replicas: 2
+  replicas: 1
   serviceName: "companion"
   template:
     metadata:
       labels:
         app: companion
     spec:
-      affinity:
-        nodeAffinity:
-          requiredDuringSchedulingIgnoredDuringExecution:
-              nodeSelectorTerms:
-              - matchExpressions:
-                - key: cloud.google.com/gke-preemptible
-                  operator: Exists
-        podAntiAffinity:
-          requiredDuringSchedulingIgnoredDuringExecution:
-          - labelSelector:
-              matchExpressions:
-              - key: app
-                operator: In
-                values:
-                - companion
-            topologyKey: kubernetes.io/hostname    
       containers:
       - image: docker.io/transloadit/companion:latest
         imagePullPolicy: Always
         name: companion
         envFrom:
         - secretRef:
-            name: uppy-companion-env
+            name: companion-env
         ports:
         - containerPort: 3020
         volumeMounts:
@@ -62,7 +46,6 @@ spec:
       name: companion-data
     spec:
       accessModes: [ "ReadWriteOnce" ]
-      storageClassName: "standard"
       resources:
         requests:
           storage: 10Gi
@@ -71,30 +54,29 @@ apiVersion: extensions/v1beta1
 kind: Ingress
 metadata:
   name: companion
-  namespace: uppy
+  namespace: companion
   annotations:
     kubernetes.io/tls-acme: "true"
     kubernetes.io/ingress.class: "nginx"
     certmanager.k8s.io/cluster-issuer: "letsencrypt-prod"
     certmanager.k8s.io/acme-http01-edit-in-place: "true"
-    nginx.ingress.kubernetes.io/affinity: "cookie"
-    nginx.ingress.kubernetes.io/session-cookie-name: "route"
-    nginx.ingress.kubernetes.io/session-cookie-hash: "sha1"
 spec:
   tls:
     - secretName: server-tls
       hosts:
         - companion.uppy.io
-        - server.uppy.io
+    - secretName: uppy-tls
+      hosts:
+        - server.uppy.io        
   rules:
-  - host: server.uppy.io
+  - host: companion.uppy.io
     http:
       paths:
       - path: /
         backend:
           serviceName: companion
           servicePort: 80
-  - host: companion.uppy.io
+  - host: server.uppy.io
     http:
       paths:
       - path: /
@@ -106,7 +88,7 @@ apiVersion: autoscaling/v1
 kind: HorizontalPodAutoscaler
 metadata:
   name: companion
-  namespace: uppy
+  namespace: companion
 spec:
   scaleTargetRef:
     apiVersion: apps/v1

+ 4 - 13
packages/@uppy/companion/infra/kube/companion/companion-redis.yaml

@@ -2,11 +2,10 @@ kind: PersistentVolumeClaim
 apiVersion: v1
 metadata:
   name: uppy-redis
-  namespace: uppy
+  namespace: companion
 spec:
   accessModes:
     - ReadWriteOnce
-  storageClassName: "standard"
   resources:
     requests:
       storage: 20Gi
@@ -18,7 +17,7 @@ metadata:
     app: uppy-redis
     release: uppy
   name: uppy-redis
-  namespace: uppy
+  namespace: companion
 spec:
   replicas: 1
   selector:
@@ -34,13 +33,6 @@ spec:
       labels:
         app: uppy-redis
     spec:
-      # affinity:
-      #   nodeAffinity:
-      #     requiredDuringSchedulingIgnoredDuringExecution:
-      #       nodeSelectorTerms:
-      #       - matchExpressions:
-      #         - key: cloud.google.com/gke-preemptible
-      #           operator: DoesNotExist
       containers:
       - env:
         - name: REDIS_PASSWORD
@@ -101,7 +93,7 @@ metadata:
   labels:
     app: uppy-redis
   name: uppy-redis
-  namespace: uppy
+  namespace: companion
 spec:
   ports:
   - name: redis
@@ -111,5 +103,4 @@ spec:
   selector:
     app: uppy-redis
   sessionAffinity: None
-  type: ClusterIP
-
+  type: ClusterIP

+ 5 - 5
packages/@uppy/companion/infra/kube/gcloud-deploy.sh

@@ -32,18 +32,18 @@ docker push transloadit/companion:latest;
 echo "Create directory..."
 mkdir ${HOME}/.kube
 echo "Writing KUBECONFIG to file..."
-echo $KUBECONFIGVAR | base64 --decode -i > ${HOME}/.kube/config
+echo $KUBECONFIGVAR | python -m base64 -d > ${HOME}/.kube/config
 echo "KUBECONFIG file written"
 
 sleep 10s # This cost me some precious debugging time.
 kubectl apply -f "${__kube}/companion/companion-kube.yaml"
 kubectl apply -f "${__kube}/companion/companion-redis.yaml"
-kubectl set image statefulset companion --namespace=uppy companion=docker.io/transloadit/companion:$TRAVIS_COMMIT
+kubectl set image statefulset companion --namespace=companion companion=docker.io/transloadit/companion:$TRAVIS_COMMIT
 sleep 10s
 
-kubectl get pods --namespace=uppy
-kubectl get service --namespace=uppy
-kubectl get deployment --namespace=uppy
+kubectl get pods --namespace=companion
+kubectl get service --namespace=companion
+kubectl get deployment --namespace=companion
 
 function cleanup {
     printf "Cleaning up...\n"