From 12d171f319997e9b254989014595b4ed6d47b60d Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Sat, 4 Apr 2020 13:38:27 -0700 Subject: [PATCH 01/15] delete Jaeger operator --- configure/jaeger/README.md | 207 ----------------------------------- configure/jaeger/jaeger.yaml | 24 ---- 2 files changed, 231 deletions(-) delete mode 100644 configure/jaeger/README.md delete mode 100644 configure/jaeger/jaeger.yaml diff --git a/configure/jaeger/README.md b/configure/jaeger/README.md deleted file mode 100644 index c3d318a5e27f..000000000000 --- a/configure/jaeger/README.md +++ /dev/null @@ -1,207 +0,0 @@ -# Jaeger - -[Jaeger](https://github.com/jaegertracing/jaeger) is an open-source request tracing system that can -run inside of your Kubernetes cluster. Sourcegraph can connect to Jaeger to provide real-time -request traces that are useful for diagnosing performance issues and prescribing the appropriate -remedy (typically scaling up one of the services). If you are experiencing performance issues with -Sourcegraph, anticipate a high volume of traffic, or have a large amount of code, we recommend -connecting Sourcegraph to a Jaeger instance. - -There are two options for connecting Sourcegraph to Jaeger: - -* [Deploy-a-new-Jaeger-instance-inside-the-Sourcegraph-cluster](#Deploying-a-new-Jaeger-instance-alongside-Sourcegraph) -* [Connect to an existing Jaeger instance](#Connecting-Sourcegraph-to-an-existing-Jaeger-instance) - -If you are unsure of what to do, we recommend deploying a new Jaeger instance inside the Sourcegraph -cluster. - -## Deploying a new Jaeger instance alongside Sourcegraph - -1. [Install the Jaeger - Operator](https://www.jaegertracing.io/docs/1.16/operator/#installing-the-operator-on-kubernetes) - in the Kubernetes cluster. - -1. Deploy Jaeger as a Custom Resource Definition object: - - ```bash - echo kubectl apply --prune -l deploy=jaeger -f configure/jaeger --recursive >> kubectl-apply-all.sh - ./kubectl-apply-all.sh - ``` - - By default, we use the [AllInOne - strategy](https://www.jaegertracing.io/docs/1.16/operator/#quick-start-deploying-the-allinone-image) - with in-memory storage of traces, which suffices for most debugging scenarios in - Sourcegraph. Refer to the [Jaeger docs for customizing the Custom Resource - Definition](https://www.jaegertracing.io/docs/1.16/operator/#understanding-custom-resource-definitions). - - After following the default instructions, you should observe `kubectl get svc` returns a few - additional services (`jaeger-agent`, `jaeger-collector`, `jaeger-collector-headless`, - `jaeger-query`) and `kubectl get deploy jaeger` should yield a deployment of the Jaeger - all-in-one image. - -1. Inject the Jaeger Agent sidecar container into the relevant pods. You can use the following - scripts: - - ```bash - # This adds the annotation `sidecar.jaegertracing.io/inject: "true"` to each Deployment, - # and the Jaeger Operator takes care of the rest. - - COLLECTOR_PATCH=$(echo 'sidecar.jaegertracing.io/inject: "true"' | yj) - - COLLECTOR_DEPLOYMENTS=( - "github-proxy/github-proxy.Deployment.yaml" - "query-runner/query-runner.Deployment.yaml" - "repo-updater/repo-updater.Deployment.yaml" - "searcher/searcher.Deployment.yaml" - "replacer/replacer.Deployment.yaml" - "frontend/sourcegraph-frontend.Deployment.yaml" - "symbols/symbols.Deployment.yaml" - ) - - for FILE in "${COLLECTOR_DEPLOYMENTS[@]}"; do - F="base/$FILE" - cat $F | yj | jq ".metadata.annotations += $COLLECTOR_PATCH" | jy -o $F - done - ``` - - ```bash - # This adds the Jaeger Agent sidecar container to the gitserver StatefulSet. (The Jaeger - # Operator does not yet support auto-injecting the container using the annotation.) - - COLLECTOR_PATCH=$(yj < Date: Sat, 4 Apr 2020 13:38:46 -0700 Subject: [PATCH 02/15] non-operator jaeger --- base/jaeger/jaeger-collector.Service.yaml | 27 ++++++++++++ base/jaeger/jaeger-query.Service.yaml | 19 +++++++++ base/jaeger/jaeger.Deployment.yaml | 52 +++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 base/jaeger/jaeger-collector.Service.yaml create mode 100644 base/jaeger/jaeger-query.Service.yaml create mode 100644 base/jaeger/jaeger.Deployment.yaml diff --git a/base/jaeger/jaeger-collector.Service.yaml b/base/jaeger/jaeger-collector.Service.yaml new file mode 100644 index 000000000000..cf85d8f1d28e --- /dev/null +++ b/base/jaeger/jaeger-collector.Service.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 +kind: Service +metadata: + name: jaeger-collector + labels: + deploy: sourcegraph + app: jaeger + app.kubernetes.io/name: jaeger + app.kubernetes.io/component: collector +spec: + ports: + - name: jaeger-collector-tchannel + port: 14267 + protocol: TCP + targetPort: 14267 + - name: jaeger-collector-http + port: 14268 + protocol: TCP + targetPort: 14268 + - name: jaeger-collector-grpc + port: 14250 + protocol: TCP + targetPort: 14250 + selector: + app.kubernetes.io/name: jaeger + app.kubernetes.io/component: all-in-one + type: ClusterIP diff --git a/base/jaeger/jaeger-query.Service.yaml b/base/jaeger/jaeger-query.Service.yaml new file mode 100644 index 000000000000..237f47029323 --- /dev/null +++ b/base/jaeger/jaeger-query.Service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: jaeger-query + labels: + deploy: sourcegraph + app: jaeger + app.kubernetes.io/name: jaeger + app.kubernetes.io/component: query +spec: + ports: + - name: query-http + port: 16686 + protocol: TCP + targetPort: 16686 + selector: + app.kubernetes.io/name: jaeger + app.kubernetes.io/component: all-in-one + type: ClusterIP diff --git a/base/jaeger/jaeger.Deployment.yaml b/base/jaeger/jaeger.Deployment.yaml new file mode 100644 index 000000000000..2e324261fa14 --- /dev/null +++ b/base/jaeger/jaeger.Deployment.yaml @@ -0,0 +1,52 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: jaeger + labels: + deploy: sourcegraph + app: jaeger + app.kubernetes.io/name: jaeger + app.kubernetes.io/component: all-in-one +spec: + replicas: 1 + strategy: + type: Recreate + template: + metadata: + labels: + app: jaeger + app.kubernetes.io/name: jaeger + app.kubernetes.io/component: all-in-one + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "16686" + spec: + containers: + - image: jaegertracing/all-in-one:1.17.1 + name: jaeger + args: ["--memory.max-traces=20000"] + ports: + - containerPort: 5775 + protocol: UDP + - containerPort: 6831 + protocol: UDP + - containerPort: 6832 + protocol: UDP + - containerPort: 5778 + protocol: TCP + - containerPort: 16686 + protocol: TCP + - containerPort: 14250 + protocol: TCP + readinessProbe: + httpGet: + path: "/" + port: 14269 + initialDelaySeconds: 5 + resources: + limits: + cpu: 1 + memory: 1G + requests: + cpu: 500m + memory: 500M From ade74916c749768efe8c4e6da00c8fac3043ac95 Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Sat, 4 Apr 2020 13:38:59 -0700 Subject: [PATCH 03/15] jaeger-agent --- .../sourcegraph-frontend.Deployment.yaml | 27 +++++++++++++++++++ .../github-proxy/github-proxy.Deployment.yaml | 27 +++++++++++++++++++ base/gitserver/gitserver.StatefulSet.yaml | 27 +++++++++++++++++++ .../query-runner/query-runner.Deployment.yaml | 27 +++++++++++++++++++ base/replacer/replacer.Deployment.yaml | 27 +++++++++++++++++++ .../repo-updater/repo-updater.Deployment.yaml | 27 +++++++++++++++++++ base/searcher/searcher.Deployment.yaml | 27 +++++++++++++++++++ base/symbols/symbols.Deployment.yaml | 27 +++++++++++++++++++ 8 files changed, 216 insertions(+) diff --git a/base/frontend/sourcegraph-frontend.Deployment.yaml b/base/frontend/sourcegraph-frontend.Deployment.yaml index 0fcfaab2302a..7753b17ba196 100644 --- a/base/frontend/sourcegraph-frontend.Deployment.yaml +++ b/base/frontend/sourcegraph-frontend.Deployment.yaml @@ -88,6 +88,33 @@ spec: volumeMounts: - mountPath: /mnt/cache name: cache-ssd + - image: jaegertracing/jaeger-agent:1.17.1 + name: jaeger-agent + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + ports: + - containerPort: 5775 + protocol: UDP + - containerPort: 5778 + protocol: TCP + - containerPort: 6831 + protocol: UDP + - containerPort: 6832 + protocol: UDP + resources: + limits: + cpu: "1" + memory: 500M + requests: + cpu: 100m + memory: 100M + args: + - --reporter.grpc.host-port=jaeger-collector:14250 + - --reporter.type=grpc serviceAccountName: sourcegraph-frontend volumes: - emptyDir: {} diff --git a/base/github-proxy/github-proxy.Deployment.yaml b/base/github-proxy/github-proxy.Deployment.yaml index 8d94f122f543..a066869b27e4 100644 --- a/base/github-proxy/github-proxy.Deployment.yaml +++ b/base/github-proxy/github-proxy.Deployment.yaml @@ -38,3 +38,30 @@ spec: requests: cpu: 100m memory: 250M + - image: jaegertracing/jaeger-agent:1.17.1 + name: jaeger-agent + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + ports: + - containerPort: 5775 + protocol: UDP + - containerPort: 5778 + protocol: TCP + - containerPort: 6831 + protocol: UDP + - containerPort: 6832 + protocol: UDP + resources: + limits: + cpu: "1" + memory: 500M + requests: + cpu: 100m + memory: 100M + args: + - --reporter.grpc.host-port=jaeger-collector:14250 + - --reporter.type=grpc diff --git a/base/gitserver/gitserver.StatefulSet.yaml b/base/gitserver/gitserver.StatefulSet.yaml index de3cdf960cd6..2bac3bfc250d 100644 --- a/base/gitserver/gitserver.StatefulSet.yaml +++ b/base/gitserver/gitserver.StatefulSet.yaml @@ -52,6 +52,33 @@ spec: # about configuring gitserver to use an SSH key # - mountPath: /root/.ssh # name: ssh + - image: jaegertracing/jaeger-agent:1.17.1 + name: jaeger-agent + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + ports: + - containerPort: 5775 + protocol: UDP + - containerPort: 5778 + protocol: TCP + - containerPort: 6831 + protocol: UDP + - containerPort: 6832 + protocol: UDP + resources: + limits: + cpu: "1" + memory: 500M + requests: + cpu: 100m + memory: 100M + args: + - --reporter.grpc.host-port=jaeger-collector:14250 + - --reporter.type=grpc volumes: - name: repos # See the customization guide (../../../docs/configure.md) for information diff --git a/base/query-runner/query-runner.Deployment.yaml b/base/query-runner/query-runner.Deployment.yaml index ec87c74da6ee..924627eaf1a1 100644 --- a/base/query-runner/query-runner.Deployment.yaml +++ b/base/query-runner/query-runner.Deployment.yaml @@ -38,3 +38,30 @@ spec: requests: cpu: 500m memory: 1G + - image: jaegertracing/jaeger-agent:1.17.1 + name: jaeger-agent + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + ports: + - containerPort: 5775 + protocol: UDP + - containerPort: 5778 + protocol: TCP + - containerPort: 6831 + protocol: UDP + - containerPort: 6832 + protocol: UDP + resources: + limits: + cpu: "1" + memory: 500M + requests: + cpu: 100m + memory: 100M + args: + - --reporter.grpc.host-port=jaeger-collector:14250 + - --reporter.type=grpc diff --git a/base/replacer/replacer.Deployment.yaml b/base/replacer/replacer.Deployment.yaml index 25d450571e40..7536752e5fe0 100644 --- a/base/replacer/replacer.Deployment.yaml +++ b/base/replacer/replacer.Deployment.yaml @@ -58,6 +58,33 @@ spec: volumeMounts: - mountPath: /mnt/cache name: cache-ssd + - image: jaegertracing/jaeger-agent:1.17.1 + name: jaeger-agent + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + ports: + - containerPort: 5775 + protocol: UDP + - containerPort: 5778 + protocol: TCP + - containerPort: 6831 + protocol: UDP + - containerPort: 6832 + protocol: UDP + resources: + limits: + cpu: "1" + memory: 500M + requests: + cpu: 100m + memory: 100M + args: + - --reporter.grpc.host-port=jaeger-collector:14250 + - --reporter.type=grpc volumes: - emptyDir: {} name: cache-ssd diff --git a/base/repo-updater/repo-updater.Deployment.yaml b/base/repo-updater/repo-updater.Deployment.yaml index 319721171210..7410b37e7421 100644 --- a/base/repo-updater/repo-updater.Deployment.yaml +++ b/base/repo-updater/repo-updater.Deployment.yaml @@ -41,3 +41,30 @@ spec: requests: cpu: 100m memory: 500Mi + - image: jaegertracing/jaeger-agent:1.17.1 + name: jaeger-agent + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + ports: + - containerPort: 5775 + protocol: UDP + - containerPort: 5778 + protocol: TCP + - containerPort: 6831 + protocol: UDP + - containerPort: 6832 + protocol: UDP + resources: + limits: + cpu: "1" + memory: 500M + requests: + cpu: 100m + memory: 100M + args: + - --reporter.grpc.host-port=jaeger-collector:14250 + - --reporter.type=grpc diff --git a/base/searcher/searcher.Deployment.yaml b/base/searcher/searcher.Deployment.yaml index 980ebfd29840..d8b6b40229e3 100644 --- a/base/searcher/searcher.Deployment.yaml +++ b/base/searcher/searcher.Deployment.yaml @@ -58,6 +58,33 @@ spec: volumeMounts: - mountPath: /mnt/cache name: cache-ssd + - image: jaegertracing/jaeger-agent:1.17.1 + name: jaeger-agent + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + ports: + - containerPort: 5775 + protocol: UDP + - containerPort: 5778 + protocol: TCP + - containerPort: 6831 + protocol: UDP + - containerPort: 6832 + protocol: UDP + resources: + limits: + cpu: "1" + memory: 500M + requests: + cpu: 100m + memory: 100M + args: + - --reporter.grpc.host-port=jaeger-collector:14250 + - --reporter.type=grpc volumes: - emptyDir: {} name: cache-ssd diff --git a/base/symbols/symbols.Deployment.yaml b/base/symbols/symbols.Deployment.yaml index fc06b0bcdd89..a00d0937c641 100644 --- a/base/symbols/symbols.Deployment.yaml +++ b/base/symbols/symbols.Deployment.yaml @@ -65,6 +65,33 @@ spec: volumeMounts: - mountPath: /mnt/cache name: cache-ssd + - image: jaegertracing/jaeger-agent:1.17.1 + name: jaeger-agent + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + ports: + - containerPort: 5775 + protocol: UDP + - containerPort: 5778 + protocol: TCP + - containerPort: 6831 + protocol: UDP + - containerPort: 6832 + protocol: UDP + resources: + limits: + cpu: "1" + memory: 500M + requests: + cpu: 100m + memory: 100M + args: + - --reporter.grpc.host-port=jaeger-collector:14250 + - --reporter.type=grpc volumes: - emptyDir: {} name: cache-ssd From 42ca5462e72ab72b2676223283d6ebad8422db30 Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Sat, 4 Apr 2020 14:18:38 -0700 Subject: [PATCH 04/15] update docs --- configure/jaeger/README.md | 57 ++++++++++++++++++++++++++++++++++++++ docs/configure.md | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 configure/jaeger/README.md diff --git a/configure/jaeger/README.md b/configure/jaeger/README.md new file mode 100644 index 000000000000..221bdf1c1832 --- /dev/null +++ b/configure/jaeger/README.md @@ -0,0 +1,57 @@ +# Jaeger + +Jaeger is installed if you followed the standard installation instructions. Its resource objects are +defined in the `base/jaeger` directory. Additionally, a Jaeger agent sidecar container is present in +the `*.Deployment.yaml` and `*.StatefulSet.yaml` of certain services. + +## Connect Sourcegraph to an external Jaeger instance + +If you have an existing Jaeger instance you would like to connect Sourcegraph to (instead of running +the Jaeger instance inside the Sourcegraph cluster), do: + +1. Remove the `base/jaeger` directory: `rm -rf base/jaeger` +1. Update the Jaeger agent containers to point to your Jaeger collector. + 1. Find all instances of Jaeger agent (`grep -R 'jaegertracing/jaeger-agent'`). + 1. Update the `args` field of the Jaeger agent container configuration to point to the external + collector. E.g., + ``` + args: + - --reporter.grpc.host-port=external-jaeger-collector-host:14250 + - --reporter.type=grpc + ``` +1. Apply these changes to the cluster. + +## Disable Jaeger entirely + +To disable Jaeger entirely, do: + +1. Update the Sourcegraph [site + configuration](https://docs.sourcegraph.com/admin/config/site_config) to remove the + `observability.tracing` field. +1. Remove the `base/jaeger` directory: `rm -rf base/jaeger` +1. Remove the jaeger agent containers from each `*.Deployment.yaml` and `*.StatefulSet.ayml` file. +1. Apply these changes to the cluster. + +## Upgrading from 3.14 and earlier to 3.15 or later + +The Kubernetes distribution of Sourcegraph 3.15 changed the standard way that Jaeger is deployed +inside the Sourcegraph cluster. + +If you were previously using the [Jaeger +Operator](https://github.com/jaegertracing/jaeger-operator), do: + +1. Delete the Jaeger instance: `kubectl delete jaeger jaeger`. +1. [Delete the Jaeger Operator](https://www.jaegertracing.io/docs/1.16/operator/#uninstalling-the-operator) +1. Merge the new version of this repository into your fork and apply the update. The new Jaeger + components should be created automatically. + +If you were previously connecting to an external Jaeger instance, do: + +1. Merge the new version of this repository into your fork. Resolve any conflicts in files that + contain configuration for the Jaeger agent to ensure the agent still points to the external + Jaeger collector. +1. Remove the `base/jaeger` directory: `rm -rf base/jaeger` +1. Apply these changes to the cluster. + +If you were previously not using Jaeger and would like to continue not using Jaeger, follow the +directions above to disable Jaeger entirely. diff --git a/docs/configure.md b/docs/configure.md index f463121d3221..49eeef6ae508 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -54,7 +54,7 @@ Configuration steps in this file depend on [jq](https://stedolan.github.io/jq/), - [Configure indexed-search replica count](#configure-indexed-search-replica-count) - [Assign resource-hungry pods to larger nodes](#assign-resource-hungry-pods-to-larger-nodes) - [Configure Alertmanager](../configure/prometheus/alertmanager/README.md) -- [Configure Jaeger tracing](../configure/jaeger/README.md) +- [Disable or customize Jaeger tracing](../configure/jaeger/README.md) - [Configure Lightstep tracing](#configure-lightstep-tracing) - [Configure custom Redis](#configure-custom-redis) - [Configure custom PostgreSQL](#configure-custom-postgres) From da9f693a672b78c979c497b0ef20135c34255d7a Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Sat, 4 Apr 2020 16:12:24 -0700 Subject: [PATCH 05/15] jaeger-all-in-one Dockerfile --- dockerfiles/jaeger/all-in-one/Dockerfile | 43 +++++++++++++++++++ .../jaeger/all-in-one/build-and-upload.sh | 10 +++++ 2 files changed, 53 insertions(+) create mode 100644 dockerfiles/jaeger/all-in-one/Dockerfile create mode 100755 dockerfiles/jaeger/all-in-one/build-and-upload.sh diff --git a/dockerfiles/jaeger/all-in-one/Dockerfile b/dockerfiles/jaeger/all-in-one/Dockerfile new file mode 100644 index 000000000000..3f9a3f43f5d5 --- /dev/null +++ b/dockerfiles/jaeger/all-in-one/Dockerfile @@ -0,0 +1,43 @@ +# This Dockerfile tracks jaegertracing/all-in-one, but includes more debugging tools and runs as a +# non-root user. It requires JAEGER_VERSION to be set as an argument to build. +ARG JAEGER_VERSION +FROM jaegertracing/all-in-one:$JAEGER_VERSION as base + +FROM alpine:3.11.5 + +RUN apk update +RUN apk add bash curl + +COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=base /go/bin/all-in-one-linux /go/bin/all-in-one-linux +COPY --from=base /etc/jaeger/sampling_strategies.json /etc/jaeger/sampling_strategies.json + +RUN adduser -S -u 10001 jaeger +RUN chown jaeger /go/bin/all-in-one-linux +RUN chown jaeger /etc/jaeger/sampling_strategies.json +USER jaeger + +# Agent zipkin.thrift compact +EXPOSE 5775/udp + +# Agent jaeger.thrift compact +EXPOSE 6831/udp + +# Agent jaeger.thrift binary +EXPOSE 6832/udp + +# Agent config HTTP +EXPOSE 5778 + +# Collector HTTP +EXPOSE 14268 + +# Collector gRPC +EXPOSE 14250 + +# Web HTTP +EXPOSE 16686 + +VOLUME ["/tmp"] +ENTRYPOINT ["/go/bin/all-in-one-linux"] +CMD ["--sampling.strategies-file=/etc/jaeger/sampling_strategies.json"] diff --git a/dockerfiles/jaeger/all-in-one/build-and-upload.sh b/dockerfiles/jaeger/all-in-one/build-and-upload.sh new file mode 100755 index 000000000000..74ebcaff733e --- /dev/null +++ b/dockerfiles/jaeger/all-in-one/build-and-upload.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -euo pipefail + +VERSION="${VERSION:-1.17.1}" + +echo "Building image for Jaeger $VERSION" + +docker build --build-arg JAEGER_VERSION="$VERSION" . -t "sourcegraph/jaeger-all-in-one:$VERSION" +docker push "sourcegraph/jaeger-all-in-one:$VERSION" From b382461414b532e6b0940e156b1360f6a2ab553f Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Sat, 4 Apr 2020 16:18:44 -0700 Subject: [PATCH 06/15] jaeger-agent Dockerfile --- dockerfiles/jaeger/agent/Dockerfile | 18 ++++++++++++++++++ dockerfiles/jaeger/agent/build-and-upload.sh | 10 ++++++++++ dockerfiles/jaeger/all-in-one/Dockerfile | 1 - 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 dockerfiles/jaeger/agent/Dockerfile create mode 100755 dockerfiles/jaeger/agent/build-and-upload.sh diff --git a/dockerfiles/jaeger/agent/Dockerfile b/dockerfiles/jaeger/agent/Dockerfile new file mode 100644 index 000000000000..13e18721c0ad --- /dev/null +++ b/dockerfiles/jaeger/agent/Dockerfile @@ -0,0 +1,18 @@ +# This Dockerfile tracks jaegertracing/jaeger-agent, but includes more debugging tools and runs as a +# non-root user. It requires JAEGER_VERSION to be set as an argument to build. +ARG JAEGER_VERSION +FROM jaegertracing/jaeger-agent:$JAEGER_VERSION as base + +FROM alpine:3.11.5 +RUN apk update +RUN apk add bash curl + +COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=base /go/bin/agent-linux /go/bin/agent-linux + +RUN adduser -S -u 10001 jaeger +RUN chown jaeger /go/bin/agent-linux +USER jaeger + +EXPOSE 5775/udp 6831/udp 6832/udp 5778 +ENTRYPOINT ["/go/bin/agent-linux"] diff --git a/dockerfiles/jaeger/agent/build-and-upload.sh b/dockerfiles/jaeger/agent/build-and-upload.sh new file mode 100755 index 000000000000..8fab60f33750 --- /dev/null +++ b/dockerfiles/jaeger/agent/build-and-upload.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -euo pipefail + +VERSION="${VERSION:-1.17.1}" + +echo "Building image for Jaeger $VERSION" + +docker build --build-arg JAEGER_VERSION="$VERSION" . -t "sourcegraph/jaeger-agent:$VERSION" +docker push "sourcegraph/jaeger-agent:$VERSION" diff --git a/dockerfiles/jaeger/all-in-one/Dockerfile b/dockerfiles/jaeger/all-in-one/Dockerfile index 3f9a3f43f5d5..b4ea67177b60 100644 --- a/dockerfiles/jaeger/all-in-one/Dockerfile +++ b/dockerfiles/jaeger/all-in-one/Dockerfile @@ -4,7 +4,6 @@ ARG JAEGER_VERSION FROM jaegertracing/all-in-one:$JAEGER_VERSION as base FROM alpine:3.11.5 - RUN apk update RUN apk add bash curl From d30887613a895f89ea8efa9a5fcdd30c219600f5 Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Sat, 4 Apr 2020 16:24:25 -0700 Subject: [PATCH 07/15] use sourcegraph-built Jaeger images --- base/frontend/sourcegraph-frontend.Deployment.yaml | 2 +- base/github-proxy/github-proxy.Deployment.yaml | 2 +- base/gitserver/gitserver.StatefulSet.yaml | 2 +- base/jaeger/jaeger.Deployment.yaml | 2 +- base/query-runner/query-runner.Deployment.yaml | 2 +- base/replacer/replacer.Deployment.yaml | 2 +- base/repo-updater/repo-updater.Deployment.yaml | 2 +- base/searcher/searcher.Deployment.yaml | 2 +- base/symbols/symbols.Deployment.yaml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/base/frontend/sourcegraph-frontend.Deployment.yaml b/base/frontend/sourcegraph-frontend.Deployment.yaml index 7753b17ba196..340fa49e9738 100644 --- a/base/frontend/sourcegraph-frontend.Deployment.yaml +++ b/base/frontend/sourcegraph-frontend.Deployment.yaml @@ -88,7 +88,7 @@ spec: volumeMounts: - mountPath: /mnt/cache name: cache-ssd - - image: jaegertracing/jaeger-agent:1.17.1 + - image: sourcegraph/jaeger-agent:1.17.1 name: jaeger-agent env: - name: POD_NAME diff --git a/base/github-proxy/github-proxy.Deployment.yaml b/base/github-proxy/github-proxy.Deployment.yaml index a066869b27e4..3d830ed74a68 100644 --- a/base/github-proxy/github-proxy.Deployment.yaml +++ b/base/github-proxy/github-proxy.Deployment.yaml @@ -38,7 +38,7 @@ spec: requests: cpu: 100m memory: 250M - - image: jaegertracing/jaeger-agent:1.17.1 + - image: sourcegraph/jaeger-agent:1.17.1 name: jaeger-agent env: - name: POD_NAME diff --git a/base/gitserver/gitserver.StatefulSet.yaml b/base/gitserver/gitserver.StatefulSet.yaml index 2bac3bfc250d..bdbd06f43062 100644 --- a/base/gitserver/gitserver.StatefulSet.yaml +++ b/base/gitserver/gitserver.StatefulSet.yaml @@ -52,7 +52,7 @@ spec: # about configuring gitserver to use an SSH key # - mountPath: /root/.ssh # name: ssh - - image: jaegertracing/jaeger-agent:1.17.1 + - image: sourcegraph/jaeger-agent:1.17.1 name: jaeger-agent env: - name: POD_NAME diff --git a/base/jaeger/jaeger.Deployment.yaml b/base/jaeger/jaeger.Deployment.yaml index 2e324261fa14..412982b95b41 100644 --- a/base/jaeger/jaeger.Deployment.yaml +++ b/base/jaeger/jaeger.Deployment.yaml @@ -22,7 +22,7 @@ spec: prometheus.io/port: "16686" spec: containers: - - image: jaegertracing/all-in-one:1.17.1 + - image: sourcegraph/jaeger-all-in-one:1.17.1 name: jaeger args: ["--memory.max-traces=20000"] ports: diff --git a/base/query-runner/query-runner.Deployment.yaml b/base/query-runner/query-runner.Deployment.yaml index 924627eaf1a1..fe1d6c23dc55 100644 --- a/base/query-runner/query-runner.Deployment.yaml +++ b/base/query-runner/query-runner.Deployment.yaml @@ -38,7 +38,7 @@ spec: requests: cpu: 500m memory: 1G - - image: jaegertracing/jaeger-agent:1.17.1 + - image: sourcegraph/jaeger-agent:1.17.1 name: jaeger-agent env: - name: POD_NAME diff --git a/base/replacer/replacer.Deployment.yaml b/base/replacer/replacer.Deployment.yaml index 7536752e5fe0..5f51361055ae 100644 --- a/base/replacer/replacer.Deployment.yaml +++ b/base/replacer/replacer.Deployment.yaml @@ -58,7 +58,7 @@ spec: volumeMounts: - mountPath: /mnt/cache name: cache-ssd - - image: jaegertracing/jaeger-agent:1.17.1 + - image: sourcegraph/jaeger-agent:1.17.1 name: jaeger-agent env: - name: POD_NAME diff --git a/base/repo-updater/repo-updater.Deployment.yaml b/base/repo-updater/repo-updater.Deployment.yaml index 7410b37e7421..ddcb33788394 100644 --- a/base/repo-updater/repo-updater.Deployment.yaml +++ b/base/repo-updater/repo-updater.Deployment.yaml @@ -41,7 +41,7 @@ spec: requests: cpu: 100m memory: 500Mi - - image: jaegertracing/jaeger-agent:1.17.1 + - image: sourcegraph/jaeger-agent:1.17.1 name: jaeger-agent env: - name: POD_NAME diff --git a/base/searcher/searcher.Deployment.yaml b/base/searcher/searcher.Deployment.yaml index d8b6b40229e3..c45919a7905d 100644 --- a/base/searcher/searcher.Deployment.yaml +++ b/base/searcher/searcher.Deployment.yaml @@ -58,7 +58,7 @@ spec: volumeMounts: - mountPath: /mnt/cache name: cache-ssd - - image: jaegertracing/jaeger-agent:1.17.1 + - image: sourcegraph/jaeger-agent:1.17.1 name: jaeger-agent env: - name: POD_NAME diff --git a/base/symbols/symbols.Deployment.yaml b/base/symbols/symbols.Deployment.yaml index a00d0937c641..7fcdb91e02ae 100644 --- a/base/symbols/symbols.Deployment.yaml +++ b/base/symbols/symbols.Deployment.yaml @@ -65,7 +65,7 @@ spec: volumeMounts: - mountPath: /mnt/cache name: cache-ssd - - image: jaegertracing/jaeger-agent:1.17.1 + - image: sourcegraph/jaeger-agent:1.17.1 name: jaeger-agent env: - name: POD_NAME From adb8f754ece043fa984d61732e626c4d3f2f99d7 Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Sat, 4 Apr 2020 18:24:47 -0700 Subject: [PATCH 08/15] fix build --- .buildkite/integration-restricted-test.sh | 4 ++-- .buildkite/integration-test.sh | 2 +- tests/integration/restricted/test.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.buildkite/integration-restricted-test.sh b/.buildkite/integration-restricted-test.sh index 2a86aed07a10..7c76940bfd6a 100644 --- a/.buildkite/integration-restricted-test.sh +++ b/.buildkite/integration-restricted-test.sh @@ -8,9 +8,9 @@ export DEPLOY_SOURCEGRAPH_ROOT=$(pwd) export TEST_GCP_PROJECT=sourcegraph-server export TEST_GCP_ZONE=us-central1-a export TEST_GCP_USERNAME=buildkite@sourcegraph-dev.iam.gserviceaccount.com -export BUILD_CREATOR=${BUILDKITE_BUILD_CREATOR_EMAIL//[@.]/-} +export BUILD_CREATOR="$(echo $BUILDKITE_BUILD_CREATOR | tr ' @./' '_' | tr 'A-Z' 'a-z')" export BUILD_UUID=$BUILDKITE_BUILD_ID -export BUILD_BRANCH=${BUILDKITE_BRANCH//./-} +export BUILD_BRANCH="$(echo $BUILDKITE_BRANCH | tr ' @./' '_' | tr 'A-Z' 'a-z')" ${DEPLOY_SOURCEGRAPH_ROOT}/tests/integration/restricted/test.sh diff --git a/.buildkite/integration-test.sh b/.buildkite/integration-test.sh index 1774c7b88578..d32ef8ad07d5 100755 --- a/.buildkite/integration-test.sh +++ b/.buildkite/integration-test.sh @@ -8,7 +8,7 @@ export DEPLOY_SOURCEGRAPH_ROOT=$(pwd) export TEST_GCP_PROJECT=sourcegraph-server export TEST_GCP_ZONE=us-central1-a export TEST_GCP_USERNAME=buildkite@sourcegraph-dev.iam.gserviceaccount.com -export BUILD_CREATOR=$BUILDKITE_BUILD_CREATOR +export BUILD_CREATOR="$(echo $BUILDKITE_BUILD_CREATOR | tr ' /@.' '_' | tr 'A-Z' 'a-z')" export GENERATED_BASE=`mktemp -d` diff --git a/tests/integration/restricted/test.sh b/tests/integration/restricted/test.sh index fec76dee51a4..722711ddeb17 100755 --- a/tests/integration/restricted/test.sh +++ b/tests/integration/restricted/test.sh @@ -10,7 +10,7 @@ cd $(dirname "${BASH_SOURCE[0]}") # set up the cluster, set up the fake user and restricted policy and then deploy the non-privileged overlay as that user -gcloud container clusters create ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --num-nodes 3 --machine-type n1-standard-16 --disk-type pd-ssd --project ${TEST_GCP_PROJECT} --labels=cost-category=build,build-creator=${BUILD_CREATOR},build-branch=${BUILD_BRANCH},integration-test=fresh +gcloud container clusters create ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --num-nodes 3 --machine-type n1-standard-16 --disk-type pd-ssd --project ${TEST_GCP_PROJECT} --labels="cost-category=build,build-creator=${BUILD_CREATOR},build-branch=${BUILD_BRANCH},integration-test=fresh" gcloud container clusters get-credentials ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --project ${TEST_GCP_PROJECT} From 7d3b4fd664ef6c0399ddf8e7aea865d09ab97d56 Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Mon, 6 Apr 2020 21:45:47 -0700 Subject: [PATCH 09/15] Update dockerfiles/jaeger/agent/Dockerfile Co-Authored-By: Keegan Carruthers-Smith --- dockerfiles/jaeger/agent/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dockerfiles/jaeger/agent/Dockerfile b/dockerfiles/jaeger/agent/Dockerfile index 13e18721c0ad..a00398ae76a5 100644 --- a/dockerfiles/jaeger/agent/Dockerfile +++ b/dockerfiles/jaeger/agent/Dockerfile @@ -4,8 +4,7 @@ ARG JAEGER_VERSION FROM jaegertracing/jaeger-agent:$JAEGER_VERSION as base FROM alpine:3.11.5 -RUN apk update -RUN apk add bash curl +RUN apk --no-cache bash curl COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=base /go/bin/agent-linux /go/bin/agent-linux From c02576d71487078cc340a1ee0b18b8cab8dc7103 Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Tue, 7 Apr 2020 14:22:22 -0700 Subject: [PATCH 10/15] kubectl expose select port don't want to expose the jaeger ports and can't mix UDP and TCP in one service --- README.dev.md | 2 +- overlays/minikube/README.md | 2 +- tests/integration/restricted/test.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.dev.md b/README.dev.md index 6fd666403b02..2302c9b3715b 100644 --- a/README.dev.md +++ b/README.dev.md @@ -95,7 +95,7 @@ minikube start kubectl create ns src kubens src ./kubectl-apply-all.sh -kubectl expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph +kubectl expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph --port=3080 --target-port=3080 minikube service list ``` diff --git a/overlays/minikube/README.md b/overlays/minikube/README.md index 26511abbb643..bcb8b2f7df14 100644 --- a/overlays/minikube/README.md +++ b/overlays/minikube/README.md @@ -7,7 +7,7 @@ minikube start cd overlays/minikube kubectl create namespace ns-sourcegraph kubectl -n ns-sourcegraph apply -l deploy=sourcegraph -k . -kubectl -n ns-sourcegraph expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph +kubectl -n ns-sourcegraph expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph --port=3080 --target-port=3080 minikube service list ``` diff --git a/tests/integration/restricted/test.sh b/tests/integration/restricted/test.sh index 722711ddeb17..88e91a336900 100755 --- a/tests/integration/restricted/test.sh +++ b/tests/integration/restricted/test.sh @@ -32,7 +32,7 @@ kubectl create rolebinding -n ns-sourcegraph fake-user:nonroot:unprivileged --ro kubectl --as=system:serviceaccount:ns-sourcegraph:fake-user -n ns-sourcegraph apply -k ${DEPLOY_SOURCEGRAPH_ROOT}/overlays/non-privileged-create-cluster -kubectl -n ns-sourcegraph expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph --type=LoadBalancer +kubectl -n ns-sourcegraph expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph --type=LoadBalancer --port=3080 --target-port=3080 # wait for it all to finish (we list out the ones with persistent volume claim because they take longer) From 96c4cce66cb8499d1cb2ff8658827b5fe8c6ce3b Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Tue, 7 Apr 2020 16:53:14 -0700 Subject: [PATCH 11/15] fix test --- tests/integration/restricted/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/restricted/test.sh b/tests/integration/restricted/test.sh index 88e91a336900..a7862b8426a8 100755 --- a/tests/integration/restricted/test.sh +++ b/tests/integration/restricted/test.sh @@ -48,7 +48,7 @@ kubectl -n ns-sourcegraph rollout status -w deployment/sourcegraph-frontend SOURCEGRAPH_IP=`kubectl -n ns-sourcegraph describe service sourcegraph | grep "LoadBalancer Ingress:" | cut -d ":" -f 2 | tr -d " "` -curl -m 60 http://${SOURCEGRAPH_IP}:3080 +curl --retry 10 --retry-delay 60 -m 60 http://${SOURCEGRAPH_IP}:3080 # delete cluster From 6b44be11b990e60e56135f9e0d7a585642b294ea Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Tue, 7 Apr 2020 21:32:22 -0700 Subject: [PATCH 12/15] do not require ingress in restricted integration test --- .buildkite/integration-restricted-test.sh | 3 +-- tests/integration/restricted/test.sh | 26 ++++++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) mode change 100644 => 100755 .buildkite/integration-restricted-test.sh diff --git a/.buildkite/integration-restricted-test.sh b/.buildkite/integration-restricted-test.sh old mode 100644 new mode 100755 index 7c76940bfd6a..4afe3c5e89b7 --- a/.buildkite/integration-restricted-test.sh +++ b/.buildkite/integration-restricted-test.sh @@ -4,7 +4,6 @@ set -ex cd $(dirname "${BASH_SOURCE[0]}")/.. -export DEPLOY_SOURCEGRAPH_ROOT=$(pwd) export TEST_GCP_PROJECT=sourcegraph-server export TEST_GCP_ZONE=us-central1-a export TEST_GCP_USERNAME=buildkite@sourcegraph-dev.iam.gserviceaccount.com @@ -12,5 +11,5 @@ export BUILD_CREATOR="$(echo $BUILDKITE_BUILD_CREATOR | tr ' @./' '_' | tr 'A-Z' export BUILD_UUID=$BUILDKITE_BUILD_ID export BUILD_BRANCH="$(echo $BUILDKITE_BRANCH | tr ' @./' '_' | tr 'A-Z' 'a-z')" -${DEPLOY_SOURCEGRAPH_ROOT}/tests/integration/restricted/test.sh +./tests/integration/restricted/test.sh diff --git a/tests/integration/restricted/test.sh b/tests/integration/restricted/test.sh index a7862b8426a8..f36d906b5074 100755 --- a/tests/integration/restricted/test.sh +++ b/tests/integration/restricted/test.sh @@ -1,6 +1,16 @@ #!/usr/bin/env bash -set -ex +set -xeuo + +BUILD_CREATOR="${BUILD_CREATOR:-dev}" +BUILD_BRANCH="${BUILD_BRANCH:-dev}" +BUILD_UUID="${BUILD_UUID:-dev}" +[ ! -z "$TEST_GCP_ZONE" ] +[ ! -z "$TEST_GCP_PROJECT" ] +[ ! -z "$TEST_GCP_USERNAME" ] + +CLEANUP="" +trap 'bash -c "$CLEANUP"' EXIT CLUSTER_NAME_SUFFIX=`echo ${BUILD_UUID} | head -c 8` @@ -13,6 +23,8 @@ cd $(dirname "${BASH_SOURCE[0]}") gcloud container clusters create ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --num-nodes 3 --machine-type n1-standard-16 --disk-type pd-ssd --project ${TEST_GCP_PROJECT} --labels="cost-category=build,build-creator=${BUILD_CREATOR},build-branch=${BUILD_BRANCH},integration-test=fresh" gcloud container clusters get-credentials ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --project ${TEST_GCP_PROJECT} +CLUSTER_CLEANUP="gcloud container clusters delete ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --project ${TEST_GCP_PROJECT} --quiet" +CLEANUP="$CLUSTER_CLEANUP; $CLEANUP" kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user ${TEST_GCP_USERNAME} @@ -30,9 +42,9 @@ kubectl create role -n ns-sourcegraph nonroot:unprivileged --verb=use --resource kubectl create rolebinding -n ns-sourcegraph fake-user:nonroot:unprivileged --role=nonroot:unprivileged --serviceaccount=ns-sourcegraph:fake-user -kubectl --as=system:serviceaccount:ns-sourcegraph:fake-user -n ns-sourcegraph apply -k ${DEPLOY_SOURCEGRAPH_ROOT}/overlays/non-privileged-create-cluster +kubectl --as=system:serviceaccount:ns-sourcegraph:fake-user -n ns-sourcegraph apply -k ../../../overlays/non-privileged-create-cluster -kubectl -n ns-sourcegraph expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph --type=LoadBalancer --port=3080 --target-port=3080 +# kubectl -n ns-sourcegraph expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph --type=LoadBalancer --port=3080 --target-port=3080 # wait for it all to finish (we list out the ones with persistent volume claim because they take longer) @@ -48,9 +60,7 @@ kubectl -n ns-sourcegraph rollout status -w deployment/sourcegraph-frontend SOURCEGRAPH_IP=`kubectl -n ns-sourcegraph describe service sourcegraph | grep "LoadBalancer Ingress:" | cut -d ":" -f 2 | tr -d " "` -curl --retry 10 --retry-delay 60 -m 60 http://${SOURCEGRAPH_IP}:3080 - -# delete cluster - -gcloud container clusters delete ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --project ${TEST_GCP_PROJECT} --quiet +kubectl -n ns-sourcegraph port-forward svc/sourcegraph-frontend 30080 & +CLEANUP="kill $!; $CLEANUP" +curl --retry 2 --retry-delay 10 -m 30 http://${SOURCEGRAPH_IP}:30080 From 708d4f7205c1099a7666201e7fa8c1356cde3193 Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Tue, 7 Apr 2020 22:09:55 -0700 Subject: [PATCH 13/15] more dev niceties --- tests/integration/restricted/test.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/integration/restricted/test.sh b/tests/integration/restricted/test.sh index f36d906b5074..c4f96a1cbf9f 100755 --- a/tests/integration/restricted/test.sh +++ b/tests/integration/restricted/test.sh @@ -1,4 +1,9 @@ #!/usr/bin/env bash +# +# Run the integration test that deploys a Sourcegraph cluster with a restrictive security policy. +# Conveniently, this can be run from dev by setting the TEST_GCP_{ZONE,PROJECT,USERNAME} environment +# variables (assuming your local `gcloud` is auth'd with the GCP username). Optionally set NOCLEANUP +# to prevent cleaning up the cluster when finished. set -xeuo @@ -23,8 +28,10 @@ cd $(dirname "${BASH_SOURCE[0]}") gcloud container clusters create ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --num-nodes 3 --machine-type n1-standard-16 --disk-type pd-ssd --project ${TEST_GCP_PROJECT} --labels="cost-category=build,build-creator=${BUILD_CREATOR},build-branch=${BUILD_BRANCH},integration-test=fresh" gcloud container clusters get-credentials ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --project ${TEST_GCP_PROJECT} -CLUSTER_CLEANUP="gcloud container clusters delete ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --project ${TEST_GCP_PROJECT} --quiet" -CLEANUP="$CLUSTER_CLEANUP; $CLEANUP" +if [ -z "${NOCLEANUP:-}" ]; then + CLUSTER_CLEANUP="gcloud container clusters delete ${CLUSTER_NAME} --zone ${TEST_GCP_ZONE} --project ${TEST_GCP_PROJECT} --quiet" + CLEANUP="$CLUSTER_CLEANUP; $CLEANUP" +fi kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user ${TEST_GCP_USERNAME} From 7a9e576a4c808a1b31960391acb6d51d1b5ae662 Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Tue, 7 Apr 2020 22:17:34 -0700 Subject: [PATCH 14/15] fix --- tests/integration/restricted/test.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/integration/restricted/test.sh b/tests/integration/restricted/test.sh index c4f96a1cbf9f..e64cfa907120 100755 --- a/tests/integration/restricted/test.sh +++ b/tests/integration/restricted/test.sh @@ -65,9 +65,7 @@ kubectl -n ns-sourcegraph rollout status -w deployment/sourcegraph-frontend # hit it with one request -SOURCEGRAPH_IP=`kubectl -n ns-sourcegraph describe service sourcegraph | grep "LoadBalancer Ingress:" | cut -d ":" -f 2 | tr -d " "` - kubectl -n ns-sourcegraph port-forward svc/sourcegraph-frontend 30080 & CLEANUP="kill $!; $CLEANUP" -curl --retry 2 --retry-delay 10 -m 30 http://${SOURCEGRAPH_IP}:30080 +curl --retry 2 --retry-delay 10 -m 30 http://localhost:30080 From d7db009ae98e81c73f08b54b49937775ae45a47d Mon Sep 17 00:00:00 2001 From: Beyang Liu Date: Tue, 7 Apr 2020 22:26:26 -0700 Subject: [PATCH 15/15] fix test --- tests/integration/restricted/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/restricted/test.sh b/tests/integration/restricted/test.sh index e64cfa907120..2fc5c8bbcded 100755 --- a/tests/integration/restricted/test.sh +++ b/tests/integration/restricted/test.sh @@ -67,5 +67,5 @@ kubectl -n ns-sourcegraph rollout status -w deployment/sourcegraph-frontend kubectl -n ns-sourcegraph port-forward svc/sourcegraph-frontend 30080 & CLEANUP="kill $!; $CLEANUP" - -curl --retry 2 --retry-delay 10 -m 30 http://localhost:30080 +sleep 2 # (initial delay in port-forward activating) +curl --retry-connrefused --retry 2 --retry-delay 10 -m 30 http://localhost:30080