Skip to content

Commit

Permalink
Merge pull request #4221 from aledbf/upgrade-nginx-image
Browse files Browse the repository at this point in the history
Switch to openresty image
  • Loading branch information
k8s-ci-robot authored Jun 24, 2019
2 parents 0c1935f + dca5557 commit 5dfc7e2
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ IMAGE = $(REGISTRY)/$(IMGNAME)
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)

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

ifeq ($(ARCH),arm64)
QEMUARCH=aarch64
Expand Down
2 changes: 1 addition & 1 deletion build/run-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set -o errexit
set -o nounset
set -o pipefail

E2E_IMAGE=quay.io/kubernetes-ingress-controller/e2e:v06042019-0c7a34696
E2E_IMAGE=quay.io/kubernetes-ingress-controller/e2e:v06232019-5bb168152

DOCKER_OPTS=${DOCKER_OPTS:-""}

Expand Down
7 changes: 3 additions & 4 deletions images/e2e/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM quay.io/kubernetes-ingress-controller/nginx-amd64:0.87
FROM quay.io/kubernetes-ingress-controller/nginx-amd64:0.88

RUN clean-install \
g++ \
Expand All @@ -21,13 +21,12 @@ RUN clean-install \
libc6-dev \
make \
wget \
luarocks \
python \
pkg-config

ENV GOLANG_VERSION 1.12.5
ENV GOLANG_VERSION 1.12.6
ENV GO_ARCH linux-amd64
ENV GOLANG_SHA aea86e3c73495f205929cfebba0d63f1382c8ac59be081b6351681415f4063cf
ENV GOLANG_SHA dbcf71a3c1ea53b8d54ef1b48c85a39a6c9a935d01fc8291ff2b92028e59913c

RUN set -eux; \
url="https://golang.org/dl/go${GOLANG_VERSION}.${GO_ARCH}.tar.gz"; \
Expand Down
2 changes: 1 addition & 1 deletion images/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ all: docker-build docker-push
docker-build:
$(DOCKER) build \
--pull \
--build-arg K8S_RELEASE=v1.14.1 \
--build-arg K8S_RELEASE=v1.15.0 \
--build-arg ETCD_VERSION=v3.3.12 \
-t $(IMAGE):$(TAG) .

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/sbin/nginx"
defBinary = "/usr/local/openresty/nginx/sbin/nginx"
cfgPath = "/etc/nginx/nginx.conf"
)

Expand Down
21 changes: 14 additions & 7 deletions rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ RUN clean-install \

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

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

# Add LuaRocks paths
ENV LUA_PATH="/usr/local/openresty/site/lualib/?.ljbc;/usr/local/openresty/site/lualib/?/init.ljbc;/usr/local/openresty/lualib/?.ljbc;/usr/local/openresty/lualib/?/init.ljbc;/usr/local/openresty/site/lualib/?.lua;/usr/local/openresty/site/lualib/?/init.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua;/usr/local/lib/lua/?.lua;/etc/nginx/lua/?.lua;/etc/nginx/lua/vendor/?.lua;;"
ENV LUA_CPATH="/etc/nginx/lua/?.lua;/etc/nginx/lua/vendor/?.lua;/usr/local/openresty/site/lualib/?.so;/usr/local/openresty/lualib/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;;"

# Fix permission during the build to avoid issues at runtime
# with volumes (custom templates)
RUN bash -eu -c ' \
Expand All @@ -42,16 +49,16 @@ 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/sbin/nginx \
&& setcap -v cap_net_bind_service=+ep /usr/sbin/nginx

# Create symlinks to redirect nginx logs to stdout and stderr docker log collector
# This only works if nginx is started with CMD or ENTRYPOINT
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log
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

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

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

CMD ["/nginx-ingress-controller"]
4 changes: 2 additions & 2 deletions rootfs/etc/nginx/template/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ events {
}

http {
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 "/usr/local/openresty/site/lualib/?.ljbc;/usr/local/openresty/site/lualib/?/init.ljbc;/usr/local/openresty/lualib/?.ljbc;/usr/local/openresty/lualib/?/init.ljbc;/usr/local/openresty/site/lualib/?.lua;/usr/local/openresty/site/lualib/?/init.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua;/usr/local/lib/lua/?.lua;;";
lua_package_cpath "/usr/local/openresty/site/lualib/?.so;/usr/local/openresty/lualib/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;;";

{{ buildLuaSharedDictionaries $servers $all.Cfg.DisableLuaRestyWAF }}

Expand Down
4 changes: 2 additions & 2 deletions test/e2e-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/kubernetes-ingress-controller/e2e:v06042019-0c7a34696 AS BASE
FROM quay.io/kubernetes-ingress-controller/e2e:v06232019-5bb168152 AS BASE

FROM quay.io/kubernetes-ingress-controller/debian-base-amd64:0.1

Expand All @@ -9,7 +9,7 @@ RUN clean-install \
tzdata

RUN curl -Lo /usr/local/bin/kubectl \
https://storage.googleapis.com/kubernetes-release/release/v1.14.1/bin/linux/amd64/kubectl \
https://storage.googleapis.com/kubernetes-release/release/v1.15.0/bin/linux/amd64/kubectl \
&& chmod +x /usr/local/bin/kubectl

COPY --from=BASE /go/bin/ginkgo /usr/local/bin/
Expand Down
2 changes: 1 addition & 1 deletion test/e2e-prow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ RUN curl -L https://storage.googleapis.com/etcd/${ETCD_VERSION}/etcd-${ETCD_VERS
&& rm -rf /tmp/etcd-download

# install go
ENV GO_VERSION 1.12.5
ENV GO_VERSION 1.12.6
ENV GO_TARBALL "go${GO_VERSION}.linux-amd64.tar.gz"
RUN wget -q "https://storage.googleapis.com/golang/${GO_TARBALL}" && \
tar xzf "${GO_TARBALL}" -C /usr/local && \
Expand Down
2 changes: 1 addition & 1 deletion test/e2e-prow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ all: docker-build docker-push
docker-build:
$(DOCKER) build \
--pull \
--build-arg K8S_RELEASE=v1.14.1 \
--build-arg K8S_RELEASE=v1.15.0 \
--build-arg ETCD_VERSION=v3.3.12 \
-t $(IMAGE):$(TAG) .

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("nginx/"))
Expect(body).Should(ContainSubstring("openresty/"))
})

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("nginx/"))
Expect(body).Should(ContainSubstring("openresty/"))
})
})
14 changes: 14 additions & 0 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,20 @@ func (f *Framework) AfterEach() {
Expect(err).ToNot(HaveOccurred())
By("Dumping NGINX logs after a failure running a test")
Logf("%v", log)

pod, err := getIngressNGINXPod(f.Namespace, f.KubeClientSet)
if err != nil {
return
}

cmd := fmt.Sprintf("cat /etc/nginx/nginx.conf")
o, err := f.ExecCommand(pod, cmd)
if err != nil {
return
}

By("Dumping NGINX configuration after a failure running a test")
Logf("%v", o)
}
}

Expand Down

0 comments on commit 5dfc7e2

Please sign in to comment.