Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
kind-logs
vendor/
1 change: 1 addition & 0 deletions backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func main() {
w.WriteHeader(http.StatusNoContent)
return
}
log.Printf("%s %s %s %s", r.Method, r.UserAgent(), r.URL.Path, r.Header)
h.ServeHTTP(w, r)
})
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN adduser \
COPY go.mod go.mod
COPY main.go main.go

RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" -o frontend
RUN --mount=type=cache,target="/root/.cache/go-build" GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" -o frontend

####### demo-app
FROM scratch
Expand Down
4 changes: 3 additions & 1 deletion frontend/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module example.com/frontend

go 1.22
go 1.23.0

toolchain go1.24.7
10 changes: 9 additions & 1 deletion frontend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ func main() {
}
proxy := httputil.NewSingleHostReverseProxy(backendURL)

originalDirector := proxy.Director
proxy.Director = func(req *http.Request) {
originalDirector(req)
req.URL.Scheme = backendURL.Scheme
req.URL.Host = backendURL.Host
req.Host = backendURL.Host
}

mux := http.NewServeMux()

mux.Handle("/api/", proxy)
Expand Down Expand Up @@ -58,6 +66,6 @@ func loggingMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
next.ServeHTTP(w, r)
log.Printf("%s %s %s", r.Method, r.URL.Path, time.Since(start))
log.Printf("%s %s %s %s %s", r.Method, r.UserAgent(), r.URL.Path, time.Since(start), r.Header)
})
}
3 changes: 3 additions & 0 deletions local-dev/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ include('./istio/Tiltfile')

# start local LoadBalancer
include('./loadbalancer/Tiltfile')

# Install Jaeger
include('./jaeger/Tiltfile')
12 changes: 9 additions & 3 deletions local-dev/istio/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ helm_resource(
namespace = 'istio-system',
labels = 'System',
flags = [
'--version=1.27.1',
'--version=1.28.0',
'--create-namespace',
],
auto_init = True,
Expand All @@ -29,9 +29,15 @@ helm_resource(
namespace = 'istio-system',
labels = 'System',
flags = [
'--version=1.27.1',
'--version=1.28.0',
'--create-namespace',
'--set=autoscaleEnabled=false',
'--set=traceSampling=100.0',
'--set=global.proxy.tracer=zipkin',
'--set=meshConfig.enableTracing=true',
'--set=meshConfig.ingressService=istio-gateway',
'--set=meshConfig.ingressSelector=gateway',
'--set=meshConfig.defaultConfig.tracing.zipkin.address=jaeger-collector.istio-system:9411',
'--wait',
],
auto_init = True
Expand All @@ -45,7 +51,7 @@ helm_resource(
namespace = 'istio-gateway',
labels = 'System',
flags = [
'--version=1.27.1',
'--version=1.28.0',
'--set=autoscaling.enabled=false',
'--create-namespace',
],
Expand Down
32 changes: 32 additions & 0 deletions local-dev/jaeger/Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
load('ext://helm_resource', 'helm_repo', 'helm_resource')

helm_repo(
'jaegertracing',
'https://jaegertracing.github.io/helm-charts'
)

helm_resource(
'jaeger',
'jaegertracing/jaeger',
resource_deps = ['istio'],
namespace = 'istio-system',
labels = 'System',
flags = [
'--version=3.4.1',
'--create-namespace',
'--set=query.enabled=false',
'--set=provisionDataStore.cassandra=false',
'--set=allInOne.enabled=true',
'--set=storage.type=memory',
'--set=agent.enabled=false',
'--set=collector.enabled=false',
],
auto_init = False,
pod_readiness = 'ignore'
)

k8s_resource(
workload = 'jaeger',
labels = ['System'],
port_forwards = '16686:16686',
)
5 changes: 3 additions & 2 deletions manifests/base/backend/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ metadata:
name: backend
spec:
ports:
- name: tcp-api
targetPort: api
- name: http-api
port: 80
targetPort: api
appProtocol: http
selector:
app: backend
2 changes: 1 addition & 1 deletion manifests/base/peer-authentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ metadata:
name: strict-mtls
spec:
mtls:
mode: PERMISSIVE
mode: STRICT