Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update nginx image #4862

Merged
merged 5 commits into from
Jan 4, 2020
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ GOBUILD_FLAGS := -v

ALL_ARCH = amd64 arm arm64

QEMUVERSION = v4.1.0-1
QEMUVERSION = v4.1.1-1

BUSTED_ARGS =-v --pattern=_test

Expand All @@ -77,7 +77,7 @@ export E2E_CHECK_LEAKS
export SLOW_E2E_THRESHOLD

# Set default base image dynamically for each arch
BASEIMAGE?=quay.io/kubernetes-ingress-controller/nginx-$(ARCH):daf8634acf839708722cffc67a62e9316a2771c6
BASEIMAGE?=quay.io/kubernetes-ingress-controller/nginx-$(ARCH):422f554ba9cb291b4402306d77e218dff63ffab4

ifeq ($(ARCH),arm)
QEMUARCH=arm
Expand Down
4 changes: 2 additions & 2 deletions deploy/cloud-generic/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ spec:
- ALL
add:
- NET_BIND_SERVICE
# www-data -> 33
runAsUser: 33
# www-data -> 101
runAsUser: 101
env:
- name: POD_NAME
valueFrom:
Expand Down
4 changes: 2 additions & 2 deletions deploy/static/mandatory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ spec:
- ALL
add:
- NET_BIND_SERVICE
# www-data -> 33
runAsUser: 33
# www-data -> 101
runAsUser: 101
env:
- name: POD_NAME
valueFrom:
Expand Down
4 changes: 2 additions & 2 deletions deploy/static/with-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ spec:
- ALL
add:
- NET_BIND_SERVICE
# www-data -> 33
runAsUser: 33
# www-data -> 101
runAsUser: 101
env:
- name: POD_NAME
valueFrom:
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/psp/psp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
runAsUser:
rule: 'MustRunAsNonRoot'
ranges:
- min: 33
- min: 101
max: 65535
seLinux:
rule: 'RunAsAny'
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func rlimitMaxNumFiles() int {
}

const (
defBinary = "/usr/local/openresty/nginx/sbin/nginx"
defBinary = "/usr/local/nginx/sbin/nginx"
cfgPath = "/etc/nginx/nginx.conf"
)

Expand Down
21 changes: 8 additions & 13 deletions rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,21 @@ CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/

WORKDIR /etc/nginx

RUN clean-install \
RUN apk add -U --no-cache \
diffutils \
libcap2-bin
libcap

COPY --chown=www-data:www-data . /

RUN cp /usr/local/openresty/nginx/conf/mime.types /etc/nginx/mime.types \
&& cp /usr/local/openresty/nginx/conf/fastcgi_params /etc/nginx/fastcgi_params
RUN ln -s /usr/local/openresty/nginx/modules /etc/nginx/modules

# Fix permission during the build to avoid issues at runtime
# with volumes (custom templates)
RUN bash -eu -c ' \
RUN bash -xeu -c ' \
writeDirs=( \
/etc/ingress-controller \
/etc/ingress-controller/ssl \
/etc/ingress-controller/auth \
/var/log \
/var/log/nginx \
/tmp \
); \
for dir in "${writeDirs[@]}"; do \
mkdir -p ${dir}; \
Expand All @@ -53,15 +49,14 @@ RUN bash -eu -c ' \
RUN setcap cap_net_bind_service=+ep /nginx-ingress-controller \
&& setcap -v cap_net_bind_service=+ep /nginx-ingress-controller

RUN setcap cap_net_bind_service=+ep /usr/local/openresty/nginx/sbin/nginx \
&& setcap -v cap_net_bind_service=+ep /usr/local/openresty/nginx/sbin/nginx
RUN setcap cap_net_bind_service=+ep /usr/local/nginx/sbin/nginx \
&& setcap -v cap_net_bind_service=+ep /usr/local/nginx/sbin/nginx

USER www-data

# Create symlinks to redirect nginx logs to stdout and stderr docker log collector
RUN ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log \
&& ln -sf /dev/stderr /usr/local/openresty/nginx/logs/error.log \
&& ln -s /usr/local/openresty/nginx/logs/* /var/log/nginx
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log

ENTRYPOINT ["/usr/bin/dumb-init", "--"]

Expand Down
3 changes: 1 addition & 2 deletions rootfs/etc/nginx/template/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,7 @@ http {
}

stream {
lua_package_cpath "/usr/local/lib/lua/?.so;/usr/lib/lua-platform-path/lua/5.1/?.so;;";
lua_package_path "/etc/nginx/lua/?.lua;/etc/nginx/lua/vendor/?.lua;/usr/local/lib/lua/?.lua;;";
lua_package_path "/etc/nginx/lua/?.lua;/etc/nginx/lua/vendor/?.lua;;";

lua_shared_dict tcp_udp_configuration_data 5M;

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/annotations/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
})

It("should return status code 500 when authentication is configured with invalid content and Authorization header is sent", func() {
It("should return status code 401 when authentication is configured with invalid content and Authorization header is sent", func() {
host := "auth"

s := f.EnsureSecret(
Expand Down Expand Up @@ -253,7 +253,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
End()

Expect(errs).Should(BeEmpty())
Expect(resp.StatusCode).Should(Equal(http.StatusInternalServerError))
Expect(resp.StatusCode).Should(Equal(http.StatusUnauthorized))
})

It(`should set snippet "proxy_set_header My-Custom-Header 42;" when external auth is configured`, func() {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/annotations/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Redirect", func() {
Expect(errs).To(BeNil())
Expect(resp.StatusCode).Should(BeNumerically("==", http.StatusMovedPermanently))
Expect(resp.Header.Get("Location")).Should(Equal(redirectURL))
Expect(body).Should(ContainSubstring("openresty/"))
Expect(body).Should(ContainSubstring("nginx/"))
})

It("should respond with a custom redirect code", func() {
Expand Down Expand Up @@ -108,6 +108,6 @@ var _ = framework.IngressNginxDescribe("Annotations - Redirect", func() {
Expect(errs).To(BeNil())
Expect(resp.StatusCode).Should(BeNumerically("==", redirectCode))
Expect(resp.Header.Get("Location")).Should(Equal(redirectURL))
Expect(body).Should(ContainSubstring("openresty/"))
Expect(body).Should(ContainSubstring("nginx/"))
})
})
2 changes: 2 additions & 0 deletions test/e2e/settings/geoip2.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ var _ = framework.IngressNginxDescribe("Geoip2", func() {
})

It("should only allow requests from specific countries", func() {
Skip("GeoIP test are temporarily disabled")

f.UpdateNginxConfigMapData("use-geoip2", "true")

httpSnippetAllowingOnlyAustralia :=
Expand Down