Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 58 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: azure/setup-helm@2f5e7bc67f1f9972ab16657bb795f36d8f04de0e # v5.1.0
- run: helm lint charts/gameplane
- run: helm lint charts/gameplane --set-string image.tag=dev
- name: evaluate monitoring rules
run: bash charts/gameplane/tests/monitoring-rules.sh
- name: check MCP server RBAC scope
Expand Down Expand Up @@ -1305,7 +1305,9 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: azure/setup-helm@2f5e7bc67f1f9972ab16657bb795f36d8f04de0e # v5.1.0
- run: helm template gameplane charts/gameplane > /tmp/rendered.yaml
- run: helm template gameplane charts/gameplane --set-string image.tag=dev > /tmp/rendered.yaml
- name: check source chart image selection
run: python3 charts/tests/check_source_chart.py
- name: deterministic offline native chart and upgrade renders
run: python3 charts/tests/check_argocd.py
- name: gateway isolation and API-disabled chart renders
Expand All @@ -1327,7 +1329,7 @@ jobs:
grep -q 'kind: NetworkPolicy' /tmp/rendered.yaml
- name: backup/restore Job egress policy renders (F-215)
run: |
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--show-only templates/networkpolicies.yaml > /tmp/netpol.yaml
grep -q 'name: allow-backup-restore-egress' /tmp/netpol.yaml
awk '/name: allow-backup-restore-egress/,/^---$/' /tmp/netpol.yaml \
Expand All @@ -1343,7 +1345,7 @@ jobs:
# api.telemetry.receiver.dashboard.tokenSecretRef.name.
run: |
scrape_ns='serviceMonitors.scrapeNamespaceSelector={"matchLabels":{"kubernetes.io/metadata.name":"monitoring"}}'
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set serviceMonitors.enabled=true \
--set api.telemetry.receiver.enabled=true \
--set api.telemetry.receiver.dashboard.tokenSecretRef.name=receiver-dashboard \
Expand All @@ -1368,7 +1370,7 @@ jobs:
grep -q 'name: receiver-dashboard' /tmp/receiver-servicemonitor.yaml
# No dashboard token: no receiver ServiceMonitor (it could only scrape
# a permanently-down target); NOTES.txt carries the warning.
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set serviceMonitors.enabled=true \
--set api.telemetry.receiver.enabled=true \
--set-json "$scrape_ns" \
Expand All @@ -1377,13 +1379,13 @@ jobs:
echo "::error::receiver ServiceMonitor rendered without api.telemetry.receiver.dashboard.tokenSecretRef.name"
exit 1
fi
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set serviceMonitors.enabled=true \
--set-json "$scrape_ns" \
--show-only templates/networkpolicies.yaml > /tmp/netpol-scrape.yaml
awk '/name: allow-prometheus-to-agent/,/^---$/' /tmp/netpol-scrape.yaml \
| grep -q 'port: 9090'
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set serviceMonitors.enabled=true \
--set api.telemetry.receiver.enabled=true \
--set api.telemetry.receiver.dashboard.tokenSecretRef.name=receiver-dashboard \
Expand All @@ -1405,13 +1407,13 @@ jobs:
awk '/kind: Service/,/^---$/' /tmp/telemetry-receiver-scrape.yaml \
| grep -q 'name: dashboard'
# Missing scrape ingress must fail with actionable guidance.
if helm template gameplane charts/gameplane --set serviceMonitors.enabled=true > /tmp/monitoring-invalid.txt 2>&1; then
if helm template gameplane charts/gameplane --set-string image.tag=dev --set serviceMonitors.enabled=true > /tmp/monitoring-invalid.txt 2>&1; then
echo "::error::monitoring without a scrape selector unexpectedly rendered"
exit 1
fi
grep -q 'serviceMonitors.scrapeNamespaceSelector' /tmp/monitoring-invalid.txt
# Explicit external policy ownership renders no chart exception.
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set serviceMonitors.enabled=true \
--set serviceMonitors.externallyManagedPolicy=true \
--show-only templates/networkpolicies.yaml > /tmp/netpol-default.yaml
Expand All @@ -1431,7 +1433,7 @@ jobs:
--set api.oidc.redirectURL=https://gameplane.example/auth/oidc/callback)
rules='api.oidc.roleRules=[{"group":"sys-admin","role":"admin"},{"group":"gameplane login only, staff","role":"login-only"}]'
# Old form only: the per-role flags exactly as before, no rules flag.
helm template gameplane charts/gameplane "${oidc[@]}" \
helm template gameplane charts/gameplane --set-string image.tag=dev "${oidc[@]}" \
--set-json 'api.oidc.roleMappings={"admin":["gp-admins"],"operator":["gp-ops","gp-sre"],"viewer":["gp-view"]}' \
--show-only templates/api.yaml > /tmp/api-oidc-old.yaml
grep -qF -- '- "--oidc-role-mapping-admin=gp-admins"' /tmp/api-oidc-old.yaml
Expand All @@ -1442,7 +1444,7 @@ jobs:
exit 1
fi
# New form: exactly one JSON flag, in list order, and no per-role flags.
helm template gameplane charts/gameplane "${oidc[@]}" \
helm template gameplane charts/gameplane --set-string image.tag=dev "${oidc[@]}" \
--set-json "$rules" \
--show-only templates/api.yaml > /tmp/api-oidc-rules.yaml
if [ "$(grep -c -- '--oidc-role-rules=' /tmp/api-oidc-rules.yaml)" -ne 1 ]; then
Expand All @@ -1455,7 +1457,7 @@ jobs:
exit 1
fi
# Both forms: the render fails and names both keys (OD-1).
if helm template gameplane charts/gameplane "${oidc[@]}" \
if helm template gameplane charts/gameplane --set-string image.tag=dev "${oidc[@]}" \
--set-json "$rules" \
--set-json 'api.oidc.roleMappings={"admin":["gp-admins"]}' > /tmp/api-oidc-both.txt 2>&1; then
echo "::error::api.oidc.roleRules together with api.oidc.roleMappings unexpectedly rendered"
Expand All @@ -1468,12 +1470,12 @@ jobs:
# is used as-is without the bundled marker; defaults render no endpoint.
run: |
# api.telemetry.enabled=false is the hard off switch.
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set api.telemetry.enabled=false \
--show-only templates/api.yaml > /tmp/api-telemetry-off.yaml
grep -q -- '--telemetry-disabled' /tmp/api-telemetry-off.yaml
# The bundled receiver auto-wires the API and marks it bundled.
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set api.telemetry.receiver.enabled=true \
--show-only templates/api.yaml > /tmp/api-telemetry-bundled.yaml
grep -q -- '--telemetry-endpoint=http://gameplane-telemetry-receiver' /tmp/api-telemetry-bundled.yaml
Expand All @@ -1483,7 +1485,7 @@ jobs:
exit 1
fi
# A custom endpoint is used as-is and is never marked bundled.
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set api.telemetry.endpoint=https://telemetry.example.com/ingest \
--set api.telemetry.receiver.enabled=true \
--show-only templates/api.yaml > /tmp/api-telemetry-custom.yaml
Expand All @@ -1493,7 +1495,7 @@ jobs:
exit 1
fi
# Defaults render no endpoint (the API falls back to its compiled-in default).
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--show-only templates/api.yaml > /tmp/api-telemetry-default.yaml
if grep -q -- '--telemetry-endpoint' /tmp/api-telemetry-default.yaml; then
echo "::error::default values rendered a --telemetry-endpoint"
Expand Down Expand Up @@ -1522,7 +1524,7 @@ jobs:
pow_fails() {
# pow_fails MESSAGE --set ...: the render must fail with MESSAGE.
message="$1"; shift
if helm template gameplane charts/gameplane --set api.telemetry.receiver.enabled=true "$@" \
if helm template gameplane charts/gameplane --set-string image.tag=dev --set api.telemetry.receiver.enabled=true "$@" \
--show-only templates/telemetry-receiver.yaml > /dev/null 2> /tmp/pow-fail.err; then
echo "::error::receiver rendered for $*"
exit 1
Expand All @@ -1535,12 +1537,12 @@ jobs:
}
pow=api.telemetry.receiver.ingestPow
# Defaults: proof-of-work off, with the OD-5 values.
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set api.telemetry.receiver.enabled=true \
--show-only templates/telemetry-receiver.yaml > /tmp/pow-default.yaml
pow_env /tmp/pow-default.yaml false 60 0 22
# Enabled with its own values.
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set api.telemetry.receiver.enabled=true \
--set $pow.enabled=true --set $pow.targetPerMinute=30 \
--set $pow.minBits=8 --set $pow.maxBits=26 \
Expand Down Expand Up @@ -1581,7 +1583,7 @@ jobs:
# (api.yaml), unlike the surrounding Role/RoleBinding names. Any such
# release could install but never upgrade.
run: |
helm template gp charts/gameplane --namespace gpns --is-upgrade > /tmp/rendered-gp.yaml
helm template gp charts/gameplane --set-string image.tag=dev --namespace gpns --is-upgrade > /tmp/rendered-gp.yaml
python3 - <<'PY'
import sys, yaml
docs = list(yaml.safe_load_all(open('/tmp/rendered-gp.yaml')))
Expand Down Expand Up @@ -1612,7 +1614,7 @@ jobs:
trap 'cp /tmp/values.yaml.orig charts/gameplane/values.yaml' EXIT
cp charts/gameplane/values.yaml /tmp/values.yaml.orig
cp charts/gameplane/testdata/upgrade-from-v0.2.0-beta.8-values.yaml charts/gameplane/values.yaml
helm template gameplane charts/gameplane --include-crds > /tmp/rendered-reuse-values.yaml
helm template gameplane charts/gameplane --set-string image.tag=dev --include-crds > /tmp/rendered-reuse-values.yaml
python3 - <<'PY'
import yaml
docs = [d for d in yaml.safe_load_all(open('/tmp/rendered-reuse-values.yaml')) if d]
Expand All @@ -1635,7 +1637,7 @@ jobs:
# keys), the chart still renders: no receiver PVC is added, no
# receiver ServiceMonitor renders without a token, and the API
# keeps working without api.telemetry.enabled.
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set api.telemetry.receiver.enabled=true \
--set serviceMonitors.enabled=true \
--set serviceMonitors.externallyManagedPolicy=true > /tmp/rendered-reuse-values-receiver.yaml
Expand Down Expand Up @@ -1679,7 +1681,7 @@ jobs:
# The release workflows check the root key against the signing secret;
# this checks the chart's copy against the root key.
run: |
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
--set defaultModuleSource.oci.verify.enabled=true \
--show-only templates/module-cosign-key.yaml > /tmp/keysecret.yaml
# The rendered Secret carries the key under stringData/data; pull the
Expand Down Expand Up @@ -1712,7 +1714,7 @@ jobs:
raise SystemExit("could not find the Keycloak 'Or in values.yaml' example in docs/oidc.md")
print(m.group(1))
PY
helm template gameplane charts/gameplane \
helm template gameplane charts/gameplane --set-string image.tag=dev \
-f /tmp/oidc-example-values.yaml \
--show-only templates/api.yaml > /tmp/rendered-oidc.yaml
grep -q 'GAMEPLANE_OIDC_CLIENT_SECRET' /tmp/rendered-oidc.yaml
Expand Down Expand Up @@ -2046,6 +2048,38 @@ jobs:
uses: ./.github/actions/e2e-images
with:
arch: ${{ matrix.arch }}
- name: verify source checkout controller rollouts
if: matrix.bucket == 'operator' && matrix.arch == 'amd64' && env.RUN_REGEX != ''
shell: bash
run: |
cluster="source-checkout-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
trap 'kind delete cluster --name "$cluster"' EXIT
kind create cluster --name "$cluster" --wait 90s
kind load docker-image --name "$cluster" gameplane-test/{api,operator,telemetry-receiver}:e2e
# The CI image bundle omits the dashboard. Scaling only web to zero
# leaves both controllers' documented source-install arguments intact.
helm upgrade --install gameplane ./charts/gameplane --kube-context "kind-$cluster" \
--namespace gameplane-system --create-namespace \
--set-string image.registry=gameplane-test --set-string image.tag=e2e \
--set api.telemetry.receiver.enabled=true --set web.replicas=0
k=(kubectl --context "kind-$cluster" -n gameplane-system)
for component in operator api; do
name="gameplane-$component"
container="$component"
if [[ "$component" == operator ]]; then container=manager; fi
if ! "${k[@]}" rollout status "deployment/$name" --timeout=5m; then
"${k[@]}" logs "deployment/$name" -c "$container" --tail=30 || true
exit 1
fi
"${k[@]}" get pods -l "app.kubernetes.io/name=$name" -o json |
jq -ce --arg c "$container" --arg image "gameplane-test/$component:e2e" '
[.items[] | select(.metadata.deletionTimestamp == null)] | select(length == 1) | .[0] |
select(any(.status.conditions[]; .type == "Ready" and .status == "True")) |
(.spec.containers[] | select(.name == $c and .image == $image)) as $spec |
(.status.containerStatuses[] | select(.name == $c and .ready)) as $status |
select(($spec.args | length) > 0 and ($status.imageID | length) > 0) |
{pod: .metadata.name, image: $spec.image, imageID: $status.imageID, args: $spec.args}'
done
- name: bring up cluster + helm install
if: env.RUN_REGEX != '' || env.TAIL_REGEX != ''
env:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,14 @@ jobs:
run: |
sed -i "s/^version: .*/version: ${GITHUB_REF_NAME#v}/" charts/gameplane/Chart.yaml
sed -i "s/^appVersion: .*/appVersion: ${GITHUB_REF_NAME#v}/" charts/gameplane/Chart.yaml
sed -i '/^ gameplane\.local\/source-checkout:/d' charts/gameplane/Chart.yaml
sed -i "s/^version: .*/version: ${GITHUB_REF_NAME#v}/" charts/gameplane/charts/gameplane-crds/Chart.yaml
# gameplane-crds is also published on its own, for GitOps setups where a
# separate Application owns the CRDs (docs/argocd.md).
- name: helm package
run: helm package charts/gameplane charts/gameplane/charts/gameplane-crds -d dist
- name: check packaged chart image defaults
run: python3 charts/tests/check_source_chart.py --release-chart "dist/gameplane-${GITHUB_REF_NAME#v}.tgz" --release-version "${GITHUB_REF_NAME#v}"
# The chart is a published artifact like the images, so it must be signed
# too — it was previously pushed unsigned, which made the "everything we
# publish is signed" claim untrue.
Expand Down
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,10 @@ dev-load: ## Load every image `make images` builds into the kind cluster (kind o
kind load docker-image $(REGISTRY)/$$img:$(TAG) --name $(KIND_CLUSTER) || exit $$?; \
done

dev-push: ## Push operator/api/web/agent images to REGISTRY (remote clusters)
docker push $(REGISTRY)/operator:$(TAG)
docker push $(REGISTRY)/api:$(TAG)
docker push $(REGISTRY)/web:$(TAG)
docker push $(REGISTRY)/agent:$(TAG)
dev-push: ## Push every image built by make images to REGISTRY
@for img in $(ALL_IMAGE_NAMES); do \
docker push "$(REGISTRY)/$$img:$(TAG)" || exit $$?; \
done

dev-install: ## Install Gameplane Helm chart into the selected cluster
@hack/need.sh helm
Expand All @@ -482,8 +481,8 @@ dev-install: ## Install Gameplane Helm chart into the selected cluster
$(KUBECONFIG_ENV) helm upgrade --install $(CHART_RELEASE) $(CHART_DIR) \
--kube-context $(KUBE_CONTEXT) \
--namespace $(NAMESPACE) --create-namespace \
--set image.tag=$(TAG) \
--set image.registry=$(REGISTRY) \
--set-string "image.tag=$(TAG)" \
--set-string "image.registry=$(REGISTRY)" \
--set operator.addressManager=$(ADDRESS_MANAGER) \
--set api.telemetry.receiver.enabled=true \
--set defaultModuleSource.type=oci \
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/1165-source-chart-images.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Breaking: source-chart installs require an explicit image tag

When installing or upgrading from a Git checkout, set `image.tag` to a build
from that revision. Use `make images` and `make dev-push` to build and push
the full component set to your registry. Published OCI charts still select
their matching release images automatically.
[Source checkout instructions](../../docs/install.md#install-from-a-source-checkout) · [PR #1165](https://github.com/GameplanePanel/Gameplane/pull/1165)
2 changes: 2 additions & 0 deletions charts/gameplane/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ type: application
version: 0.5.0
appVersion: "0.5.0"
kubeVersion: ">=1.30.0-0"
annotations:
gameplane.local/source-checkout: "true"
home: https://github.com/GameplanePanel/gameplane
sources:
- https://github.com/GameplanePanel/gameplane
Expand Down
9 changes: 5 additions & 4 deletions charts/gameplane/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{- /*
gameplane.imageTag resolves the shared image tag: an explicit image.tag wins,
otherwise it falls back to the chart's appVersion so a released chart vX always
pulls images vX with no per-install override. Set image.tag (e.g. "edge") to
track a rolling channel.
The release workflow removes the checkout annotation when it packages the
chart alongside matching release images. A checkout can contain newer flags.
*/}}
{{- define "gameplane.imageTag" -}}
{{- if and (not .Values.image.tag) (index .Chart.Annotations "gameplane.local/source-checkout") -}}
{{- fail "This source chart requires an explicit image.tag. Build images from this checkout and set image.registry and image.tag, or install oci://ghcr.io/gameplanepanel/charts/gameplane with --version <release>." -}}
{{- end -}}
{{- .Values.image.tag | default .Chart.AppVersion -}}
{{- end -}}

Expand Down
4 changes: 2 additions & 2 deletions charts/gameplane/tests/mcp-server-rbac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ set -euo pipefail
cd "$(dirname "$0")/../../.."
scratch="$(mktemp -d)"
trap 'rm -rf "$scratch"' EXIT
helm template gameplane charts/gameplane --namespace gameplane-system \
helm template gameplane charts/gameplane --set-string image.tag=dev --namespace gameplane-system \
--set mcpServer.enabled=true --set 'operator.gameNamespaces={tenant-b}' > "$scratch/enabled.yaml"
helm template gameplane charts/gameplane --namespace gameplane-system \
helm template gameplane charts/gameplane --set-string image.tag=dev --namespace gameplane-system \
--set mcpServer.enabled=false > "$scratch/disabled.yaml"
python3 - "$scratch" <<'PY'
import pathlib,sys,yaml
Expand Down
Loading