Skip to content

Commit 96546b0

Browse files
feat: Refactor helm chart (#37)
1 parent 1ed2ac1 commit 96546b0

49 files changed

Lines changed: 2846 additions & 1414 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copilot Instructions — helm-steampipe
2+
3+
## Build, Lint, and Test
4+
5+
```bash
6+
# Lint the chart
7+
helm lint charts/steampipe/
8+
9+
# Lint with chart-testing (uses .github/ct.yaml config)
10+
ct lint --config .github/ct.yaml
11+
12+
# Dry-run install (validates templates render without a cluster)
13+
helm install steampipe charts/steampipe/ --dry-run --debug
14+
15+
# Dry-run a specific CI values file (there are 5 in charts/steampipe/ci/)
16+
helm install steampipe charts/steampipe/ --dry-run --debug -f charts/steampipe/ci/values-bbdd.yaml
17+
18+
# Run helm-unittest tests
19+
helm unittest charts/steampipe/
20+
21+
# Regenerate charts/steampipe/README.md from the .gotmpl template
22+
helm-docs --chart-search-root=charts/steampipe
23+
24+
# Run pre-commit hooks (helmlint + helm-docs + markdown-toc + whitespace)
25+
pre-commit run --all-files
26+
```
27+
28+
Unit tests live in `charts/steampipe/tests/*_test.yaml`. Run `helm unittest charts/steampipe/` to execute them. Validation is also done via `helm lint`, `ct lint`, and dry-run installs against the CI values files.
29+
30+
## Architecture
31+
32+
This is a **single Helm chart** (`charts/steampipe/`) that deploys Steampipe as a persistent PostgreSQL-compatible service on Kubernetes (port 9193). There are no optional companion components (Powerpipe and oauth2-proxy were removed in v4.0.0 and are separate charts).
33+
34+
### Pod lifecycle
35+
36+
1. **Init container** installs plugins declared in `initContainer.plugins[]` via a ConfigMap-mounted shell script (`configmap-init-scripts.yaml`). Plugins live in an `emptyDir` — reinstalled on every pod start. **The init container uses the same image as the main container** — no separate image.
37+
2. **Main container** runs `steampipe service start` with `--foreground` and optional `--database-listen`/`--database-port` flags.
38+
3. **Service** (`<fullname>-psql`) is only created when `bbdd.enabled: true`.
39+
40+
### Steampipe v2 constraints
41+
42+
- Steampipe runs as UID 9193, GID 0 (OpenShift compatible).
43+
- Image: `ghcr.io/devops-ia/steampipe` (not `ghcr.io/turbot/steampipe`).
44+
- `appVersion` is bumped automatically by updatecli (`.github/updatecli/helm-appversion.yaml`) monitoring `devops-ia/steampipe` releases.
45+
46+
## Key Conventions
47+
48+
- **Commit messages** follow [Conventional Commits](https://www.conventionalcommits.org/). Releases are cut by semantic-release via `package.json`.
49+
- **Chart README** (`charts/steampipe/README.md`) is **auto-generated** — never edit it directly. Edit `charts/steampipe/README.md.gotmpl` instead and run `helm-docs`.
50+
- **CI values files** in `charts/steampipe/ci/` are used by `ct lint`/`ct install` for matrix testing. Name them `values-<scenario>.yaml`.
51+
- **Values schema** (`values.schema.json`) must stay in sync with `values.yaml` — Helm validates values against it at install time.
52+
- **Version bumps** for `appVersion` are handled by updatecli (`.github/updatecli/helm-appversion.yaml`). Don't bump manually.
53+
- **Template naming**: Steampipe resources use `steampipe.fullname`. The PostgreSQL service always appends `-psql`.
54+
- **Plugin configs** (`.spc` files) are mounted from Secrets or ConfigMaps into `/home/steampipe/.steampipe/config/` via `extraVolumes`/`extraVolumeMount`.
55+
- **CLI drift detection**: A workflow (`.github/workflows/helm-snapshot-check.yml`) posts a PR comment comparing `cli-snapshot.json` from `devops-ia/steampipe` at the old and new appVersions when `Chart.yaml` changes on a PR.
56+

.github/ct.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://github.com/helm/chart-testing#configuration
22
all: true
33
chart-dirs:
4-
- ./
4+
- charts
55
chart-repos:
66
- oauth2-proxy=https://oauth2-proxy.github.io/manifests/
77
check-version-increment: true

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,20 @@ updates:
2020
rebase-strategy: auto
2121
pull-request-branch-name:
2222
separator: "-"
23+
24+
- package-ecosystem: npm
25+
directory: "/"
26+
schedule:
27+
interval: monthly
28+
open-pull-requests-limit: 5
29+
labels:
30+
- enhancement
31+
- dependency-management
32+
assignees:
33+
- devops-ia/devops-ia
34+
commit-message:
35+
prefix: chore
36+
include: scope
37+
rebase-strategy: auto
38+
pull-request-branch-name:
39+
separator: "-"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env python3
2+
"""Compare two Steampipe CLI snapshots and emit a Markdown diff report."""
3+
4+
import argparse
5+
import json
6+
import sys
7+
8+
9+
def load(path):
10+
with open(path) as f:
11+
return json.load(f)
12+
13+
14+
def diff_list(label, old, new):
15+
old_set = set(old or [])
16+
new_set = set(new or [])
17+
added = sorted(new_set - old_set)
18+
removed = sorted(old_set - new_set)
19+
lines = []
20+
if added or removed:
21+
lines.append(f"#### {label}")
22+
for item in added:
23+
lines.append(f"- ✅ `{item}` *(added)*")
24+
for item in removed:
25+
lines.append(f"- ❌ `{item}` *(removed)*")
26+
return lines
27+
28+
29+
def main():
30+
parser = argparse.ArgumentParser()
31+
parser.add_argument("old", help="Path to old snapshot JSON")
32+
parser.add_argument("new", help="Path to new snapshot JSON")
33+
parser.add_argument("--output-md", required=True, help="Output Markdown file path")
34+
args = parser.parse_args()
35+
36+
try:
37+
old = load(args.old)
38+
except Exception as e:
39+
old = {}
40+
print(f"Warning: could not load old snapshot: {e}", file=sys.stderr)
41+
42+
try:
43+
new = load(args.new)
44+
except Exception as e:
45+
print(f"Error: could not load new snapshot: {e}", file=sys.stderr)
46+
sys.exit(1)
47+
48+
sections = []
49+
50+
sections += diff_list("Subcommands", old.get("subcommands"), new.get("subcommands"))
51+
sections += diff_list("`service` flags", old.get("service_start_flags"), new.get("service_start_flags"))
52+
sections += diff_list("`query` flags", old.get("query_flags"), new.get("query_flags"))
53+
sections += diff_list("`plugin` flags", old.get("plugin_flags"), new.get("plugin_flags"))
54+
sections += diff_list("Environment variables", old.get("env_vars"), new.get("env_vars"))
55+
56+
hash_fields = ["help_text_hash", "service_help_hash", "query_help_hash"]
57+
hash_changes = []
58+
for field in hash_fields:
59+
old_val = old.get(field, "")
60+
new_val = new.get(field, "")
61+
if old_val != new_val:
62+
hash_changes.append(f"- `{field}`: `{old_val}` → `{new_val}`")
63+
64+
if hash_changes:
65+
sections.append("#### Help text hashes")
66+
sections += hash_changes
67+
68+
old_ver = old.get("version", "unknown")
69+
new_ver = new.get("version", "unknown")
70+
71+
with open(args.output_md, "w") as f:
72+
if sections:
73+
f.write(f"<details>\n<summary>CLI changes between <code>{old_ver}</code> and <code>{new_ver}</code></summary>\n\n")
74+
f.write("\n".join(sections))
75+
f.write("\n\n</details>\n")
76+
print(f"Changes found between {old_ver} and {new_ver}")
77+
sys.exit(1)
78+
else:
79+
f.write(f"No CLI changes detected between `{old_ver}` and `{new_ver}`.\n")
80+
print(f"No changes between {old_ver} and {new_ver}")
81+
sys.exit(0)
82+
83+
84+
if __name__ == "__main__":
85+
main()

.github/updatecli/helm-appversion.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ sources:
22
steampipe:
33
kind: githubrelease
44
spec:
5-
owner: "turbot"
5+
owner: "devops-ia"
66
repository: "steampipe"
77
token: {{ requiredEnv "GITHUB_TOKEN" }}
88
versionFilter:
99
kind: semver
10-
transformers:
11-
- trimprefix: "v"
10+
pattern: ">=v2.0.0"
1211
conditions: {}
1312
targets:
1413
chartVersion:
1514
name: bump appversion
16-
kind: yaml
15+
kind: helmchart
1716
spec:
18-
file: charts/Chart.yaml
17+
name: charts/steampipe
18+
file: Chart.yaml
1919
key: $.appVersion
20+
versionincrement: patch
21+
sourceid: steampipe

.github/updatecli/helm-dependencies.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/helm-check-steampipe-major-dependencies.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

.github/workflows/helm-check-steampipe-minor-dependencies.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)