Skip to content

Commit

Permalink
Precreate DR kafka volume
Browse files Browse the repository at this point in the history
To ensure it ends up on first node, pre-create it.

Issue: ZENKO-4856
  • Loading branch information
francoisferrand committed Aug 15, 2024
1 parent c57b8a9 commit 244d989
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
47 changes: 40 additions & 7 deletions .github/scripts/end2end/prepare-pra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export MONGODB_PRA_DATABASE="${MONGODB_PRA_DATABASE:-'pradb'}"
export ZENKO_MONGODB_DATABASE="${MONGODB_PRA_DATABASE}"
export ZENKO_MONGODB_SECRET_NAME="mongodb-db-creds-pra"

echo 'ZENKO_MONGODB_DATABASE="pradb"' >> $GITHUB_ENV
echo 'ZENKO_MONGODB_SECRET_NAME="mongodb-db-creds-pra"' >> $GITHUB_ENV
echo 'ZENKO_MONGODB_DATABASE="pradb"' >> "$GITHUB_ENV"
echo 'ZENKO_MONGODB_SECRET_NAME="mongodb-db-creds-pra"' >> "$GITHUB_ENV"

echo 'ZENKO_IAM_INGRESS="iam.dr.zenko.local"' >> $GITHUB_ENV
echo 'ZENKO_STS_INGRESS="sts.dr.zenko.local"' >> $GITHUB_ENV
echo 'ZENKO_MANAGEMENT_INGRESS="management.dr.zenko.local"' >> $GITHUB_ENV
echo 'ZENKO_S3_INGRESS="s3.dr.zenko.local"' >> $GITHUB_ENV
echo 'ZENKO_UI_INGRESS="ui.dr.zenko.local"' >> $GITHUB_ENV
echo 'ZENKO_IAM_INGRESS="iam.dr.zenko.local"' >> "$GITHUB_ENV"
echo 'ZENKO_STS_INGRESS="sts.dr.zenko.local"' >> "$GITHUB_ENV"
echo 'ZENKO_MANAGEMENT_INGRESS="management.dr.zenko.local"' >> "$GITHUB_ENV"
echo 'ZENKO_S3_INGRESS="s3.dr.zenko.local"' >> "$GITHUB_ENV"
echo 'ZENKO_UI_INGRESS="ui.dr.zenko.local"' >> "$GITHUB_ENV"

MONGODB_ROOT_USERNAME="${MONGODB_ROOT_USERNAME:-'root'}"
MONGODB_ROOT_PASSWORD="${MONGODB_ROOT_PASSWORD:-'rootpass'}"
Expand All @@ -36,3 +36,36 @@ stringData:
mongodb-password: $MONGODB_PRA_PASSWORD
mongodb-database: $MONGODB_PRA_DATABASE
EOF

# Pre-create volume, to ensure it ends up on first node (dev-worker)
KAFKA_NODE="${CLUSTER_NAME:-kind}-worker"
kubectl -n ${PRA_NAMESPACE} apply -f - <<EOF
apiVersion: v1
kind: PersistentVolume
metadata:
name: zenko-dr-kafka-broker0
labels:
brokerId: '0'
app: kafka-dr-sink
spec:
persistentVolumeReclaimPolicy: Delete
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /data/kafka-dr-broker0
type: DirectoryOrCreate
storageClassName: ""
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- "${KAFKA_NODE}"
EOF

KAFKA_EXTERNAL_IP=$(kubectl get node "${KAFKA_NODE}" -o yaml | yq '.status.addresses.[] | select(.type == "InternalIP") | .address')
echo "KAFKA_EXTERNAL_IP=${KAFKA_EXTERNAL_IP}" >> "$GITHUB_ENV"
1 change: 1 addition & 0 deletions .github/scripts/end2end/run-e2e-ctst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ WORLD_PARAMETERS="$(jq -c <<EOF
"NotificationDestinationTopic":"${NOTIF_DEST_TOPIC}",
"NotificationDestinationAlt":"${NOTIF_ALT_DEST_NAME}",
"NotificationDestinationTopicAlt":"${NOTIF_ALT_DEST_TOPIC}",
"KafkaExternalIPs": "${KAFKA_EXTERNAL_IP:-}",
"KafkaHosts":"${KAFKA_HOST_PORT}",
"KeycloakPassword":"${KEYCLOAK_TEST_PASSWORD}",
"KeycloakHost":"${KEYCLOAK_TEST_HOST}",
Expand Down
4 changes: 3 additions & 1 deletion tests/ctst/steps/dr/drctl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ type InstallConfig = {
sinkKafkaReplicas?: number;
sinkConnectorReplicas?: number;
kafkaClusterLocation?: string;
kafkaNodePortStartingPort?: number;
kafkaExternalIps?: string;
kafkaExternalIpsDiscovery?: boolean;
kafkaExternalPort?: number;
kafkaPersistenceExistingPv?: string;
kafkaPersistenceSize?: string;
kafkaPersistenceStorageClassName?: string;
Expand Down
5 changes: 4 additions & 1 deletion tests/ctst/steps/pra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ async function installPRA(world: Zenko, sinkS3Endpoint = 'http://s3.zenko.local'
sourceZenkoDrInstance: 'end2end-source',
sinkZenkoDrInstance: 'end2end-pra-sink',
kafkaPersistenceSize: '1Gi',
kafkaPersistenceStorageClassName: 'standard',
kafkaPersistenceStorageClassName: '-',
kafkaPersistenceSelector: 'brokerId=0,app=kafka-dr-sink',
kafkaExternalIps: world.parameters.KafkaExternalIps,
kafkaExternalIpsDiscovery: !world.parameters.KafkaExternalIps,
locations: 'e2e-cold', // comma-separated list
s3Bucket: 'dump-db',
sinkZenkoInstance: 'end2end-pra',
Expand Down
1 change: 1 addition & 0 deletions tests/ctst/world/Zenko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface ZenkoWorldParameters extends ClientOptions {
NotificationDestinationTopic: string;
NotificationDestinationAlt: string;
NotificationDestinationTopicAlt: string;
KafkaExternalIps: string;
KafkaHosts: string;
KeycloakUsername: string;
KeycloakPassword: string;
Expand Down

0 comments on commit 244d989

Please sign in to comment.