Skip to content

Commit 6fc4cf6

Browse files
Fix corrupted splunk-operator-3.0.0.tgz and add validation
The splunk-operator-3.0.0.tgz file was corrupted - it contained the full splunk-enterprise chart (4.5MB) instead of just the operator chart (5.8KB). This caused Helm to load a stale splunk-enterprise as a subchart, leading to template rendering errors: Error: INSTALLATION FAILED: template: splunk-enterprise/charts/ splunk-enterprise/templates/enterprise_v4_ingestorcluster.yaml:1:14: executing "splunk-enterprise/charts/splunk-enterprise/templates/ enterprise_v4_ingestorcluster.yaml" at <.Values.ingestorCluster.enabled>: nil pointer evaluating interface {}.enabled Root cause: The file was replaced with a packaged splunk-enterprise chart in multiple "Restore helm chart version 3.0.0" commits (see b9766dd and related commits in git history). Fix: - Restored correct splunk-operator-3.0.0.tgz from commit a3737ba (5.8KB) - File now contains only splunk-operator chart content, not splunk-enterprise Validation: - helm lint passes on both splunk-operator and splunk-enterprise charts - helm template successfully renders c3 deployment without errors - Added tools/validate-helm-charts.sh script to detect future corruption The validation script checks: - tgz files start with "splunk-operator/" directory (not "splunk-enterprise/") - Files don't contain splunk-enterprise/Chart.yaml content - File sizes are reasonable (detects 4.5MB corruption vs expected 5-400KB) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 94f9121 commit 6fc4cf6

2 files changed

Lines changed: 96 additions & 0 deletions

File tree

-4.54 MB
Binary file not shown.

tools/validate-helm-charts.sh

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/bin/bash
2+
# Validation script for Helm chart tgz files
3+
# This script ensures that splunk-operator chart tgz files contain only the operator chart,
4+
# not the full splunk-enterprise chart (which would cause Helm to load a stale subchart).
5+
6+
set -e
7+
8+
RED='\033[0;31m'
9+
GREEN='\033[0;32m'
10+
YELLOW='\033[1;33m'
11+
NC='\033[0m' # No Color
12+
13+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
14+
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
15+
CHARTS_DIR="${REPO_ROOT}/helm-chart/splunk-enterprise/charts"
16+
17+
echo "Validating Helm chart tgz files in ${CHARTS_DIR}"
18+
echo ""
19+
20+
EXIT_CODE=0
21+
22+
# Expected size ranges for operator charts (in KB)
23+
MIN_OPERATOR_SIZE_KB=5 # 3.x charts are ~6-7KB (no CRDs)
24+
MAX_OPERATOR_SIZE_2X_KB=450 # 2.x charts are ~400-430KB (with CRDs)
25+
MAX_OPERATOR_SIZE_3X_KB=10 # 3.x charts should be under 10KB
26+
27+
for TGZ_FILE in "${CHARTS_DIR}"/splunk-operator-*.tgz; do
28+
if [ ! -f "${TGZ_FILE}" ]; then
29+
continue
30+
fi
31+
32+
FILENAME=$(basename "${TGZ_FILE}")
33+
VERSION=$(echo "${FILENAME}" | sed 's/splunk-operator-\(.*\)\.tgz/\1/')
34+
35+
# Get file size in KB
36+
SIZE_BYTES=$(stat -f%z "${TGZ_FILE}" 2>/dev/null || stat -c%s "${TGZ_FILE}" 2>/dev/null)
37+
SIZE_KB=$((SIZE_BYTES / 1024))
38+
39+
echo "Checking ${FILENAME} (${SIZE_KB}KB)..."
40+
41+
# Check contents
42+
FIRST_DIR=$(tar -tzf "${TGZ_FILE}" | head -1 | cut -d'/' -f1)
43+
44+
if [ "${FIRST_DIR}" != "splunk-operator" ]; then
45+
echo -e "${RED}ERROR: ${FILENAME} does not start with 'splunk-operator/' directory${NC}"
46+
echo " Expected: splunk-operator/..."
47+
echo " Got: ${FIRST_DIR}/..."
48+
EXIT_CODE=1
49+
continue
50+
fi
51+
52+
# Check for splunk-enterprise content (should NOT be present)
53+
if tar -tzf "${TGZ_FILE}" | grep -q "splunk-enterprise/Chart.yaml"; then
54+
echo -e "${RED}ERROR: ${FILENAME} contains splunk-enterprise chart content${NC}"
55+
echo " This file appears to be a full splunk-enterprise chart package instead of just the operator chart."
56+
echo " Expected: Only splunk-operator chart files"
57+
echo " Found: splunk-enterprise/Chart.yaml (and likely other splunk-enterprise files)"
58+
EXIT_CODE=1
59+
continue
60+
fi
61+
62+
# Check size is reasonable based on version
63+
MAJOR_VERSION=$(echo "${VERSION}" | cut -d'.' -f1)
64+
65+
if [ "${MAJOR_VERSION}" = "3" ]; then
66+
# 3.x charts removed CRDs, should be small
67+
if [ ${SIZE_KB} -gt ${MAX_OPERATOR_SIZE_3X_KB} ]; then
68+
echo -e "${YELLOW}WARNING: ${FILENAME} is larger than expected for 3.x (${SIZE_KB}KB > ${MAX_OPERATOR_SIZE_3X_KB}KB)${NC}"
69+
echo " 3.x operator charts should not include CRDs and should be under 10KB"
70+
fi
71+
elif [ "${MAJOR_VERSION}" = "2" ]; then
72+
# 2.x charts included CRDs, larger but still not huge
73+
if [ ${SIZE_KB} -gt ${MAX_OPERATOR_SIZE_2X_KB} ]; then
74+
echo -e "${YELLOW}WARNING: ${FILENAME} is larger than expected for 2.x (${SIZE_KB}KB > ${MAX_OPERATOR_SIZE_2X_KB}KB)${NC}"
75+
fi
76+
fi
77+
78+
# Size sanity check - anything over 1MB is definitely wrong (4.5MB was the corrupted file)
79+
if [ ${SIZE_KB} -gt 1024 ]; then
80+
echo -e "${RED}ERROR: ${FILENAME} is suspiciously large (${SIZE_KB}KB)${NC}"
81+
echo " This likely contains the full splunk-enterprise chart instead of just the operator chart"
82+
EXIT_CODE=1
83+
continue
84+
fi
85+
86+
echo -e "${GREEN}${FILENAME} validated successfully${NC}"
87+
echo ""
88+
done
89+
90+
if [ ${EXIT_CODE} -eq 0 ]; then
91+
echo -e "${GREEN}All Helm chart tgz files validated successfully!${NC}"
92+
else
93+
echo -e "${RED}Validation failed! Please fix the issues above.${NC}"
94+
fi
95+
96+
exit ${EXIT_CODE}

0 commit comments

Comments
 (0)