Update nginx base image in one place (#8400)
* update files to use one base image file Signed-off-by: James Strong <strong.james.e@gmail.com> * add chart test as well Signed-off-by: James Strong <strong.james.e@gmail.com> * update e2e-test image building Signed-off-by: James Strong <strong.james.e@gmail.com> * update e2e base image arg Signed-off-by: James Strong <strong.james.e@gmail.com> * add current e2e so test run Signed-off-by: James Strong <strong.james.e@gmail.com> * working on fixing build * getting dev-env and make release to work * test * i think buildx is working on mac * updates * why docker for mac and linux cli differ * fix target arch * fix target arch * fix loag issue * fix issue * update the chroot docker file * fix docker base build * mac is the issue * env not getting to the e2e deployment.go file * fix pull issue * fix pull issue * move test scripts into test folder * clean up ci * updates for PR * remove unnesscary var
This commit is contained in:
parent
8baac4214a
commit
e1a16f6e74
19 changed files with 138 additions and 70 deletions
|
|
@ -1,4 +1,5 @@
|
|||
FROM registry.k8s.io/ingress-nginx/e2e-test-runner:v20220624-g3348cd71e@sha256:2a34e322b7ff89abdfa0b6202f903bf5618578b699ff609a3ddabac0aae239c8 AS BASE
|
||||
ARG E2E_BASE_IMAGE
|
||||
FROM ${E2E_BASE_IMAGE} AS BASE
|
||||
|
||||
FROM alpine:3.16.0
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
E2E_BASE_IMAGE="k8s.gcr.io/ingress-nginx/e2e-test-runner:v20220110-gfd820db46@sha256:273f7d9b1b2297cd96b4d51600e45d932186a1cc79d00d179dfb43654112fe8f"
|
||||
|
||||
image:
|
||||
echo "..entered Makefile in /test/e2e-image"
|
||||
|
|
@ -15,6 +16,7 @@ image:
|
|||
cp -R $(DIR)/../../test/e2e/settings/ocsp/* .
|
||||
|
||||
docker build \
|
||||
--build-arg E2E_BASE_IMAGE=$(E2E_BASE_IMAGE) \
|
||||
--tag nginx-ingress-controller:e2e .
|
||||
|
||||
clean:
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ package framework
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
|
|
@ -37,13 +39,11 @@ const SlowEchoService = "slow-echo"
|
|||
// HTTPBinService name of the deployment for the httpbin app
|
||||
const HTTPBinService = "httpbin"
|
||||
|
||||
// NginxBaseImage use for testing
|
||||
const NginxBaseImage = "registry.k8s.io/ingress-nginx/nginx:0ff500c23f34e939305de709cb6d47da34b66611@sha256:15f91034a03550dfab6ec50a7be4abbb683d087e234ad7fef5adedef54e46a5a"
|
||||
|
||||
type deploymentOptions struct {
|
||||
namespace string
|
||||
name string
|
||||
replicas int
|
||||
image string
|
||||
}
|
||||
|
||||
// WithDeploymentNamespace allows configuring the deployment's namespace
|
||||
|
|
@ -67,7 +67,7 @@ func WithDeploymentReplicas(r int) func(*deploymentOptions) {
|
|||
}
|
||||
}
|
||||
|
||||
// NewEchoDeployment creates a new single replica deployment of the echoserver image in a particular namespace
|
||||
// NewEchoDeployment creates a new single replica deployment of the echo server image in a particular namespace
|
||||
func (f *Framework) NewEchoDeployment(opts ...func(*deploymentOptions)) {
|
||||
options := &deploymentOptions{
|
||||
namespace: f.Namespace,
|
||||
|
|
@ -150,6 +150,16 @@ http {
|
|||
f.NGINXWithConfigDeployment(SlowEchoService, cfg)
|
||||
}
|
||||
|
||||
func (f *Framework) GetNginxBaseImage() string {
|
||||
nginxBaseImage := os.Getenv("NGINX_BASE_IMAGE")
|
||||
|
||||
if nginxBaseImage == "" {
|
||||
assert.NotEmpty(ginkgo.GinkgoT(), errors.New("NGINX_BASE_IMAGE not defined"), "NGINX_BASE_IMAGE not defined")
|
||||
}
|
||||
|
||||
return nginxBaseImage
|
||||
}
|
||||
|
||||
// NGINXDeployment creates a new simple NGINX Deployment using NGINX base image
|
||||
// and passing the desired configuration
|
||||
func (f *Framework) NGINXDeployment(name string, cfg string, waitendpoint bool) {
|
||||
|
|
@ -166,7 +176,7 @@ func (f *Framework) NGINXDeployment(name string, cfg string, waitendpoint bool)
|
|||
}, metav1.CreateOptions{})
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "creating configmap")
|
||||
|
||||
deployment := newDeployment(name, f.Namespace, NginxBaseImage, 80, 1,
|
||||
deployment := newDeployment(name, f.Namespace, f.GetNginxBaseImage(), 80, 1,
|
||||
nil,
|
||||
[]corev1.VolumeMount{
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,6 +50,13 @@ export TAG=1.0.0-dev
|
|||
export ARCH=${ARCH:-amd64}
|
||||
export REGISTRY=ingress-controller
|
||||
|
||||
BASEDIR=$(dirname "$0")
|
||||
NGINX_BASE_IMAGE=$(cat $BASEDIR/../../NGINX_BASE)
|
||||
|
||||
echo "Running e2e with nginx base image ${NGINX_BASE_IMAGE}"
|
||||
|
||||
export NGINX_BASE_IMAGE=$NGINX_BASE_IMAGE
|
||||
|
||||
export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/kind-config-$KIND_CLUSTER_NAME}"
|
||||
|
||||
if [ "${SKIP_CLUSTER_CREATION:-false}" = "false" ]; then
|
||||
|
|
|
|||
|
|
@ -51,6 +51,12 @@ export TAG=1.0.0-dev
|
|||
export ARCH=${ARCH:-amd64}
|
||||
export REGISTRY=ingress-controller
|
||||
|
||||
NGINX_BASE_IMAGE=$(cat $DIR/../../NGINX_BASE)
|
||||
|
||||
echo "Running e2e with nginx base image ${NGINX_BASE_IMAGE}"
|
||||
|
||||
export NGINX_BASE_IMAGE=$NGINX_BASE_IMAGE
|
||||
|
||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
|
||||
export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/kind-config-$KIND_CLUSTER_NAME}"
|
||||
|
|
|
|||
38
test/test-lua.sh
Executable file
38
test/test-lua.sh
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
if [ -n "$DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
BUSTED_ARGS="-v --pattern=_test"
|
||||
|
||||
resty \
|
||||
-I ./rootfs/etc/nginx/lua \
|
||||
--shdict "configuration_data 5M" \
|
||||
--shdict "certificate_data 16M" \
|
||||
--shdict "certificate_servers 1M" \
|
||||
--shdict "ocsp_response_cache 1M" \
|
||||
--shdict "balancer_ewma 1M" \
|
||||
--shdict "balancer_ewma_last_touched_at 1M" \
|
||||
--shdict "balancer_ewma_locks 512k" \
|
||||
--shdict "global_throttle_cache 5M" \
|
||||
./rootfs/etc/nginx/lua/test/run.lua ${BUSTED_ARGS} ./rootfs/etc/nginx/lua/test/ ./rootfs/etc/nginx/lua/plugins/**/test
|
||||
33
test/test.sh
Executable file
33
test/test.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
if [ -n "$DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
mkdir -p /tmp/nginx
|
||||
if [ -z "${PKG}" ]; then
|
||||
echo "PKG must be set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
go test -v \
|
||||
$(go list "${PKG}/..." | grep -v vendor | grep -v '/test/e2e' | grep -v images | grep -v "docs/examples")
|
||||
Loading…
Add table
Add a link
Reference in a new issue