Skip to content

Commit bc818bf

Browse files
Merge branch 'improvement/ZENKO-5196/keep-build-tree-hash' into w/2.14/improvement/ZENKO-5196/keep-build-tree-hash
2 parents 90d69c5 + 73a588e commit bc818bf

File tree

13 files changed

+126
-57
lines changed

13 files changed

+126
-57
lines changed

.github/scripts/end2end/configs/notification_destinations.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ spec:
2929
apiVersion: zenko.io/v1alpha2
3030
kind: ZenkoNotificationTarget
3131
metadata:
32-
name: ${NOTIF_AUTH_DEST_NAME}
32+
name: ${NOTIF_PLAIN_DEST_NAME}
3333
labels:
3434
app.kubernetes.io/instance: ${ZENKO_NAME}
3535
spec:
@@ -41,3 +41,22 @@ spec:
4141
plain:
4242
username: ${NOTIF_AUTH_DEST_USERNAME}
4343
password: ${NOTIF_AUTH_DEST_PASSWORD}
44+
45+
---
46+
47+
apiVersion: zenko.io/v1alpha2
48+
kind: ZenkoNotificationTarget
49+
metadata:
50+
name: ${NOTIF_SCRAM_DEST_NAME}
51+
labels:
52+
app.kubernetes.io/instance: ${ZENKO_NAME}
53+
spec:
54+
type: kafka
55+
host: ${NOTIF_KAFKA_AUTH_HOST}
56+
port: ${NOTIF_KAFKA_SCRAM_PORT}
57+
destinationTopic: ${NOTIF_SCRAM_DEST_TOPIC}
58+
auth: scram
59+
scram:
60+
username: ${NOTIF_SCRAM_DEST_USERNAME}
61+
password: ${NOTIF_SCRAM_DEST_PASSWORD}
62+
mechanism: SHA-512

.github/scripts/end2end/configure-e2e-ctst.sh

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
#!/bin/bash
22
set -exu
33

4+
DIR=$(dirname "$0")
5+
6+
# Get kafka image name and tag
7+
kafka_image() {
8+
source <( "$DIR"/../../../solution/kafka_build_vars.sh )
9+
echo "$KAFKA_IMAGE:$KAFKA_TAG-$BUILD_TREE_HASH"
10+
}
11+
KAFKA_IMAGE=$(kafka_image)
12+
413
# Setup test environment variables
514
export ZENKO_NAME=${1:-"end2end"}
615
# Getting kafka host from backbeat's config
@@ -14,8 +23,9 @@ export NOTIF_KAFKA_PORT=${KAFKA_HOST_PORT#*:}
1423
export NOTIF_KAFKA_AUTH_HOST="${ZENKO_NAME}-base-queue-auth-0"
1524
export NOTIF_KAFKA_AUTH_HOST_PORT="$NOTIF_KAFKA_AUTH_HOST:$NOTIF_KAFKA_PORT"
1625
export NOTIF_KAFKA_AUTH_PORT=9094
26+
export NOTIF_KAFKA_SCRAM_PORT=9095
1727

18-
# Add an extra SASL_PLAIN Kafka listener, to support testing authenticated Kafka for bucket notifications
28+
# Add extra SASL_PLAIN & SASL_SCRAM Kafka listeners, to support testing authenticated Kafka for bucket notifications
1929
kubectl get zookeepercluster "${ZENKO_NAME}-base-quorum" -o json | jq '.
2030
| .metadata |= {namespace, name: "\(.name)-auth" }
2131
| del(.spec.labels)
@@ -30,10 +40,16 @@ kubectl wait --for=jsonpath='{.status.readyReplicas}'=1 --timeout 10m zookeeperc
3040
kubectl get kafkacluster "${ZENKO_NAME}-base-queue" -o json | jq '.
3141
| .metadata |= {namespace, name: "\(.name)-auth" }
3242
| del(.status)
33-
| .spec.listenersConfig.internalListeners |= . + [{containerPort: 9094, name: "auth", type: "sasl_plaintext", usedForInnerBrokerCommunication: false}]
43+
| .spec.listenersConfig.internalListeners |= . + [
44+
{containerPort: 9094, name: "auth", type: "sasl_plaintext", usedForInnerBrokerCommunication: false},
45+
{containerPort: 9095, name: "scram", type: "sasl_plaintext", usedForInnerBrokerCommunication: false}
46+
]
3447
| .spec.readOnlyConfig |= (. + "
35-
sasl.enabled.mechanisms=PLAIN
48+
sasl.enabled.mechanisms=PLAIN,SCRAM-SHA-512
49+
listener.name.auth.sasl.enabled.mechanisms=PLAIN
3650
listener.name.auth.plain.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username=\"'"$NOTIF_AUTH_DEST_USERNAME"'\" password=\"'"$NOTIF_AUTH_DEST_PASSWORD"'\" user_'"$NOTIF_AUTH_DEST_USERNAME"'=\"'"$NOTIF_AUTH_DEST_PASSWORD"'\";
51+
listener.name.scram.sasl.enabled.mechanisms=SCRAM-SHA-512
52+
listener.name.scram.scram-sha-512.sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username=\"'"$NOTIF_SCRAM_DEST_USERNAME"'\" password=\"'"$NOTIF_SCRAM_DEST_PASSWORD"'\" user_'"$NOTIF_SCRAM_DEST_USERNAME"'=\"'"$NOTIF_SCRAM_DEST_PASSWORD"'\";
3753
")
3854
| del(.spec.brokerConfigGroups.default.storageConfigs[].pvcSpec)
3955
| .spec.brokerConfigGroups.default.storageConfigs[].emptyDir |= {medium: "Memory"}
@@ -42,6 +58,19 @@ listener.name.auth.plain.sasl.jaas.config=org.apache.kafka.common.security.plain
4258
' | kubectl apply -f -
4359
kubectl wait --for=jsonpath='{.status.state}'=ClusterRunning --timeout 10m kafkacluster "${ZENKO_NAME}-base-queue-auth"
4460

61+
# Create SCRAM credentials for the SCRAM listener
62+
kubectl run kafka-config \
63+
--image=$KAFKA_IMAGE \
64+
--pod-running-timeout=5m \
65+
--rm \
66+
--restart=Never \
67+
--attach=True \
68+
--command -- bash -c \
69+
"kafka-configs.sh --bootstrap-server $NOTIF_KAFKA_AUTH_HOST_PORT \
70+
--alter --add-config 'SCRAM-SHA-512=[password=$NOTIF_SCRAM_DEST_PASSWORD]' \
71+
--entity-type users \
72+
--entity-name $NOTIF_SCRAM_DEST_USERNAME"
73+
4574
UUID=$(kubectl get secret -l app.kubernetes.io/name=backbeat-config,app.kubernetes.io/instance=end2end \
4675
-o jsonpath='{.items[0].data.config\.json}' | base64 -di | jq .extensions.replication.topic)
4776
UUID=${UUID%.*}
@@ -57,12 +86,6 @@ kubectl wait --for condition=DeploymentInProgress=true --timeout 10m zenko/${ZEN
5786
kubectl wait --for condition=DeploymentFailure=false --timeout 10m zenko/${ZENKO_NAME}
5887
kubectl wait --for condition=DeploymentInProgress=false --timeout 10m zenko/${ZENKO_NAME}
5988

60-
# Get kafka image name and tag
61-
KAFKA_REGISTRY_NAME=$(yq eval ".kafka.sourceRegistry" ../../../solution/deps.yaml)
62-
KAFKA_IMAGE_NAME=$(yq eval ".kafka.image" ../../../solution/deps.yaml)
63-
KAFKA_IMAGE_TAG=$(yq eval ".kafka.tag" ../../../solution/deps.yaml)
64-
KAFKA_IMAGE=$KAFKA_REGISTRY_NAME/$KAFKA_IMAGE_NAME:$KAFKA_IMAGE_TAG
65-
6689
# Cold location topic
6790
AZURE_ARCHIVE_STATUS_TOPIC="${UUID}.cold-status-e2e-azure-archive"
6891
AZURE_ARCHIVE_STATUS_TOPIC_2_NV="${UUID}.cold-status-e2e-azure-archive-2-non-versioned"
@@ -80,6 +103,7 @@ kubectl run kafka-topics \
80103
"kafka-topics.sh --create --topic $NOTIF_DEST_TOPIC --bootstrap-server $KAFKA_HOST_PORT --if-not-exists ; \
81104
kafka-topics.sh --create --topic $NOTIF_ALT_DEST_TOPIC --bootstrap-server $KAFKA_HOST_PORT --if-not-exists ; \
82105
kafka-topics.sh --create --topic $NOTIF_AUTH_DEST_TOPIC --bootstrap-server $NOTIF_KAFKA_AUTH_HOST_PORT --if-not-exists ; \
106+
kafka-topics.sh --create --topic $NOTIF_SCRAM_DEST_TOPIC --bootstrap-server $NOTIF_KAFKA_AUTH_HOST_PORT --if-not-exists ; \
83107
kafka-topics.sh --create --topic $AZURE_ARCHIVE_STATUS_TOPIC --partitions 10 --bootstrap-server $KAFKA_HOST_PORT --if-not-exists ; \
84108
kafka-topics.sh --create --topic $AZURE_ARCHIVE_STATUS_TOPIC_2_NV --partitions 10 --bootstrap-server $KAFKA_HOST_PORT --if-not-exists ; \
85109
kafka-topics.sh --create --topic $AZURE_ARCHIVE_STATUS_TOPIC_2_V --partitions 10 --bootstrap-server $KAFKA_HOST_PORT --if-not-exists ; \

.github/scripts/end2end/configure-e2e.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set -exu
44

5-
. "$(dirname $0)/common.sh"
5+
DIR=$(dirname "${0}")
6+
. "$DIR"/common.sh
67

78
ZENKO_NAME=${1:-end2end}
89
E2E_IMAGE=${2:-ghcr.io/scality/zenko/zenko-e2e:latest}
@@ -48,10 +49,12 @@ roleRef:
4849
apiGroup: rbac.authorization.k8s.io
4950
EOF
5051

51-
KAFKA_REGISTRY_NAME=$(yq eval ".kafka.sourceRegistry" ../../../solution/deps.yaml)
52-
KAFKA_IMAGE_NAME=$(yq eval ".kafka.image" ../../../solution/deps.yaml)
53-
KAFKA_IMAGE_TAG=$(yq eval ".kafka.tag" ../../../solution/deps.yaml)
54-
KAFKA_IMAGE=$KAFKA_REGISTRY_NAME/$KAFKA_IMAGE_NAME:$KAFKA_IMAGE_TAG
52+
kafka_image() {
53+
source <( "$DIR"/../../../solution/kafka_build_vars.sh )
54+
echo "$KAFKA_IMAGE:$KAFKA_TAG-$BUILD_TREE_HASH"
55+
}
56+
57+
KAFKA_IMAGE=$(kafka_image)
5558
KAFKA_HOST_PORT=$(kubectl get secret -l app.kubernetes.io/name=backbeat-config,app.kubernetes.io/instance=end2end \
5659
-o jsonpath='{.items[0].data.config\.json}' | base64 -di | jq .kafka.hosts)
5760
KAFKA_HOST_PORT=${KAFKA_HOST_PORT:1:-1}

.github/scripts/end2end/deploy-zenko.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
set -exu
44

5-
DIR=$(dirname "$0")
5+
DIR="$(dirname "$0")"
6+
REPOSITORY_DIR="${DIR}/../../.."
67

78
export ZENKO_NAME=${1:-end2end}
89
export NAMESPACE=${2:-default}
910
export ZENKO_CR_PATH=${3:-'./configs/zenko.yaml'}
10-
export ZENKOVERSION_PATH=${4:-'../../../solution/zenkoversion.yaml'}
11-
export DEPS_PATH=${5:-'../../../solution/deps.yaml'}
11+
export ZENKOVERSION_PATH=${4:-"${REPOSITORY_DIR}/solution/zenkoversion.yaml"}
12+
export DEPS_PATH=${5:-"${REPOSITORY_DIR}/solution/deps.yaml"}
1213
export ZENKO_VERSION_NAME="${ZENKO_NAME}-version"
1314
export ZENKO_ANNOTATIONS=""
1415
export ZENKO_MONGODB_SECRET_NAME=${ZENKO_MONGODB_SECRET_NAME:-'mongodb-db-creds'}
@@ -79,6 +80,9 @@ function dependencies_config_env()
7980
function dependencies_versions_env()
8081
{
8182
yq eval '.[] | .envsubst + "=" + .tag' ${DEPS_PATH}
83+
84+
source <( "${REPOSITORY_DIR}/solution/kafka_build_vars.sh" )
85+
echo "BUILD_TREE_HASH=${BUILD_TREE_HASH}"
8286
}
8387

8488
function dependencies_env()

.github/scripts/end2end/run-e2e-ctst.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ KAFKA_HOST_PORT=$(kubectl get secret -l app.kubernetes.io/name=backbeat-config,a
6262
KAFKA_HOST_PORT=${KAFKA_HOST_PORT:1:-1}
6363
KAFKA_PORT=${KAFKA_HOST_PORT#*:}
6464

65+
# Subtle: we push to the authenticated Kafka through SASL/PLAIN and SASL/SCRAM,
66+
# as defined in notification_destinations.yaml, but we check the resulting
67+
# notification in the tests through the unauthenticated listener.
68+
# This is why we reuse the base Kafka port here, rather than 9094/9095.
69+
# This variable is used for checking the notifications only.
6570
KAFKA_AUTH_HOST="end2end-base-queue-auth-0"
6671
KAFKA_AUTH_HOST_PORT="$KAFKA_AUTH_HOST:$KAFKA_PORT"
6772

@@ -98,10 +103,10 @@ WORLD_PARAMETERS="$(jq -c <<EOF
98103
"NotificationDestinationTopic":"${NOTIF_DEST_TOPIC}",
99104
"NotificationDestinationAlt":"${NOTIF_ALT_DEST_NAME}",
100105
"NotificationDestinationTopicAlt":"${NOTIF_ALT_DEST_TOPIC}",
101-
"NotificationDestinationAuth":"${NOTIF_AUTH_DEST_NAME}",
102-
"NotificationDestinationTopicAuth":"${NOTIF_AUTH_DEST_TOPIC}",
103-
"NotificationDestinationAuthUsername":"${NOTIF_AUTH_DEST_USERNAME}",
104-
"NotificationDestinationAuthPassword":"${NOTIF_AUTH_DEST_PASSWORD}",
106+
"NotificationDestinationPlain":"${NOTIF_PLAIN_DEST_NAME}",
107+
"NotificationDestinationTopicPlain":"${NOTIF_AUTH_DEST_TOPIC}",
108+
"NotificationDestinationScram":"${NOTIF_SCRAM_DEST_NAME}",
109+
"NotificationDestinationTopicScram":"${NOTIF_SCRAM_DEST_TOPIC}",
105110
"KafkaExternalIps": "${KAFKA_EXTERNAL_IP:-}",
106111
"PrometheusService":"${PROMETHEUS_NAME}-operated.default.svc.cluster.local",
107112
"KafkaHosts":"${KAFKA_HOST_PORT}",

.github/workflows/end2end.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,14 @@ env:
9595
NOTIF_DEST_TOPIC: "destination-topic-1"
9696
NOTIF_ALT_DEST_NAME: "destination2"
9797
NOTIF_ALT_DEST_TOPIC: "destination-topic-2"
98-
NOTIF_AUTH_DEST_NAME: "destination3"
98+
NOTIF_PLAIN_DEST_NAME: "destination3"
9999
NOTIF_AUTH_DEST_TOPIC: "destination-topic-3"
100100
NOTIF_AUTH_DEST_USERNAME: "admin"
101101
NOTIF_AUTH_DEST_PASSWORD: "admin-secret"
102+
NOTIF_SCRAM_DEST_NAME: "destination4"
103+
NOTIF_SCRAM_DEST_TOPIC: "destination-topic-4"
104+
NOTIF_SCRAM_DEST_USERNAME: "admin"
105+
NOTIF_SCRAM_DEST_PASSWORD: "admin-secret"
102106
SUBDOMAIN: "zenko.local"
103107
DR_SUBDOMAIN: "dr.zenko.local"
104108
SKOPEO_PATH: "/tmp"

solution/build.sh

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ EOF
6767

6868
function flatten_source_images()
6969
{
70-
yq eval '.* | (.sourceRegistry // "docker.io") + "/" + .image + ":" + .tag' deps.yaml
70+
source <( ${REPOSITORY_DIR}/solution/kafka_build_vars.sh )
71+
72+
yq eval '.* | (.sourceRegistry // "docker.io") + "/" + .image + ":" + .tag' deps.yaml |
73+
sed '/ghcr.io\/scality\/zenko\/kafka/ s/$/-'"${BUILD_TREE_HASH}"'/'
7174
}
7275

7376
function zenko_operator_tag()
@@ -319,31 +322,12 @@ function download_tools()
319322
done
320323
}
321324

322-
function retag()
323-
{
324-
local image=$1
325-
local tag=$2
326-
local suffix=$3
327-
${DOCKER} image inspect "${image}:${tag}-${suffix}" > /dev/null 2>&1 || \
328-
${DOCKER} ${DOCKER_OPTS} pull "${image}:${tag}-${suffix}"
329-
${DOCKER} tag "${image}:${tag}-${suffix}" "${image}:${tag}"
330-
}
331-
332-
function prepare_kafka_images()
333-
(
334-
source <( ${REPOSITORY_DIR}/solution/kafka_build_vars.sh )
335-
336-
retag "$KAFKA_IMAGE" "$KAFKA_TAG" "$BUILD_TREE_HASH"
337-
retag "$KAFKA_CONNECT_IMAGE" "$KAFKA_CONNECT_TAG" "$BUILD_TREE_HASH"
338-
)
339-
340325
# run everything in order
341326
clean
342327
mkdirs
343328
download_tools
344329
gen_manifest_yaml
345330
copy_yamls
346-
prepare_kafka_images
347331
flatten_source_images | while read img ; do
348332
# only pull if the image isnt already local
349333
${DOCKER} image inspect ${img} > /dev/null 2>&1 || ${DOCKER} ${DOCKER_OPTS} pull ${img}

solution/deps.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ vault:
130130
zenko-operator:
131131
sourceRegistry: ghcr.io/scality
132132
image: zenko-operator
133-
tag: v1.8.2
133+
tag: v1.8.3
134134
envsubst: ZENKO_OPERATOR_TAG
135135
zookeeper:
136-
sourceRegistry: pravega
136+
sourceRegistry: ghcr.io/adobe/zookeeper-operator
137137
image: zookeeper
138-
tag: 0.2.15
138+
tag: 3.8.4-0.2.15-adobe-20250923
139139
envsubst: ZOOKEEPER_TAG

solution/kafka/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RUN tar -xzf $kafka_distro
2222
RUN rm -r kafka_$scala_version-$kafka_version/bin/windows
2323

2424
####################################################################################################
25-
FROM eclipse-temurin:17.0.3_7-jre
25+
FROM eclipse-temurin:17.0.18_8-jre
2626

2727
ARG scala_version=2.13
2828
ARG kafka_version=3.1.0

solution/zenkoversion.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ spec:
9696
tag: ${KAFKA_CLEANER_TAG}
9797
cluster:
9898
image: ${KAFKA_IMAGE}
99-
tag: ${KAFKA_TAG}
99+
tag: ${KAFKA_TAG}-${KAFKA_BUILD_TREE_HASH}
100100
connect:
101101
image: ${KAFKA_CONNECT_IMAGE}
102-
tag: ${KAFKA_CONNECT_TAG}
102+
tag: ${KAFKA_CONNECT_TAG}-${KAFKA_BUILD_TREE_HASH}
103103
cruiseControl:
104104
image: ${KAFKA_CRUISECONTROL_IMAGE}
105105
tag: ${KAFKA_CRUISECONTROL_TAG}

0 commit comments

Comments
 (0)