Skip to content

Commit

Permalink
Remove legacy GeoIP from image (#10500)
Browse files Browse the repository at this point in the history
Signed-off-by: Jintao Zhang <[email protected]>
Co-authored-by: Ricardo Katz <[email protected]>
  • Loading branch information
tao12345666333 and rikatz authored Oct 15, 2023
1 parent 9db8fe5 commit 0055ba3
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion images/nginx/rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ RUN apk update \
openssl \
pcre \
zlib \
geoip \
ca-certificates \
patch \
yajl \
Expand Down
8 changes: 3 additions & 5 deletions images/nginx/rootfs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export LUA_UPSTREAM_VERSION=8aa93ead98ba2060d4efd594ae33a35d153589bf
# Check for recent changes: https://github.com/openresty/lua-cjson/compare/2.1.0.11...openresty:master
export LUA_CJSON_VERSION=2.1.0.11

# Check for recent changes: https://github.com/leev/ngx_http_geoip2_module/compare/3.3...master
export GEOIP2_VERSION=a26c6beed77e81553686852dceb6c7fdacc5970d
# Check for recent changes: https://github.com/leev/ngx_http_geoip2_module/compare/3.4...master
export GEOIP2_VERSION=a607a41a8115fecfc05b5c283c81532a3d605425

# Check for recent changes: https://github.com/openresty/luajit2/compare/v2.1-20230410...v2.1-agentzh
export LUAJIT_VERSION=2.1-20230410
Expand Down Expand Up @@ -164,7 +164,6 @@ apk add \
linux-headers \
libxslt-dev \
gd-dev \
geoip-dev \
perl-dev \
libedit-dev \
mercurial \
Expand Down Expand Up @@ -263,7 +262,7 @@ fi
get_src 8d39c6b23f941a2d11571daaccc04e69539a3fcbcc50a631837560d5861a7b96 \
"https://github.com/DataDog/dd-opentracing-cpp/archive/v$DATADOG_CPP_VERSION.tar.gz"

get_src 4c1933434572226942c65b2f2b26c8a536ab76aa771a3c7f6c2629faa764976b \
get_src b6c9c09fd43eb34a71e706ad780b2ead26549a9a9f59280fe558f5b7b980b7c6 \
"https://github.com/leev/ngx_http_geoip2_module/archive/$GEOIP2_VERSION.tar.gz"

get_src deb4ab1ffb9f3d962c4b4a2c4bdff692b86a209e3835ae71ebdf3b97189e40a9 \
Expand Down Expand Up @@ -583,7 +582,6 @@ WITH_FLAGS="--with-debug \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_addition_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_sub_module \
--with-http_v2_module \
Expand Down
Binary file removed images/nginx/rootfs/etc/nginx/geoip/GeoIP.dat
Binary file not shown.
Binary file removed images/nginx/rootfs/etc/nginx/geoip/GeoIPASNum.dat
Binary file not shown.
Binary file removed images/nginx/rootfs/etc/nginx/geoip/GeoLiteCity.dat
Binary file not shown.

1 comment on commit 0055ba3

@mstavrev
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,

I am building a forked controller. Since I am building a custom Nginx base image as part of my pipeline, I've discovered a potential problem for the future Nginx controller releases.
This commit should had contained also a removal of the file watcher for the /etc/nginx/geoip directory, see

err = filepath.Walk("/etc/nginx/geoip/", func(path string, info os.FileInfo, err error) error {

The v1.9.4 controller works fine, because it uses an older Nginx base image version that still has this folder: registry.k8s.io/ingress-nginx/nginx:v20231011-8b53cabe0@sha256:34881d62f71e8573fb765c40585dba28a1148206fbbe2c3871ad3f4e8c6e360f

However, once a newer controller is released that also needs a newer Nginx base image, the controller's startup shall fail since that folder is not going to be available anymore on newer base images. The error looks like:

F1029 16:12:33.043975 7 nginx.go:197] Error creating file watchers: lstat /etc/nginx/geoip/: no such file or directory

I am not an expert on Go, so I feel reluctant to create a PR myself. Please, pardon me if this is not the correct place to post this information.

Best Regards

Please sign in to comment.