Skip to content

Commit

Permalink
Run ArgoCD on GHA
Browse files Browse the repository at this point in the history
Add ciux config for development
Install olm/argocd on gha
Bump ciux to v0.0.1-rc12
Bump ktbx to v1.1.1-rc9 in CI
Sync strimzi first
Rename minio ns in CI
Create spark namespace
  • Loading branch information
fjammes committed Jan 8, 2024
1 parent fc3ab61 commit cddb966
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 36 deletions.
13 changes: 12 additions & 1 deletion .ciux
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,28 @@ dependencies:
# If true, container image will be pulled
pull: true
labels:
dev: "true"
itest: "true"
ci: "true"
- url: https://github.com/astrolabsoftware/finkctl
clone: true
labels:
dev: "true"
itest: "true"
ci: "true"
- url: https://github.com/astrolabsoftware/fink-cd
labels:
dev: "true"
itest: "true"
ci: "true"
- url: https://github.com/k8s-school/ktbx
clone: true
labels:
dev: "true"
- image: gitlab-registry.in2p3.fr/astrolabsoftware/fink/spark-py:k8s-3.4.1
labels:
build: "true"
- package: github.com/k8s-school/[email protected]rc7
- package: github.com/k8s-school/[email protected]rc9
labels:
itest: "optional"
ci: "true"
Expand Down
34 changes: 14 additions & 20 deletions .github/workflows/itest-gha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master
env:
CIUXCONFIG: /tmp/ciux.sh
CIUX_VERSION: v0.0.1-rc11
CIUX_VERSION: v0.0.1-rc12
GHA_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
NOSCIENCE: true
MINIMAL: true
Expand Down Expand Up @@ -57,21 +57,18 @@ jobs:
- name: Ciux project ignition
run: |
ciux ignite --selector ci --branch="$GHA_BRANCH_NAME" $PWD
- name: Create k8s/kind cluster
- name: Create k8s (kind) cluster
run: |
ktbx install kind
ktbx install kubectl
ktbx create -s
- name: Load fink-alert-simulator image inside kind
- name: Install olm and argocd operators
run: |
. "$CIUXCONFIG"
. "$FINK_ALERT_SIMULATOR_DIR"/conf.sh
if docker exec -t -- kind-control-plane crictl pull "$IMAGE"; then
echo "::notice Succeeded to pull $IMAGE"
else
echo "::error Failed to pull $IMAGE"
exit 1
fi
ktbx install olm
ktbx install argocd
- name: Run argoCD
run: |
./itest/argocd.sh
- name: Download image
uses: actions/download-artifact@v3
with:
Expand All @@ -81,25 +78,22 @@ jobs:
run: |
kind load image-archive artifacts/image.tar
docker exec -- kind-control-plane crictl image
- name: Install fink-alert-simulator pre-requisites (argoCD)
- name: Install fink-alert-simulator pre-requisites (argo-workflows)
run: |
. "$CIUXCONFIG"
. "$FINK_ALERT_SIMULATOR_DIR"/prereq-install.sh
- name: Install strimzi (kafka-operator)
run: ./itest/strimzi-install.sh
- name: Setup kafka
run: ./itest/strimzi-setup.sh
- name: Install fink-broker pre-requisites (Spark)
run: ./itest/prereq-install.sh
- name: Install MinIO
run: ./itest/minio-install.sh
- name: Run fink-alert-simulator
run: |
. "$CIUXCONFIG"
"$FINK_ALERT_SIMULATOR_DIR"/argo-submit.sh
argo watch @latest
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Install fink-broker pre-requisites (JDK, Spark)
run: |
sudo apt-get -y update
sudo apt-get -y install openjdk-8-jdk-headless
./itest/prereq-install.sh
- name: Run fink-broker
run: |
./itest/fink-start.sh
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/itest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
required: true
env:
CIUXCONFIG: /tmp/ciux.sh
CIUX_VERSION: v0.0.1-rc11
CIUX_VERSION: v0.0.1-rc12
GHA_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
MINIMAL: ${{ inputs.minimal }}
NOSCIENCE: ${{ inputs.noscience }}
Expand Down Expand Up @@ -95,7 +95,8 @@ jobs:
EOF
- name: Create k8s/kind cluster
run: |
ktbx install kind
echo "Installing kind in version v0.15.0 because kind latest version is not supported by self-hosted runners"
ktbx install kind --kind-version="v0.15.0"
ktbx install kubectl
kind version
kubectl version --client
Expand Down Expand Up @@ -127,7 +128,7 @@ jobs:
run: ./itest/strimzi-install.sh
- name: Setup kafka
run: ./itest/strimzi-setup.sh
- name: Install fink-broker pre-requisites (Spark)
- name: Install fink-broker pre-requisites (JDK, Spark)
run: |
sudo apt-get -y update
sudo apt-get -y install openjdk-8-jdk-headless
Expand Down
4 changes: 2 additions & 2 deletions TODO.org
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Tu crois qu'on pourrais pré-créer les topic pour éviter ce problème
* TODO Enable authZ in kafka (require authN setup in fink-alert-simulator)
* TODO [#B] distribute should wait for data to appear instead of crashing in connect_to_raw_database()
* TODO move nodeport to internal for svc kafka-cluster-kafka-external-bootstrap
* TODO improve final test in CI (check Kafka with fink-client https://github.com/astrolabsoftware/fink-client)
* DONE improve final test in CI (check Kafka with fink-client https://github.com/astrolabsoftware/fink-client)
* TODO run code-check.sh in CI
* DONE add unit test for schema_converter
* TODO https://stackoverflow.com/questions/30385981/how-to-access-s3a-files-from-apache-spark
Expand All @@ -41,7 +41,7 @@ cf. Julien are they required?
5 curl https://dl.min.io/client/mc/release/linux-amd64/mc --create-dirs -o $HOME/minio-binaries/mc
6 chmod +x $HOME/minio-binaries/mc
15 export PATH=$PATH:$HOME/minio-binaries/
17 mc alias set s3 http://minio.minio-dev:9000 minioadmin minioadmin
17 mc alias set s3 http://minio.minio:9000 minioadmin minioadmin
19 mc ls s3
27 mc mb s3/fink-broker-online
mc ls f1 --recursive fink-broker-online/
Expand Down
51 changes: 51 additions & 0 deletions itest/argocd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

# Install fink-broker stack (kafka+minio)
# Based on https://min.io/docs/minio/kubernetes/upstream/index.html

# @author Fabrice Jammes

set -euxo pipefail

. $CIUXCONFIG

function retry {
local n=1
local max=5
local delay=5
while true; do
"$@" && break || {
if [[ $n -lt $max ]]; then
((n++))
echo "Command failed. Attempt $n/$max:"
sleep $delay;
else
echo "The command has failed after $n attempts." >&2
exit 1
fi
}
done
}


NS=argocd

argocd login --core
kubectl config set-context --current --namespace="$NS"

# Create fink app
argocd app create fink --dest-server https://kubernetes.default.svc \
--dest-namespace "$NS" \
--repo https://github.com/astrolabsoftware/fink-cd.git \
--path apps --revision "$FINK_CD_WORKBRANCH" \

# Sync fink app-of-apps
argocd app sync fink

# Synk fink apps
argocd app sync strimzi
# TODO Try to make it simpler, try a sync-wave on Strimzi Application?
# see https://github.com/argoproj/argo-cd/discussions/16729
# and https://stackoverflow.com/questions/77750481/argocd-app-of-apps-ensuring-strimzi-child-app-health-before-kafka-app-sync
retry kubectl wait --for condition=established --timeout=60s crd/kafkas.kafka.strimzi.io crd/kafkatopics.kafka.strimzi.io
argocd app sync -l app.kubernetes.io/instance=fink
9 changes: 8 additions & 1 deletion itest/fink-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ DIR=$(cd "$(dirname "$0")"; pwd -P)

echo $IMAGE

NS=spark
echo "Create $NS namespace"
kubectl create namespace "$NS" --dry-run=client -o yaml | kubectl apply -f -
kubectl config set-context --current --namespace="$NS"

echo "Create S3 bucket"
kubectl port-forward -n minio-dev svc/minio 9000 &
kubectl port-forward -n minio svc/minio 9000 &
# Wait to port-forward to start
sleep 2
export FINKCONFIG="$DIR"
finkctl --endpoint=localhost:9000 s3 makebucket

Expand Down
2 changes: 1 addition & 1 deletion itest/finkctl.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
s3:
endpoint: http://minio.minio-dev:9000
endpoint: http://minio.minio:9000
use_ssl: "false"
bucket: fink-broker-online
# General parameter used to run fink tasks
Expand Down
12 changes: 6 additions & 6 deletions itest/manifests/minio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
apiVersion: v1
kind: Namespace
metadata:
name: minio-dev
name: minio
---
apiVersion: v1
kind: Service
metadata:
name: minio
namespace: minio-dev
namespace: minio
spec:
selector:
app.kubernetes.io/name: minio
Expand All @@ -19,8 +19,8 @@ spec:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minio-dev
namespace: minio-dev
name: minio
namespace: minio
spec:
accessModes:
- ReadWriteOnce
Expand All @@ -34,7 +34,7 @@ metadata:
labels:
app.kubernetes.io/name: minio
name: minio
namespace: minio-dev
namespace: minio
spec:
replicas: 1
selector:
Expand All @@ -59,4 +59,4 @@ spec:
volumes:
- name: data
persistentVolumeClaim:
claimName: minio-dev
claimName: minio
4 changes: 2 additions & 2 deletions itest/minio-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -euxo pipefail

DIR=$(cd "$(dirname "$0")"; pwd -P)

NS="minio-dev"
NS="minio"

if kubectl apply -f $DIR/manifests/minio.yaml
then
Expand All @@ -19,4 +19,4 @@ else
exit 1
fi

kubectl rollout status deployment minio -n "$NS" --timeout=90s
kubectl rollout status deployment minio -n "$NS" --timeout=90s

0 comments on commit cddb966

Please sign in to comment.