Bumping k8s dependencies to 1.13

This commit is contained in:
Cheng Xing
2018-11-16 14:08:25 -08:00
parent 305407125c
commit b4c0b68ec7
8002 changed files with 884099 additions and 276228 deletions

View File

@@ -135,7 +135,8 @@ RUN go install cloud.google.com/go/compute/metadata \
# golang sets GOPATH=/go
ADD . /go/src/tip
RUN go install --tags=autocert tip
WORKDIR /go/src/tip
RUN go install --tags=autocert
ENTRYPOINT ["/go/bin/tip"]
# We listen on 8080 (for historical reasons). The service.yaml maps public port 80 to 8080.

View File

@@ -2,7 +2,11 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
VERSION=v2
VERSION ?= $(shell git rev-parse --short HEAD)
MUTABLE_VERSION ?= latest
IMAGE_STAGING := gcr.io/go-dashboard-dev/tip
IMAGE_PROD := gcr.io/symbolic-datum-552/tip
.PHONY: usage
@@ -14,12 +18,23 @@ update-deps:
go install golang.org/x/build/cmd/gitlock
gitlock --update=Dockerfile --ignore=NONE --tags=autocert golang.org/x/tools/cmd/tip
docker-prod: Dockerfile
docker build -f Dockerfile --tag=gcr.io/symbolic-datum-552/tip:$(VERSION) .
docker-dev: Dockerfile
docker build -f Dockerfile --tag=gcr.io/go-dashboard-dev/tip:$(VERSION) .
docker-image: Dockerfile *.go
docker build --force-rm -f Dockerfile --tag=$(IMAGE_PROD):$(VERSION) .
docker tag $(IMAGE_PROD):$(VERSION) $(IMAGE_PROD):$(MUTABLE_VERSION)
docker tag $(IMAGE_PROD):$(VERSION) $(IMAGE_STAGING):$(VERSION)
docker tag $(IMAGE_PROD):$(VERSION) $(IMAGE_STAGING):$(MUTABLE_VERSION)
push-prod: docker-image
docker push $(IMAGE_PROD):$(MUTABLE_VERSION)
docker push $(IMAGE_PROD):$(VERSION)
push-staging: docker-image
docker push $(IMAGE_STAGING):$(MUTABLE_VERSION)
docker push $(IMAGE_STAGING):$(VERSION)
deploy-prod: push-prod
go install golang.org/x/build/cmd/xb
xb --prod kubectl set image deployment/tip-deployment tip=$(IMAGE_PROD):$(VERSION)
deploy-staging: push-staging
go install golang.org/x/build/cmd/xb
xb --staging kubectl set image deployment/tip-deployment tip=$(IMAGE_STAGING):$(VERSION)
push-prod: docker-prod
gcloud docker -- push gcr.io/symbolic-datum-552/tip:$(VERSION)
push-dev: docker-dev
gcloud docker -- push gcr.io/go-dashboard-dev/tip:$(VERSION)

View File

@@ -17,6 +17,7 @@ import (
"crypto/tls"
"log"
"net/http"
"strings"
"cloud.google.com/go/storage"
"golang.org/x/build/autocertcache"
@@ -42,7 +43,7 @@ func certInitAutocert() {
}
autocertManager = &autocert.Manager{
Prompt: autocert.AcceptTOS,
HostPolicy: autocert.HostWhitelist(*autoCertDomain),
HostPolicy: autocert.HostWhitelist(strings.Split(*autoCertDomain, ",")...),
Cache: cache,
}
}

View File

@@ -48,7 +48,7 @@ func (b godocBuilder) Init(dir, hostport string, heads map[string]string) (*exec
}
godocBin := filepath.Join(goPath, "bin/godoc")
godoc := exec.Command(godocBin, "-http="+hostport, "-index", "-index_interval=-1s")
godoc := exec.Command(godocBin, "-http="+hostport, "-index", "-index_interval=-1s", "-play")
godoc.Env = []string{"GOROOT=" + goDir}
// TODO(adg): log this somewhere useful
godoc.Stdout = os.Stdout

View File

@@ -1,11 +1,9 @@
apiVersion: v1
kind: ReplicationController
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: tipgodoc
name: tipgodoc-deployment
spec:
replicas: 1
selector:
app: tipgodoc
template:
metadata:
name: tipgodoc
@@ -16,10 +14,10 @@ spec:
- name: cache-volume
emptyDir: {}
containers:
- name: gitmirror
image: gcr.io/symbolic-datum-552/tip:v2
- name: tipgodoc
image: gcr.io/symbolic-datum-552/tip:latest
imagePullPolicy: Always
command: ["/go/bin/tip", "--autocert=tip.golang.org", "--autocert-bucket=golang-tip-autocert"]
command: ["/go/bin/tip", "--autocert=tip.golang.org,beta.golang.org", "--autocert-bucket=golang-tip-autocert"]
env:
- name: TMPDIR
value: /build

View File

@@ -34,7 +34,7 @@ const (
var startTime = time.Now()
var (
autoCertDomain = flag.String("autocert", "", "if non-empty, listen on port 443 and serve a LetsEncrypt cert for this hostname")
autoCertDomain = flag.String("autocert", "", "if non-empty, listen on port 443 and serve a LetsEncrypt cert for this hostname or hostnames (comma-separated)")
autoCertCacheBucket = flag.String("autocert-bucket", "", "if non-empty, the Google Cloud Storage bucket in which to store the LetsEncrypt cache")
)
@@ -120,6 +120,18 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
p.serveStatus(w, r)
return
}
// Redirect the old beta.golang.org URL to tip.golang.org,
// just in case there are old links out there to
// beta.golang.org. (We used to run a "temporary" beta.golang.org
// GCE VM running godoc where "temporary" lasted two years.
// So it lasted so long, there are probably links to it out there.)
if r.Host == "beta.golang.org" {
u := *r.URL
u.Scheme = "https"
u.Host = "tip.golang.org"
http.Redirect(w, r, u.String(), http.StatusFound)
return
}
p.mu.Lock()
proxy := p.proxy
err := p.err