Skip to content

Commit d4579c2

Browse files
committed
cmd/gerritbot: move to Workload Identity
Create a new service account, and move the deployment over to the prod namespace. Also fix AutoCert configuration so we can serve our happy little home page. Fixes golang/go#37377. For golang/go#48263. Change-Id: I9d0a5e49db53c0224379f448b49c9b679d59d23b Reviewed-on: https://go-review.googlesource.com/c/build/+/348433 Trust: Heschi Kreinick <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent f127363 commit d4579c2

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

cmd/gerritbot/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ docker-staging: Dockerfile
1717

1818
push-prod: docker-prod
1919
docker push $(IMAGE_PROD):$(VERSION)
20+
docker push $(IMAGE_PROD):$(MUTABLE_VERSION)
2021
push-staging: docker-staging
2122
docker push $(IMAGE_STAGING):$(VERSION)
23+
docker push $(IMAGE_STAGING):$(MUTABLE_VERSION)
2224

2325
deploy-prod: push-prod
2426
go install golang.org/x/build/cmd/xb
25-
xb --prod kubectl set image deployment/gerritbot-deployment gerritbot=$(IMAGE_PROD):$(VERSION)
27+
xb --prod kubectl --namespace prod set image deployment/gerritbot-deployment gerritbot=$(IMAGE_PROD):$(VERSION)
2628
deploy-staging: push-staging
2729
go install golang.org/x/build/cmd/xb
2830
xb --staging kubectl set image deployment/gerritbot-deployment gerritbot=$(IMAGE_STAGING):$(VERSION)

cmd/gerritbot/deployment-prod.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4+
namespace: prod
45
name: gerritbot-deployment
56
spec:
67
replicas: 1
@@ -15,6 +16,9 @@ spec:
1516
container.seccomp.security.alpha.kubernetes.io/gerritbot: docker/default
1617
container.apparmor.security.beta.kubernetes.io/gerritbot: runtime/default
1718
spec:
19+
serviceAccountName: gerritbot
20+
nodeSelector:
21+
cloud.google.com/gke-nodepool: workload-identity-pool
1822
containers:
1923
- name: gerritbot
2024
image: gcr.io/symbolic-datum-552/gerritbot:latest

cmd/gerritbot/service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4+
namespace: prod
45
name: gerritbot
56
spec:
67
ports:

devapp/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ docker-staging: Dockerfile
1717

1818
push-prod: docker-prod
1919
docker push $(IMAGE_PROD):$(VERSION)
20+
docker push $(IMAGE_PROD):$(MUTABLE_VERSION)
2021
push-staging: docker-staging
2122
docker push $(IMAGE_STAGING):$(VERSION)
23+
docker push $(IMAGE_STAGING):$(MUTABLE_VERSION)
2224

2325
deploy-prod: push-prod
2426
go install golang.org/x/build/cmd/xb

internal/https/https.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,7 @@ func serveAutocertTLS(ctx context.Context, h http.Handler, bucket string) error
131131
},
132132
Cache: autocertcache.NewGoogleCloudStorageCache(sc, bucket),
133133
}
134-
config := &tls.Config{
135-
GetCertificate: m.GetCertificate,
136-
NextProtos: []string{"h2", "http/1.1"},
137-
}
138-
tlsLn := tls.NewListener(tcpKeepAliveListener{ln.(*net.TCPListener)}, config)
134+
tlsLn := tls.NewListener(tcpKeepAliveListener{ln.(*net.TCPListener)}, m.TLSConfig())
139135
if err := http2.ConfigureServer(server, nil); err != nil {
140136
return fmt.Errorf("http2.ConfigureServer: %v", err)
141137
}

0 commit comments

Comments
 (0)