Merge pull request #132756 from ylink-lfs/ci/redis_removal

ci: redis removal for e2e test dependency simplicity
This commit is contained in:
Kubernetes Prow Robot
2025-07-24 09:38:42 -07:00
committed by GitHub
29 changed files with 8 additions and 414 deletions

View File

@@ -168,8 +168,6 @@ dependencies:
match: registry\.k8s\.io\/build-image\/debian-base-amd64:[a-zA-Z]+\-v((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)
- path: test/images/regression-issue-74839/BASEIMAGE
match: registry\.k8s\.io\/build-image\/debian-base-amd64:[a-zA-Z]+\-v((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)
- path: test/images/pets/redis-installer/BASEIMAGE
match: registry\.k8s\.io\/build-image\/debian-base-amd64:[a-zA-Z]+\-v((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)
- path: cluster/gce/gci/configure-helper.sh
match: registry\.k8s\.io\/build-image\/debian-base:[a-zA-Z]+\-v((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)
- path: pkg/volume/plugins.go

View File

@@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: master
image: docker.io/library/redis:5.0.5-alpine
image: registry.k8s.io/e2e-test-images/redis:5.0.5-alpine
resources:
requests:
cpu: 100m

View File

@@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: master
image: docker.io/library/redis:5.0.5-alpine
image: registry.k8s.io/e2e-test-images/redis:5.0.5-alpine
resources:
requests:
cpu: 100m

View File

@@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: slave
image: docker.io/library/redis:5.0.5-alpine
image: registry.k8s.io/e2e-test-images/redis:5.0.5-alpine
# We are only implementing the dns option of:
# https://github.com/kubernetes/examples/blob/97c7ed0eb6555a4b667d2877f965d392e00abc45/guestbook/redis-slave/run.sh
command: [ "redis-server", "--slaveof", "redis-master", "6379" ]

View File

@@ -24,7 +24,7 @@ spec:
spec:
containers:
- name: slave
image: docker.io/library/redis:5.0.5-alpine
image: registry.k8s.io/e2e-test-images/redis:5.0.5-alpine
# We are only implementing the dns option of:
# https://github.com/kubernetes/examples/blob/97c7ed0eb6555a4b667d2877f965d392e00abc45/guestbook/redis-slave/run.sh
command: [ "redis-server", "--slaveof", "redis-master", "6379" ]

View File

@@ -66,7 +66,6 @@ import (
const (
zookeeperManifestPath = "test/e2e/testing-manifests/statefulset/zookeeper"
mysqlGaleraManifestPath = "test/e2e/testing-manifests/statefulset/mysql-galera"
redisManifestPath = "test/e2e/testing-manifests/statefulset/redis"
cockroachDBManifestPath = "test/e2e/testing-manifests/statefulset/cockroachdb"
// We don't restart MySQL cluster regardless of restartCluster, since MySQL doesn't handle restart well
restartCluster = true
@@ -1195,14 +1194,6 @@ var _ = SIGDescribe("StatefulSet", func() {
appTester.run(ctx)
})
// Do not mark this as Conformance.
// StatefulSet Conformance should not be dependent on specific applications.
ginkgo.It("should creating a working redis cluster", func(ctx context.Context) {
e2epv.SkipIfNoDefaultStorageClass(ctx, c)
appTester.statefulPod = &redisTester{client: c}
appTester.run(ctx)
})
// Do not mark this as Conformance.
// StatefulSet Conformance should not be dependent on specific applications.
ginkgo.It("should creating a working mysql cluster", func(ctx context.Context) {
@@ -2090,37 +2081,6 @@ func (m *mysqlGaleraTester) read(statefulPodIndex int, key string) string {
return lastLine(m.mysqlExec(fmt.Sprintf("use statefulset; select v from foo where k=\"%v\";", key), m.ss.Namespace, name))
}
type redisTester struct {
ss *appsv1.StatefulSet
client clientset.Interface
}
func (m *redisTester) name() string {
return "redis: master/slave"
}
func (m *redisTester) redisExec(cmd, ns, podName string) string {
cmd = fmt.Sprintf("/opt/redis/redis-cli -h %v %v", podName, cmd)
return e2ekubectl.RunKubectlOrDie(ns, "exec", podName, "--", "/bin/sh", "-c", cmd)
}
func (m *redisTester) deploy(ctx context.Context, ns string) *appsv1.StatefulSet {
m.ss = e2estatefulset.CreateStatefulSet(ctx, m.client, redisManifestPath, ns)
return m.ss
}
func (m *redisTester) write(statefulPodIndex int, kv map[string]string) {
name := fmt.Sprintf("%v-%d", m.ss.Name, statefulPodIndex)
for k, v := range kv {
framework.Logf("%s", m.redisExec(fmt.Sprintf("SET %v %v", k, v), m.ss.Namespace, name))
}
}
func (m *redisTester) read(statefulPodIndex int, key string) string {
name := fmt.Sprintf("%v-%d", m.ss.Name, statefulPodIndex)
return lastLine(m.redisExec(fmt.Sprintf("GET %v", key), m.ss.Namespace, name))
}
type cockroachDBTester struct {
ss *appsv1.StatefulSet
client clientset.Interface

View File

@@ -86,7 +86,6 @@ type testImagesStruct struct {
HttpdImage string
HttpdNewImage string
PauseImage string
RedisImage string
}
var testImages testImagesStruct
@@ -102,7 +101,6 @@ func init() {
imageutils.GetE2EImage(imageutils.Httpd),
imageutils.GetE2EImage(imageutils.HttpdNew),
imageutils.GetE2EImage(imageutils.Pause),
imageutils.GetE2EImage(imageutils.Redis),
}
}

View File

@@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: master
image: docker.io/library/redis:5.0.5-alpine
image: registry.k8s.io/e2e-test-images/redis:5.0.5-alpine
resources:
requests:
cpu: 100m

View File

@@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: slave
image: docker.io/library/redis:5.0.5-alpine
image: registry.k8s.io/e2e-test-images/redis:5.0.5-alpine
# We are only implementing the dns option of:
# https://github.com/kubernetes/examples/blob/97c7ed0eb6555a4b667d2877f965d392e00abc45/guestbook/redis-slave/run.sh
command: [ "redis-server", "--slaveof", "redis-master", "6379" ]

View File

@@ -1,16 +0,0 @@
# A headless service to create DNS records
apiVersion: v1
kind: Service
metadata:
name: redis
labels:
app: redis
spec:
ports:
- port: 6379
name: peer
# *.redis.default.svc.cluster.local
clusterIP: None
selector:
app: redis
publishNotReadyAddresses: true

View File

@@ -1,81 +0,0 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: rd
spec:
serviceName: "redis"
replicas: 3
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
initContainers:
- name: install
image: registry.k8s.io/e2e-test-images/pets/redis-installer:1.5
imagePullPolicy: Always
args:
- "--install-into=/opt"
- "--work-dir=/work-dir"
volumeMounts:
- name: opt
mountPath: "/opt"
- name: workdir
mountPath: "/work-dir"
- name: bootstrap
image: debian:jessie
command:
- "/work-dir/peer-finder"
args:
- -on-start="/work-dir/on-start.sh"
- "-service=redis"
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
volumeMounts:
- name: opt
mountPath: "/opt"
- name: workdir
mountPath: "/work-dir"
containers:
- name: redis
image: debian:jessie
ports:
- containerPort: 6379
name: peer
command:
- /opt/redis/redis-server
args:
- /opt/redis/redis.conf
readinessProbe:
exec:
command:
- sh
- -c
- "/opt/redis/redis-cli -h $(hostname) ping"
initialDelaySeconds: 15
timeoutSeconds: 5
volumeMounts:
- name: datadir
mountPath: /data
- name: opt
mountPath: /opt
volumes:
- name: opt
emptyDir: {}
- name: workdir
emptyDir: {}
volumeClaimTemplates:
- metadata:
name: datadir
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi

View File

@@ -24,7 +24,7 @@ spec:
spec:
containers:
- name: slave
image: docker.io/library/redis:5.0.5-alpine
image: registry.k8s.io/e2e-test-images/redis:5.0.5-alpine
# We are only implementing the dns option of:
# https://github.com/kubernetes/examples/blob/97c7ed0eb6555a4b667d2877f965d392e00abc45/guestbook/redis-slave/run.sh
command: [ "redis-server", "--slaveof", "redis-master", "6379" ]

View File

@@ -24,7 +24,6 @@ registry.k8s.io/e2e-test-images/node-perf/tf-wide-deep
registry.k8s.io/e2e-test-images/nonewprivs
registry.k8s.io/e2e-test-images/nonroot
registry.k8s.io/e2e-test-images/perl
registry.k8s.io/e2e-test-images/redis
registry.k8s.io/e2e-test-images/regression-issue-74839
registry.k8s.io/e2e-test-images/resource-consumer
registry.k8s.io/e2e-test-images/sample-apiserver

View File

@@ -1,7 +1,7 @@
# See https://cloud.google.com/cloud-build/docs/build-config
# this must be specified in seconds. If omitted, defaults to 600s (10 mins)
# the timeout was increased because some images might take longer to build (e.g.: sample-apiserver, pets/redis-installer)
# the timeout was increased because some images might take longer to build (e.g.: sample-apiserver)
timeout: 5400s
# this prevents errors if you don't use both _GIT_TAG and _PULL_BASE_REF,
# or any new substitutions added in the future.

View File

@@ -1,4 +0,0 @@
linux/amd64=registry.k8s.io/build-image/debian-base-amd64:bookworm-v1.0.4
linux/arm=registry.k8s.io/build-image/debian-base-arm:bookworm-v1.0.4
linux/arm64=registry.k8s.io/build-image/debian-base-arm64:bookworm-v1.0.4
linux/ppc64le=registry.k8s.io/build-image/debian-base-ppc64le:bookworm-v1.0.4

View File

@@ -1,41 +0,0 @@
# Copyright 2016 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.
# TODO: get rid of bash dependency and switch to plain busybox.
# The tar in busybox also doesn't seem to understand compression.
ARG BASEIMAGE
FROM $BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
# TODO: just use standard redis when there is one for 3.2.0.
RUN clean-install wget make gcc libc-dev bash
# See README.md
RUN wget -qO /redis-3.2.0.tar.gz http://download.redis.io/releases/redis-3.2.0.tar.gz && \
tar -xzf /redis-3.2.0.tar.gz -C /tmp/ && rm /redis-3.2.0.tar.gz
# Clean out existing deps before installation
# see https://github.com/antirez/redis/issues/722
RUN cd /tmp/redis-3.2.0 && make distclean && mkdir -p /redis && \
make install INSTALL_BIN=/redis && \
mv /tmp/redis-3.2.0/redis.conf /redis/redis.conf && \
rm -rf /tmp/redis-3.2.0
ADD on-start.sh /
COPY peer-finder /
ADD install.sh /
RUN chmod -c 755 /install.sh /on-start.sh /peer-finder
ENTRYPOINT ["/install.sh"]

View File

@@ -1,27 +0,0 @@
# Copyright 2016 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.
SRCS = peer-finder
OS ?= linux
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOARM ?= 7
GOLANG_VERSION ?= latest
SRC_DIR = pets/peer-finder
export
bin:
../../image-util.sh bin $(SRCS)
.PHONY: bin

View File

@@ -1,10 +0,0 @@
# Redis statefulset e2e tester
The image in this directory is the init container for contrib/pets/redis but for one difference, it bakes a specific version of redis into the base image so we get deterministic test results without having to depend on a redis download server. Discussing the tradeoffs to either approach (download the version at runtime, or maintain an image per version) are outside the scope of this document.
You can execute the image locally via:
```
docker run -it registry.k8s.io/redis-install-3.2.0:e2e --cmd --install-into=/opt --work-dir=/work-dir
```
To share the installation with other containers mount the appropriate volumes as `--install-into` and `--work-dir`, where `install-into` is the directory to install redis into, and `work-dir` is the directory to install the user/admin supplied on-{start,change} hook scripts.

View File

@@ -1 +0,0 @@
1.6

View File

@@ -1,51 +0,0 @@
#!/bin/bash
# Copyright 2016 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.
# This volume is assumed to exist and is shared with parent of the init
# container. It contains the redis installation.
INSTALL_VOLUME="/opt"
# This volume is assumed to exist and is shared with the peer-finder
# init container. It contains on-start/change configuration scripts.
WORK_DIR="/work-dir"
VERSION="3.2.0"
for i in "$@"
do
case $i in
-i=*|--install-into=*)
INSTALL_VOLUME="${i#*=}"
shift
;;
-w=*|--work-dir=*)
WORK_DIR="${i#*=}"
shift
;;
*)
# unknown option
;;
esac
done
echo installing config scripts into "${WORK_DIR}"
mkdir -p "${WORK_DIR}"
cp /on-start.sh "${WORK_DIR}"/
cp /peer-finder "${WORK_DIR}"/
echo installing redis-"${VERSION}" into "${INSTALL_VOLUME}"
mkdir -p "${INSTALL_VOLUME}"
mv /redis "${INSTALL_VOLUME}"/redis

View File

@@ -1,49 +0,0 @@
#!/usr/bin/env bash
# Copyright 2016 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.
set -e
CFG=/opt/redis/redis.conf
HOSTNAME=$(hostname)
DATADIR="/data"
# Port on which redis listens for connections.
PORT=6379
# Ping everyone but ourself to see if there's a master. Only one pet starts at
# a time, so if we don't see a master we can assume the position is ours.
while read -ra LINE; do
if [[ "${LINE[0]}" == *"${HOSTNAME}"* ]]; then
sed -i -e "s|^bind.*$|bind ${LINE[0]}|" ${CFG}
elif [ "$(/opt/redis/redis-cli -h "${LINE[0]}" info | grep role | sed 's,\r$,,')" = "role:master" ]; then
# TODO: More restrictive regex?
sed -i -e "s|^# slaveof.*$|slaveof ${LINE[0]} ${PORT}|" ${CFG}
fi
done
# Set the data directory for append only log and snapshot files. This should
# be a persistent volume for consistency.
sed -i -e "s|^.*dir .*$|dir ${DATADIR}|" ${CFG}
# The append only log is written for every SET operation. Without this setting,
# redis just snapshots periodically which is only safe for a cache. This will
# produce an appendonly.aof file in the configured data dir.
sed -i -e "s|^appendonly .*$|appendonly yes|" ${CFG}
# Every write triggers an fsync. Recommended default is "everysec", which
# is only safe for AP applications.
sed -i -e "s|^appendfsync .*$|appendfsync always|" ${CFG}

View File

@@ -1,7 +0,0 @@
linux/amd64=alpine:3.6
linux/arm=arm32v6/alpine:3.6
linux/arm64=arm64v8/alpine:3.6
linux/ppc64le=ppc64le/alpine:3.6
linux/s390x=s390x/alpine:3.6
windows/amd64/1809=REGISTRY/busybox:1.29-2-windows-amd64-1809
windows/amd64/ltsc2022=REGISTRY/busybox:1.29-2-windows-amd64-ltsc2022

View File

@@ -1,27 +0,0 @@
# Copyright 2017 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.
ARG BASEIMAGE
FROM $BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
RUN apk add --no-cache redis
COPY redis.conf /etc/redis.conf
EXPOSE 6379
VOLUME /data
CMD ["redis-server", "/etc/redis.conf"]

View File

@@ -1,33 +0,0 @@
# Copyright 2020 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.
ARG BASEIMAGE
# We're using a Linux image to unpack the archive, then we're copying it over to Windows.
FROM --platform=linux/amd64 alpine:3.6 as prep
ADD https://github.com/MSOpenTech/redis/releases/download/win-3.2.100/Redis-x64-3.2.100.zip /redis.zip
RUN mkdir /redis &&\
unzip /redis.zip -d /redis
FROM $BASEIMAGE
COPY --from=prep /redis /redis
COPY redis.conf /redis/redis.windows.conf
EXPOSE 6379
VOLUME C:/data
CMD ["/redis/redis-server.exe", "/redis/redis.windows.conf"]

View File

@@ -1,4 +0,0 @@
approvers:
- mkumatag
emeritus_approvers:
- rmmh

View File

@@ -1,3 +0,0 @@
# redis
Image used to run Redis for our guestbook application.

View File

@@ -1 +0,0 @@
5.0.5-3

View File

@@ -1,3 +0,0 @@
bind 0.0.0.0
dir /data
protected-mode no

View File

@@ -202,8 +202,6 @@ const (
Pause
// Perl image
Perl
// Redis image
Redis
// RegressionIssue74839 image
RegressionIssue74839
// ResourceConsumer image
@@ -243,7 +241,6 @@ func initImageConfigs(list RegistryList) (map[ImageID]Config, map[ImageID]Config
// Pause - when these values are updated, also update cmd/kubelet/app/options/container_runtime.go
configs[Pause] = Config{list.GcRegistry, "pause", "3.10.1"}
configs[Perl] = Config{list.PromoterE2eRegistry, "perl", "5.26"}
configs[Redis] = Config{list.PromoterE2eRegistry, "redis", "5.0.5-3"}
configs[RegressionIssue74839] = Config{list.PromoterE2eRegistry, "regression-issue-74839", "1.2"}
configs[ResourceConsumer] = Config{list.PromoterE2eRegistry, "resource-consumer", "1.13"}
configs[VolumeNFSServer] = Config{list.PromoterE2eRegistry, "volume/nfs", "1.4"}