cmd/gitmirror: split deployment

Split the gitmirror deployment into a high-availability service that
serves tarballs and a single-instance service that does git mirroring.

Plan: start the new serving deployment, update the Service, shut down
the old deployment, start the new mirroring deployment.

Change-Id: Iffbf281002e2cb2ef42f7136781c212a0f2e40d6
Reviewed-on: https://go-review.googlesource.com/c/build/+/330371
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
diff --git a/cmd/gitmirror/Makefile b/cmd/gitmirror/Makefile
index d4c33be..0a572de 100644
--- a/cmd/gitmirror/Makefile
+++ b/cmd/gitmirror/Makefile
@@ -23,7 +23,9 @@
 	docker push $(IMAGE_STAGING):$(VERSION)
 
 deploy-prod: push-prod
-	kubectl set image deployment/gitmirror-deployment gitmirror=$(IMAGE_PROD):$(VERSION)
+	kubectl set image deployment/gitmirror-serving-deployment gitmirror=$(IMAGE_PROD):$(VERSION)
+	kubectl set image deployment/gitmirror-mirroring-deployment gitmirror=$(IMAGE_PROD):$(VERSION)
+
 deploy-staging: push-staging
 	echo "no staging configuration"
 	exit 1
diff --git a/cmd/gitmirror/deployment.yaml b/cmd/gitmirror/deployment-mirroring.yaml
similarity index 85%
copy from cmd/gitmirror/deployment.yaml
copy to cmd/gitmirror/deployment-mirroring.yaml
index 238e389..192e8da 100644
--- a/cmd/gitmirror/deployment.yaml
+++ b/cmd/gitmirror/deployment-mirroring.yaml
@@ -1,21 +1,18 @@
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  name: gitmirror-deployment
+  name: gitmirror-mirroring-deployment
   labels:
-    app: gitmirror
+    app: gitmirror-mirroring
 spec:
-  strategy:
-    rollingUpdate:
-      maxUnavailable: 1
-  replicas: 2
+  replicas: 1
   selector:
     matchLabels:
-      app: gitmirror
+      app: gitmirror-mirroring
   template:
     metadata:
       labels:
-        app: gitmirror
+        app: gitmirror-mirroring
     spec:
       volumes:
       - name: cache-volume
diff --git a/cmd/gitmirror/deployment.yaml b/cmd/gitmirror/deployment-serving.yaml
similarity index 86%
rename from cmd/gitmirror/deployment.yaml
rename to cmd/gitmirror/deployment-serving.yaml
index 238e389..0fe6512 100644
--- a/cmd/gitmirror/deployment.yaml
+++ b/cmd/gitmirror/deployment-serving.yaml
@@ -1,9 +1,9 @@
 apiVersion: apps/v1
 kind: Deployment
 metadata:
-  name: gitmirror-deployment
+  name: gitmirror-serving-deployment
   labels:
-    app: gitmirror
+    app: gitmirror-serving
 spec:
   strategy:
     rollingUpdate:
@@ -11,11 +11,11 @@
   replicas: 2
   selector:
     matchLabels:
-      app: gitmirror
+      app: gitmirror-serving
   template:
     metadata:
       labels:
-        app: gitmirror
+        app: gitmirror-serving
     spec:
       volumes:
       - name: cache-volume
@@ -28,7 +28,7 @@
         env:
         - name: XDG_CACHE_HOME
           value: "/cache"
-        command: ["/usr/bin/tini", "--", "/gitmirror", "-http=:8585", "-mirror=true", "-cachedir=/cache/gitmirror"]
+        command: ["/usr/bin/tini", "--", "/gitmirror", "-http=:8585", "-cachedir=/cache/gitmirror"]
         volumeMounts:
         - mountPath: /cache
           name: cache-volume
diff --git a/cmd/gitmirror/service.yaml b/cmd/gitmirror/service.yaml
index 3ce19a5..dce13f4 100644
--- a/cmd/gitmirror/service.yaml
+++ b/cmd/gitmirror/service.yaml
@@ -7,4 +7,4 @@
     - port: 8585
       targetPort: 8585
   selector:
-    app: gitmirror
+    app: gitmirror-serving