Skip to content

Commit 7247d25

Browse files
committed
More robust image build process
1 parent 42cd5ca commit 7247d25

File tree

8 files changed

+145
-29
lines changed

8 files changed

+145
-29
lines changed

agent/agentserver/server.go

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@ import (
1717
"context"
1818
"encoding/json"
1919
"fmt"
20-
"go.uber.org/zap"
2120
"io"
2221
"net/http"
23-
_ "net/http/pprof" // Registers /debug/pprof endpoints in http.DefaultServeMux.
22+
_ "net/http/pprof"
2423
"os"
2524
"sort"
2625
"strings"
2726
"sync"
2827
"time"
2928

29+
"go.uber.org/zap"
30+
31+
// Registers /debug/pprof endpoints in http.DefaultServeMux.
32+
3033
"github.com/uber/kraken/build-index/tagclient"
3134
"github.com/uber/kraken/core"
3235
"github.com/uber/kraken/lib/containerruntime"
@@ -56,9 +59,6 @@ type Config struct {
5659
// Timeout for readiness checks
5760
ReadinessTimeout time.Duration `yaml:"readiness_timeout"`
5861

59-
// Maximum request body size for patch operations
60-
MaxRequestBodySize int64 `yaml:"max_request_body_size"`
61-
6262
// Enable detailed request logging
6363
EnableRequestLogging bool `yaml:"enable_request_logging"`
6464
}
@@ -74,9 +74,6 @@ func (c *Config) applyDefaults() {
7474
if c.ReadinessTimeout == 0 {
7575
c.ReadinessTimeout = 30 * time.Second
7676
}
77-
if c.MaxRequestBodySize == 0 {
78-
c.MaxRequestBodySize = 1024 * 1024 // 1MB
79-
}
8077
}
8178

8279
// Server defines the agent HTTP server.
@@ -100,8 +97,8 @@ func New(
10097
sched scheduler.ReloadableScheduler,
10198
tags tagclient.Client,
10299
ac announceclient.Client,
103-
containerRuntime containerruntime.Factory) *Server {
104-
100+
containerRuntime containerruntime.Factory,
101+
) *Server {
105102
config.applyDefaults()
106103

107104
stats = stats.Tagged(map[string]string{
@@ -184,7 +181,7 @@ func (s *Server) getLogger(ctx context.Context) *zap.SugaredLogger {
184181
func (s *Server) getTagHandler(w http.ResponseWriter, r *http.Request) error {
185182
ctx := r.Context()
186183
logger := s.getLogger(ctx)
187-
184+
188185
tag, err := httputil.ParseParam(r, "tag")
189186
if err != nil {
190187
return handler.Errorf("parse tag param: %s", err).Status(http.StatusBadRequest)
@@ -507,9 +504,6 @@ func (s *Server) readinessCheckHandler(w http.ResponseWriter, r *http.Request) e
507504
func (s *Server) patchSchedulerConfigHandler(w http.ResponseWriter, r *http.Request) error {
508505
ctx := r.Context()
509506
logger := s.getLogger(ctx)
510-
511-
// Limit request body size
512-
r.Body = http.MaxBytesReader(w, r.Body, s.config.MaxRequestBodySize)
513507
defer r.Body.Close()
514508

515509
logger.Debugw("patching scheduler config")

docker/agent/Dockerfile

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
FROM debian:10
1+
FROM debian:11
22

3-
RUN apt-get update && apt-get install -y curl nginx
3+
# Use a more reliable mirror
4+
RUN echo "deb http://archive.debian.org/debian bullseye main" > /etc/apt/sources.list \
5+
&& echo "deb http://security.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list \
6+
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
7+
8+
RUN apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/* \
10+
&& \
11+
( \
12+
unset http_proxy https_proxy no_proxy && \
13+
apt-get update -o Acquire::Retries=5 -o Acquire::http::No-Cache=true -o Acquire::http::timeout=30 \
14+
) \
15+
&& \
16+
( \
17+
unset http_proxy https_proxy no_proxy && \
18+
apt-get install -y --no-install-recommends --fix-missing \
19+
curl \
20+
nginx \
21+
) \
22+
&& rm -rf /var/lib/apt/lists/*
423

524
RUN mkdir -p -m 777 /var/log/kraken/kraken-agent
625
RUN mkdir -p -m 777 /var/cache/kraken/kraken-agent

docker/build-index/Dockerfile

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
FROM debian:10
1+
FROM debian:11
22

3-
RUN apt-get update && apt-get install -y curl nginx
3+
# Use a more reliable mirror
4+
RUN echo "deb http://archive.debian.org/debian bullseye main" > /etc/apt/sources.list \
5+
&& echo "deb http://security.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list \
6+
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
7+
8+
RUN apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/* \
10+
&& \
11+
( \
12+
unset http_proxy https_proxy no_proxy && \
13+
apt-get update -o Acquire::Retries=5 -o Acquire::http::No-Cache=true -o Acquire::http::timeout=30 \
14+
) \
15+
&& \
16+
( \
17+
unset http_proxy https_proxy no_proxy && \
18+
apt-get install -y --no-install-recommends --fix-missing \
19+
curl \
20+
nginx \
21+
) \
22+
&& rm -rf /var/lib/apt/lists/*
423

524
RUN mkdir -p -m 777 /var/log/kraken/kraken-build-index
625
RUN mkdir -p -m 777 /var/cache/kraken/kraken-build-index

docker/herd/Dockerfile

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
# This image combines all central components into one container, for easier
22
# deployment and management.
3-
FROM debian:10
3+
FROM debian:11
44

5-
RUN apt-get update && apt-get install -y build-essential curl sqlite3 nginx sudo procps
5+
# Use a more reliable mirror
6+
RUN echo "deb http://archive.debian.org/debian bullseye main" > /etc/apt/sources.list \
7+
&& echo "deb http://security.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list \
8+
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
9+
10+
RUN apt-get clean \
11+
&& rm -rf /var/lib/apt/lists/* \
12+
&& \
13+
( \
14+
unset http_proxy https_proxy no_proxy && \
15+
apt-get update -o Acquire::Retries=5 -o Acquire::http::No-Cache=true -o Acquire::http::timeout=30 \
16+
) \
17+
&& \
18+
( \
19+
unset http_proxy https_proxy no_proxy && \
20+
apt-get install -y --no-install-recommends --fix-missing \
21+
build-essential \
22+
curl \
23+
sqlite3 \
24+
nginx \
25+
sudo \
26+
procps \
27+
) \
28+
&& rm -rf /var/lib/apt/lists/*
629

730
# Install redis.
831
ADD http://download.redis.io/redis-stable.tar.gz /tmp/redis-stable.tar.gz

docker/origin/Dockerfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
FROM debian:10
1+
FROM debian:11
2+
3+
# Use a more reliable mirror
4+
RUN echo "deb http://archive.debian.org/debian bullseye main" > /etc/apt/sources.list \
5+
&& echo "deb http://security.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list \
6+
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
27

38
RUN apt-get clean \
49
&& rm -rf /var/lib/apt/lists/* \
510
&& \
611
( \
712
unset http_proxy https_proxy no_proxy && \
8-
apt-get update -o Acquire::Retries=3 -o Acquire::http::No-Cache=true \
13+
apt-get update -o Acquire::Retries=5 -o Acquire::http::No-Cache=true -o Acquire::http::timeout=30 \
914
) \
1015
&& \
1116
( \
1217
unset http_proxy https_proxy no_proxy && \
13-
apt-get install -y --no-install-recommends \
18+
apt-get install -y --no-install-recommends --fix-missing \
1419
curl \
1520
sqlite3 \
1621
nginx \

docker/proxy/Dockerfile

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
FROM debian:10
1+
FROM debian:11
22

3-
RUN apt-get update && apt-get install -y curl nginx
3+
# Use a more reliable mirror
4+
RUN echo "deb http://archive.debian.org/debian bullseye main" > /etc/apt/sources.list \
5+
&& echo "deb http://security.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list \
6+
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
7+
8+
RUN apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/* \
10+
&& \
11+
( \
12+
unset http_proxy https_proxy no_proxy && \
13+
apt-get update -o Acquire::Retries=5 -o Acquire::http::No-Cache=true -o Acquire::http::timeout=30 \
14+
) \
15+
&& \
16+
( \
17+
unset http_proxy https_proxy no_proxy && \
18+
apt-get install -y --no-install-recommends --fix-missing \
19+
curl \
20+
nginx \
21+
) \
22+
&& rm -rf /var/lib/apt/lists/*
423

524
RUN mkdir -p -m 777 /var/log/kraken/kraken-proxy
625
RUN mkdir -p -m 777 /var/cache/kraken/kraken-proxy

docker/testfs/Dockerfile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1-
FROM debian:10
1+
FROM debian:11
22

3-
RUN apt-get update && apt-get install -y curl
3+
# Use a more reliable mirror
4+
RUN echo "deb http://archive.debian.org/debian bullseye main" > /etc/apt/sources.list \
5+
&& echo "deb http://security.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list \
6+
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
7+
8+
RUN apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/* \
10+
&& \
11+
( \
12+
unset http_proxy https_proxy no_proxy && \
13+
apt-get update -o Acquire::Retries=5 -o Acquire::http::No-Cache=true -o Acquire::http::timeout=30 \
14+
) \
15+
&& \
16+
( \
17+
unset http_proxy https_proxy no_proxy && \
18+
apt-get install -y --no-install-recommends --fix-missing \
19+
curl \
20+
) \
21+
&& rm -rf /var/lib/apt/lists/*
422

523
RUN mkdir -p -m 777 /var/log/kraken/kraken-testfs
624
RUN mkdir -p -m 777 /var/cache/kraken/kraken-testfs

docker/tracker/Dockerfile

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
FROM debian:10
1+
FROM debian:11
22

3-
RUN apt-get update && apt-get install -y curl nginx
3+
# Use a more reliable mirror
4+
RUN echo "deb http://archive.debian.org/debian bullseye main" > /etc/apt/sources.list \
5+
&& echo "deb http://security.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list \
6+
&& echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
7+
8+
RUN apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/* \
10+
&& \
11+
( \
12+
unset http_proxy https_proxy no_proxy && \
13+
apt-get update -o Acquire::Retries=5 -o Acquire::http::No-Cache=true -o Acquire::http::timeout=30 \
14+
) \
15+
&& \
16+
( \
17+
unset http_proxy https_proxy no_proxy && \
18+
apt-get install -y --no-install-recommends --fix-missing \
19+
curl \
20+
nginx \
21+
) \
22+
&& rm -rf /var/lib/apt/lists/*
423

524
RUN mkdir -p -m 777 /var/log/kraken/kraken-tracker
625
RUN mkdir -p -m 777 /var/cache/kraken/kraken-tracker

0 commit comments

Comments
 (0)