Skip to content

Fix autopilot deployment by removing the metrics-addr workaround #2122

Fix autopilot deployment by removing the metrics-addr workaround

Fix autopilot deployment by removing the metrics-addr workaround #2122

name: Splunk Platform Functional Test
on:
pull_request:
jobs:
functional-test:
name: Kubernetes ${{ matrix.kubernetes_version }} ${{ matrix.container_runtime }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
# The kubernetes_version matrix entries are currently following native Kubernetes version support and +1, see: https://endoflife.date/kubernetes
# To check latest versions, see: https://hub.docker.com/r/kindest/node/tags
# TODO: Automate updating this and expand/contract matrix coverage for other Kubernetes distributions
kubernetes_version:
- v1.29.0 # Support: 28 Dec 2024 - 28 Feb 2025
- v1.28.4 # Support: 28 Aug 2024 - 28 Oct 2024
- v1.27.8 # Support: 28 Apr 2024 - 28 Jun 2024
- v1.26.11 # Support: 28 Dec 2023 - 28 Feb 2024
- v1.25.16 # Support: 27 Aug 2023 - 27 Oct 2023
container_runtime:
- "docker"
- "containerd"
- "cri-o"
env:
CI_SPLUNK_PORT: 8089
CI_SPLUNK_USERNAME: admin
CI_SPLUNK_HEC_TOKEN: "00000000-0000-0000-0000-0000000000000"
CI_SPLUNK_PASSWORD: helloworld
CI_INDEX_EVENTS: ci_events
CI_INDEX_METRICS: ci_metrics
CONTAINER_RUNTIME: ${{ matrix.container_runtime }}
KUBERNETES_VERSION: ${{ matrix.kubernetes_version }}
MINIKUBE_VERSION: latest
steps:
- name: Checkout
uses: actions/checkout@v4
# # Leave this here for debugging
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
- name: Setup Minikube
run: |
# Install Kubectl
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
mkdir -p ${HOME}/.kube
touch ${HOME}/.kube/config
# Install Minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64
chmod +x minikube
sudo mv minikube /usr/local/bin/
sudo sysctl fs.protected_regular=0
# Start Minikube and Wait
minikube start --container-runtime=${CONTAINER_RUNTIME} --cpus 2 --memory 4096 --kubernetes-version=${KUBERNETES_VERSION} --no-vtx-check
export JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do
sleep 1;
done
echo "Kubernetes $(kubectl version --short | grep -E 'Client|Server')" && echo "Container Runtime for Node: $(kubectl get node -o=jsonpath='{.items[0].metadata.name}'): $(kubectl get node -o=jsonpath='{.items[0].status.nodeInfo.containerRuntimeVersion}')"
- name: Install Splunk
run: |
# Wait until default service account is created
until kubectl -n default get serviceaccount default -o name; do
sleep 1;
done
# Install Splunk on minikube
kubectl apply -f ci_scripts/k8s-splunk.yml
# Wait until splunk is ready
until kubectl logs splunk --tail=2 | grep -q 'Ansible playbook complete'; do
sleep 1;
done
- name: Deploy splunk-otel-collector chart
run: |
make dep-update
export CI_SPLUNK_HOST=$(kubectl get pod splunk --template={{.status.podIP}})
ci_scripts/deploy_collector.sh
- name: Deploy log generator
run: |
kubectl apply -f test/test_setup.yaml
sleep 60
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Run functional tests
run: |
kubectl get nodes
export PYTHONWARNINGS="ignore:Unverified HTTPS request"
export CI_SPLUNK_HOST=$(kubectl get pod splunk --template={{.status.podIP}})
cd test
pip install --upgrade pip
pip install -r requirements.txt
echo "Running functional tests....."
python -m pytest \
--splunkd-url https://$CI_SPLUNK_HOST:8089 \
--splunk-user admin \
--splunk-password $CI_SPLUNK_PASSWORD \
-p no:warnings -s
# # Leave this here for debugging
# sleep 180
# echo "Getting agent logs....."
# kubectl get pods -l release=ci-sck --no-headers=true | awk '/agent/{print $1}' | xargs kubectl logs
# echo "Getting collector logs....."
# kubectl get pods -l release=ci-sck --no-headers=true | awk '/cluster/{print $1}' | xargs kubectl logs
- name: Print splunk-otel-collector logs
if: always()
run: |
# Echo logs for the collector (agent,cluster-receiver,gateway) for visibility
pods=$(kubectl get pods -l app=splunk-otel-collector -o jsonpath='{.items[*].metadata.name}')
for pod in $pods; do
echo "Logs for $pod:"
kubectl logs $pod | head -n 2000
done