...

Text file src/edge-infra.dev/hack/observability/fluent-operator/test-filters.sh

Documentation: edge-infra.dev/hack/observability/fluent-operator

     1#!/usr/bin/env bash
     2
     3# test-filters.sh looks for "-test.yaml" fluent-operator Filter resources and applies 
     4# them to a cluster. These filters use the fluent-bit "Expect" filter to test out parts of 
     5# the logging pipeline. See https://docs.fluentbit.io/manual/local-testing/validating-your-data-and-structure
     6# The filters are configured to exit the fluent-bit process if they detect an error which will cause 
     7# fluent-bit to go into a CrashloopBackoff state.
     8
     9SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
    10# shellcheck disable=SC1091
    11if ! source "${SCRIPT_DIR}/common.sh"; then
    12  echo "Error: failed to source common.sh"
    13  exit 1
    14fi
    15
    16env | grep -E "CLUSTER_|GCP"
    17
    18verify_environment
    19
    20# find all the -test.yaml fluent-bit filters and apply them to the cluster
    21fb_dir1="config/pallets/o11y/fluentbit"
    22fb_dir2="config/pallets/o11y/fluentbit-restrictions"
    23
    24echo -e "${MAG}Looking for test filters${NC}"
    25declare -a filePaths
    26while IFS= read -r line; do 
    27  filePaths+=("$line")
    28done < <(find "$fb_dir1" "$fb_dir2" -type f -name "*-test.yaml")
    29
    30for path in "${filePaths[@]}"; do 
    31  kubectl apply -f "$path"
    32done
    33
    34echo -e "${MAG}kubectl get cfbf${NC}"
    35kubectl get cfbf

View as plain text