diff --git a/infra/kube/companion/companion-kube.yaml b/infra/kube/companion/companion-kube.yaml index f8f8b24956..dc3bd61cbb 100644 --- a/infra/kube/companion/companion-kube.yaml +++ b/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 diff --git a/infra/kube/companion/companion-redis.yaml b/infra/kube/companion/companion-redis.yaml index 261140c771..e1b3a5244c 100644 --- a/infra/kube/companion/companion-redis.yaml +++ b/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 \ No newline at end of file diff --git a/infra/kube/gcloud-deploy.sh b/infra/kube/gcloud-deploy.sh index 323c2d6d7f..fd857c2c8a 100755 --- a/infra/kube/gcloud-deploy.sh +++ b/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"