mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-12 23:54:01 +09:00
## What this PR does Adds `observability-proxy`, a new system component that lets a tenant user read the logs of their own namespace from VictoriaLogs with the same Kubernetes credentials they already use for the console, and with Kubernetes RBAC deciding what they can read. This is the first part of the design proposals [Tenant application logs](https://github.com/cozystack/community/pull/95) and [Tenant resource-consumption metrics](https://github.com/cozystack/community/pull/94); this PR implements the namespace logs root only. Metrics and the per-application roots follow in separate PRs. Why a proxy: today the log stores are shared per root tenant and have no notion of a caller, so tenants cannot be given direct read access without seeing other tenants' logs. The proxy authenticates the caller, authorizes the request from its path, and rebuilds the upstream query so that its scope cannot be widened by the client. Backward compatibility: this adds a new package and a new HelmRelease; nothing existing is renamed, removed or changed, so no migration is needed. What is included: - `cmd/observability-proxy` and `internal/observabilityproxy`: the proxy. - Serves `/apis/cozystack.io/v1alpha1/namespaces/<ns>/logs/select/logsql/<endpoint>` for the VictoriaLogs read endpoints the console needs (`query`, `hits`, `stats_query_range`, `tail`, `field_values`, `stream_field_values`, `facets`). Anything else under the root answers `404`. - Authentication by `TokenReview`, authorization by one `SubjectAccessReview` built from the path (`list` on `cozystack.io/logs` in the namespace), both cached briefly. - The upstream request is rebuilt from an allowlist of parameters; the namespace scope is always forced as `extra_stream_filters`. Client-supplied `extra_filters`, `extra_stream_filters`, any LogsQL `options(...)` block, and tenant headers such as `AccountID`/`ProjectID` are not forwarded or are refused. - Non-canonical paths (`..`, `//`, encoded separators) are refused with `400` before any authorization is built, because the console nginx matches on the normalized path but forwards the raw one. - Time window, step, bucket count and result limits are clamped; per-user rate, concurrency and open-tail limits answer `429`. Invalid time, step and limit parameters answer `400`. - The store is resolved from the namespace's `namespace.cozystack.io/monitoring` label. - Live `tail` streams are passed through unbuffered, and the upstream tail request disables compression so headers reach the client before the first line. - `packages/system/observability-proxy`: chart and image build, wired into the root `make build`. - Platform wiring: a new `cozystack.observability-proxy` PackageSource, enabled by default on the full variants and opt-in on the slim ones, the same way as `monitoring-agents`. - RBAC: an aggregated `cozy:observability:view` ClusterRole grants `list` on `cozystack.io/logs` to tenant `view` and above. No API server serves this resource; the rule exists only for the proxy's `SubjectAccessReview`. The proxy's own ClusterRole is limited to the calls it makes (`tokenreviews`, `subjectaccessreviews`, `list`/`watch` on namespaces). - Console nginx: when the proxy is not installed or cannot be reached, the observability roots answer `404` with a Kubernetes `Status` body, which the console shows as not available on this cluster; the proxy's own `502`/`504` for an unreachable store pass through unchanged. - Console: one regex `location` in the console nginx routes the four observability roots to the proxy ahead of `/apis`. The upstream is resolved at request time, so the console starts even when the proxy is not installed; those paths then answer `404` with a Kubernetes `Status` body. The console Deployment now receives the cluster domain for that resolution. - E2E: a new Chainsaw suite `hack/e2e-chainsaw/observability-proxy/` with two tenants, covering `401`/`403`/`200`, scope-widening attempts, path normalization and a long-lived `tail`. #### How it was tested - `go test -race` and `go vet` for the proxy packages. - helm-unittest for `observability-proxy`, `dashboard`, `tenant` and `core/platform`; bats tests for the console nginx routing. - The Chainsaw suite was not run as-is: it deploys its own VictoriaLogs as the root store and refuses to run when a real one exists. Its cases were replayed by a script against the real store on a test cluster. - Verified on a test cluster: - `401` without a token and with an invalid token, `403` for another tenant's namespace, `200` for the caller's own. - Client `extra_stream_filters`/`extra_filters` (GET and POST), an `AccountID` header and another tenant's stream named inside the query do not widen the scope; `options(...)` answers `400`; a path with `..` pointing at another tenant answers `400`; an endpoint outside the allowlist answers `404`. - Through the full browser chain (OIDC login, gatekeeper, gateway, console nginx), a single `tail` stayed open for more than two minutes without reconnecting, and requests from the same session to other tenants' roots answered `403`. - Not verified: the `429` limits under real load. `golangci-lint` has not been run locally. #### Known limitations - The proxy is reachable only through the console route; tenant workloads have no egress rule to it. Every request takes its concurrency or tail slot before the body is read; the token and access reviews and the body read run under `--request-timeout`, so a stalled kube-apiserver answers `503` rather than holding the request; and writes to the client carry a deadline (renewed per line for tails). `--request-timeout=0` disables those bounds and should not be used in production. - The first lines a newly started pod writes can be missing from an already open `tail`, although they are in the store. The likely cause is that Fluent Bit picks up a new log file later than the VictoriaLogs live-tail window; later lines of the same pod arrive. A history query shows them. - The per-application roots (`.../<plural>/<name>/log`, `.../metrics`) and the namespace metrics root answer `404` in this PR. ### Screenshots No UI changes. ### Downstream repositories - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: https://github.com/cozystack/website/issues/787 (docs land once the implementation PRs merge) - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: Downstream: `cozystack/website` is reached. A new platform component (`packages/core/platform/sources/observability-proxy.yaml`) triggers `content/en/docs/next/guides/platform-stack/_index.md` and `operations/configuration/licenses.md`; adding it to the system bundle (`packages/core/platform/templates/bundles/system.yaml`) may also need a line in `operations/configuration/variants.md`. A user-facing page for the logs API and the new tenant `view` permission is not required by the trigger map but would be useful. Tracked in cozystack/website#787. Other repositories: no trigger matched. `packages/core/platform/values.yaml` is not changed (only a test fixture), no package under `packages/apps/` gains a values field, and no CRD changes. The root `Makefile` `build` target builds one more image; this does not touch `hack/` or the make targets `ccp` relies on, so `ccp` is not considered affected, but a reviewer may want to confirm. ### Release note ```release-note feat(observability-proxy): add an authorizing proxy that lets tenant users read their namespace logs from VictoriaLogs with their Kubernetes credentials, under `/apis/cozystack.io/v1alpha1/namespaces/<ns>/logs/`. Access requires the tenant `view` role or higher. The component is enabled by default on full variants and opt-in on slim variants. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added an observability proxy for tenant-scoped log access through the console, including live log streaming. Requests are authenticated, access-controlled, and subject to configurable rate and concurrency limits. * Added platform packaging and deployment support, with console routing for observability requests. * **Tests** * Added automated coverage for access control, tenant scoping, query handling, streaming, proxy behavior, and deployment configuration. * **Documentation** * Updated end-to-end test guidance with host requirements for running the observability proxy suite. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
323 lines
15 KiB
Makefile
323 lines
15 KiB
Makefile
.PHONY: manifests assets prepare-env prepare-env-container unit-tests helm-unit-tests bats-unit-tests bats-unit-files-check bats-posix-compat-tests print-bats-unit-files print-bats-posix-compat-files print-bats-jobs rd-presets-check migrations-target-check test test-controllers test-controllers-envtest test-backport-batch preflight
|
|
|
|
include hack/common-envs.mk
|
|
|
|
build-deps:
|
|
@command -V find docker skopeo jq gh helm > /dev/null
|
|
@yq --version | grep -q "mikefarah" || (echo "mikefarah/yq is required" && exit 1)
|
|
@tar --version | grep -q GNU || (echo "GNU tar is required" && exit 1)
|
|
@sed --version | grep -q GNU || (echo "GNU sed is required" && exit 1)
|
|
@awk --version | grep -q GNU || (echo "GNU awk is required" && exit 1)
|
|
|
|
build: build-deps
|
|
make -C packages/apps/mariadb image
|
|
make -C packages/apps/clickhouse image
|
|
make -C packages/apps/kubernetes image
|
|
make -C packages/apps/vpn image
|
|
make -C packages/system/cozystack-api image
|
|
make -C packages/system/cozystack-controller image
|
|
make -C packages/system/backup-controller image
|
|
make -C packages/system/observability-proxy image
|
|
make -C packages/system/backupstrategy-controller image
|
|
make -C packages/system/lineage-controller-webhook image
|
|
make -C packages/system/migration-controller image
|
|
make -C packages/system/flux-shard-operator image
|
|
make -C packages/system/flux-plunger image
|
|
make -C packages/system/cilium image
|
|
make -C packages/system/linstor image
|
|
make -C packages/system/linstor-gui image
|
|
make -C packages/system/kubeovn image
|
|
make -C packages/system/kubeovn-webhook image
|
|
make -C packages/system/kubeovn-plunger image
|
|
make -C packages/system/kilo image
|
|
make -C packages/system/dashboard image
|
|
make -C packages/system/metallb image
|
|
make -C packages/system/talos-log-collector image
|
|
make -C packages/system/kamaji image
|
|
make -C packages/system/capi-providers-cpprovider image
|
|
make -C packages/system/capi-providers-infraprovider image
|
|
make -C packages/system/multus image
|
|
make -C packages/system/bucket image
|
|
make -C packages/system/seaweedfs image
|
|
make -C packages/system/objectstorage-controller image
|
|
make -C packages/system/securitygroup-controller image
|
|
make -C packages/system/grafana-operator image
|
|
make -C packages/system/monitoring image
|
|
make -C packages/system/redis-operator image
|
|
make -C packages/system/harbor image
|
|
make -C packages/system/velero image
|
|
make -C packages/system/opensearch-operator image
|
|
make -C packages/system/keycloak-operator image
|
|
make -C packages/core/testing image
|
|
make -C packages/core/talos image
|
|
make -C packages/core/platform image
|
|
make -C packages/core/installer image
|
|
make manifests
|
|
|
|
manifests:
|
|
mkdir -p _out/assets
|
|
cat internal/crdinstall/manifests/*.yaml > _out/assets/cozystack-crds.yaml
|
|
# kubectl-apply install path: render the bare Namespace resource alongside
|
|
# the operator. bareNamespace=true gates a Namespace cozy-system with PSA +
|
|
# identity labels (see packages/core/installer/templates/cozy-system-namespace.yaml).
|
|
# helm install/upgrade users keep the default (false) and use --create-namespace
|
|
# + the pre-install labeler hook.
|
|
# platformVersion is rendered into the COZYSTACK_VERSION env on the operator so
|
|
# the install artifacts carry the version as deploy-time data (not baked into
|
|
# the image). Promotion re-renders these with the stable version, no rebuild.
|
|
# Talos variant (default)
|
|
helm template installer packages/core/installer -n cozy-system \
|
|
--set bareNamespace=true \
|
|
--set cozystackOperator.platformVersion=$(if $(COZYSTACK_VERSION),v$(COZYSTACK_VERSION),) \
|
|
--show-only templates/cozy-system-namespace.yaml \
|
|
--show-only templates/cozystack-operator.yaml \
|
|
> _out/assets/cozystack-operator-talos.yaml
|
|
# Generic Kubernetes variant (k3s, kubeadm, RKE2)
|
|
helm template installer packages/core/installer -n cozy-system \
|
|
--set bareNamespace=true \
|
|
--set cozystackOperator.variant=generic \
|
|
--set cozystackOperator.platformVersion=$(if $(COZYSTACK_VERSION),v$(COZYSTACK_VERSION),) \
|
|
--set cozystack.apiServerHost=REPLACE_ME \
|
|
--show-only templates/cozy-system-namespace.yaml \
|
|
--show-only templates/cozystack-operator.yaml \
|
|
> _out/assets/cozystack-operator-generic.yaml
|
|
# Hosted variant (managed Kubernetes)
|
|
helm template installer packages/core/installer -n cozy-system \
|
|
--set bareNamespace=true \
|
|
--set cozystackOperator.variant=hosted \
|
|
--set cozystackOperator.platformVersion=$(if $(COZYSTACK_VERSION),v$(COZYSTACK_VERSION),) \
|
|
--show-only templates/cozy-system-namespace.yaml \
|
|
--show-only templates/cozystack-operator.yaml \
|
|
> _out/assets/cozystack-operator-hosted.yaml
|
|
|
|
cozypkg:
|
|
go build -ldflags "-X github.com/cozystack/cozystack/cmd/cozypkg/cmd.Version=v$(COZYSTACK_VERSION)" -o _out/bin/cozypkg ./cmd/cozypkg
|
|
|
|
# Operator diagnostic: reports non-ready cozystack / Flux / Kubernetes resources.
|
|
check-readiness:
|
|
go build -ldflags "-X main.Version=v$(COZYSTACK_VERSION)" -o _out/bin/check-readiness ./cmd/check-readiness
|
|
|
|
assets: assets-talos assets-cozypkg openapi-json
|
|
|
|
openapi-json:
|
|
mkdir -p _out/assets
|
|
VERSION=$(if $(COZYSTACK_VERSION),v$(COZYSTACK_VERSION),$(shell git describe --tags --always 2>/dev/null || echo dev)) go run ./tools/openapi-gen/ 2>/dev/null > _out/assets/openapi.json
|
|
|
|
assets-talos:
|
|
make -C packages/core/talos assets
|
|
|
|
assets-cozypkg: assets-cozypkg-linux-amd64 assets-cozypkg-linux-arm64 assets-cozypkg-darwin-amd64 assets-cozypkg-darwin-arm64 assets-cozypkg-windows-amd64 assets-cozypkg-windows-arm64
|
|
(cd _out/assets/ && sha256sum cozypkg-*.tar.gz) > _out/assets/cozypkg-checksums.txt
|
|
|
|
assets-cozypkg-%:
|
|
$(eval EXT := $(if $(filter windows,$(firstword $(subst -, ,$*))),.exe,))
|
|
mkdir -p _out/assets
|
|
GOOS=$(firstword $(subst -, ,$*)) GOARCH=$(lastword $(subst -, ,$*)) go build -ldflags "-X github.com/cozystack/cozystack/cmd/cozypkg/cmd.Version=v$(COZYSTACK_VERSION)" -o _out/bin/cozypkg-$*/cozypkg$(EXT) ./cmd/cozypkg
|
|
cp LICENSE _out/bin/cozypkg-$*/LICENSE
|
|
tar -C _out/bin/cozypkg-$* -czf _out/assets/cozypkg-$*.tar.gz LICENSE cozypkg$(EXT)
|
|
|
|
test:
|
|
make -C packages/core/testing apply
|
|
make -C packages/core/testing e2e
|
|
|
|
unit-tests: helm-unit-tests bats-unit-tests bats-posix-compat-tests go-unit-tests go-module-tests rd-presets-check test-check-readiness test-backport-batch migrations-target-check
|
|
|
|
helm-unit-tests:
|
|
hack/helm-unit-tests.sh
|
|
|
|
# Pin the resourcesPreset enum in every ApplicationDefinition openAPISchema
|
|
# to the canonical 47-value set (40 instance-type names + 7 legacy aliases).
|
|
# Catches the regression where one chart's Makefile forgets to invoke
|
|
# hack/update-crd.sh and that RD's schema drifts from values.schema.json.
|
|
rd-presets-check:
|
|
hack/check-rd-presets.sh
|
|
|
|
# Catch the off-by-one where migrations/<N> is added but
|
|
# migrations.targetVersion in packages/core/platform/values.yaml is not
|
|
# bumped to >= N+1. run-migrations.sh loops `seq $$CURRENT $$((TARGET-1))`,
|
|
# so the new migration is silently skipped on every cluster upgrade.
|
|
migrations-target-check:
|
|
hack/check-migrations-target.sh
|
|
|
|
# Scoped go test over the cozystack-api surface that this repo owns. Kept
|
|
# narrow intentionally - running `go test ./...` pulls in generated code
|
|
# round-trip suites whose behavior depends on tool versions outside this
|
|
# repo's control (kubebuilder, openapi-gen, etc.) and is better exercised
|
|
# from their generator workflows.
|
|
go-unit-tests:
|
|
go test ./pkg/registry/... ./pkg/config/... ./pkg/cmd/server/...
|
|
|
|
# The nested Go modules (image sources and the published API types) are
|
|
# outside ./... of the root module, so no other target reaches their tests.
|
|
# git ls-files, not find: gitignored checkouts such as .claude/worktrees
|
|
# hold whole copies of this repository.
|
|
go-module-tests:
|
|
@for mod in $$(git ls-files '*/go.mod' | xargs -n1 dirname); do \
|
|
echo "--- go test $$mod ---"; \
|
|
(cd "$$mod" && go test -count=1 ./...) || exit 1; \
|
|
done
|
|
|
|
# Go tests for the controllers and supporting packages under ./internal.
|
|
# Excludes ./pkg/... and ./cmd/... — those are run separately by
|
|
# go-unit-tests above (pkg subset) and skipped (cmd) until their tests
|
|
# stabilise. CI schedules this target in the same four-slot make invocation as
|
|
# unit-tests; locally invoke it directly or chain the two targets.
|
|
test-controllers:
|
|
go test ./internal/... -count=1
|
|
|
|
# Controller suites that need a real apiserver (build tag `envtest`): server-side
|
|
# apply ownership, apply preconditions and finalizer handling, which a fake client
|
|
# does not implement. setup-envtest fetches the kube-apiserver and etcd release
|
|
# pinned by ENVTEST_K8S_VERSION into _out/envtest; the HelmRelease CRD comes from
|
|
# the in-tree Flux manifests (envtest skips their non-CRD objects). CI runs it
|
|
# next to test-controllers. Only the packages listed below are compiled, so a
|
|
# package that gains an envtest suite has to be added here.
|
|
#
|
|
# setup-envtest itself is built into _out/envtest too, and binaries already there
|
|
# are used without asking the release index, so a warm _out/envtest (CI caches
|
|
# it) needs no network at all.
|
|
ENVTEST_K8S_VERSION ?= 1.35.0
|
|
SETUP_ENVTEST_VERSION ?= v0.0.0-20260305142021-f9589b9f2b9d
|
|
ENVTEST_DIR = $(CURDIR)/_out/envtest
|
|
SETUP_ENVTEST = $(ENVTEST_DIR)/bin/setup-envtest-$(SETUP_ENVTEST_VERSION)
|
|
$(SETUP_ENVTEST):
|
|
GOBIN=$(ENVTEST_DIR)/bin go install sigs.k8s.io/controller-runtime/tools/setup-envtest@$(SETUP_ENVTEST_VERSION)
|
|
mv $(ENVTEST_DIR)/bin/setup-envtest $@
|
|
test-controllers-envtest: $(SETUP_ENVTEST)
|
|
KUBEBUILDER_ASSETS="$$($(SETUP_ENVTEST) use $(ENVTEST_K8S_VERSION) --installed-only --bin-dir $(ENVTEST_DIR) --print path 2>/dev/null || $(SETUP_ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(ENVTEST_DIR) --print path)" \
|
|
HELMRELEASE_CRD_DIR=$(CURDIR)/internal/fluxinstall/manifests \
|
|
go test -tags envtest -run '^TestEnvtest' ./internal/controller/fluxplunger/... -count=1
|
|
|
|
# Black-box golden test for cmd/check-readiness. Builds the binary and runs it
|
|
# against a mock kubectl (fixtures under test/check-readiness/testdata),
|
|
# diffing stdout/stderr/exit against golden files. Regenerate goldens with:
|
|
# go test ./test/check-readiness/ -update
|
|
test-check-readiness:
|
|
go test ./test/check-readiness/ -count=1
|
|
|
|
# ./cmd/... is excluded from go-unit-tests, so the batch tool needs its own target.
|
|
test-backport-batch:
|
|
go test ./cmd/backport-batch/... -count=1
|
|
|
|
# Unit discovery is one level deep. Live-cluster files need an invocation in
|
|
# packages/core/testing; hack/bats-runner-coverage.bats checks that boundary.
|
|
# Bats supplies TAP and JUnit output; the live-cluster runner keeps its tracing.
|
|
#
|
|
# Caveat: $(wildcard ...) returns space-separated names, so a filename
|
|
# containing a literal space would split into multiple tokens here. All
|
|
# current bats files use hyphen-separated names; if the project ever
|
|
# introduces whitespace-bearing filenames this recipe must be rewritten
|
|
# (e.g. to use `find ... -print0 | xargs -0`).
|
|
BATS_UNIT_FILES := $(filter-out hack/e2e-%.bats,$(wildcard hack/*.bats))
|
|
|
|
# The same list, one file per line, for hack/bats-strict-setup.bats. Every unit
|
|
# file has to load hack/test_helper.bash to get `set -u` back, and that audit is
|
|
# only worth anything if the set it walks is the set that actually runs -- so it
|
|
# asks here rather than keeping a second copy of the filter above.
|
|
print-bats-unit-files:
|
|
@printf '%s\n' $(BATS_UNIT_FILES)
|
|
|
|
# `bats -j` needs GNU parallel and exits non-zero rather than degrading when it
|
|
# is missing. moreutils also ships a command named parallel, so identify the GNU
|
|
# implementation from its version output before enabling concurrency. Resolve
|
|
# the probe once per make process; `?=` would keep the `$(shell ...)` recursive
|
|
# and rerun it at every expansion.
|
|
ifndef BATS_JOBS
|
|
BATS_JOBS := $(shell parallel --version 2>/dev/null | grep -q '^GNU parallel ' && nproc 2>/dev/null || echo 1)
|
|
endif
|
|
|
|
print-bats-jobs:
|
|
@printf '%s\n' "$(BATS_JOBS)"
|
|
|
|
# JUnit XML is preserved as a CI artifact for inspection. _out is gitignored.
|
|
BATS_REPORT_DIR ?= _out/test-reports
|
|
|
|
bats-unit-files-check:
|
|
@if [ -z "$(BATS_UNIT_FILES)" ]; then \
|
|
echo "ERROR: no hack/*.bats unit test files found"; \
|
|
exit 1; \
|
|
fi
|
|
bats-unit-tests: bats-unit-files-check
|
|
@command -v bats >/dev/null 2>&1 || { \
|
|
echo "ERROR: bats not found. Install bats-core >= 1.5 — https://bats-core.readthedocs.io"; \
|
|
exit 1; \
|
|
}
|
|
@mkdir -p "$(BATS_REPORT_DIR)"
|
|
bats -j $(BATS_JOBS) --report-formatter junit -o "$(BATS_REPORT_DIR)" $(BATS_UNIT_FILES)
|
|
|
|
# Real Bats is authoritative. Unit files that source production code whose
|
|
# contract is POSIX sh retain a compatibility pass through cozytest.sh's
|
|
# /bin/sh translator. Discover literal .sh dependencies wherever they live,
|
|
# including hack/lib and package migration helpers, so a new non-Chainsaw
|
|
# helper test cannot run only under Bash. The explicit entries retain reviewed
|
|
# shell-facing tests, including files whose production path is held in a
|
|
# variable and therefore cannot be identified from the source line alone.
|
|
BATS_SOURCED_SH_FILES := $(shell grep -El '^[[:space:]]*(\.|source)[[:space:]]+.*\.sh' $(BATS_UNIT_FILES))
|
|
BATS_POSIX_COMPAT_FILES := $(sort \
|
|
$(BATS_SOURCED_SH_FILES) \
|
|
hack/capture-dataplane.bats \
|
|
hack/capture-previous-logs.bats \
|
|
hack/cilium-leak-healer_test.bats \
|
|
hack/container-lane-capacity_test.bats \
|
|
hack/cozyreport-talos.bats \
|
|
hack/cozyreport.bats \
|
|
hack/cozystack-version-stamp.bats \
|
|
hack/nightly-mirror_test.bats \
|
|
hack/pod-label-census_test.bats \
|
|
hack/promote-rewrite-tags_test.bats \
|
|
hack/runner-identity.bats \
|
|
hack/seaweedfs-naming-audit.bats \
|
|
)
|
|
|
|
# CI's /bin/sh is dash. Keep the interpreter overridable so contributors can
|
|
# run the same compatibility lane explicitly on hosts whose /bin/sh differs.
|
|
BATS_POSIX_SHELL ?= /bin/sh
|
|
COZYTEST_TRACE ?= 0
|
|
|
|
print-bats-posix-compat-files:
|
|
@printf '%s\n' $(BATS_POSIX_COMPAT_FILES)
|
|
|
|
bats-posix-compat-tests:
|
|
@status=0; \
|
|
for f in $(BATS_POSIX_COMPAT_FILES); do \
|
|
echo "--- running POSIX compatibility: $$f ---"; \
|
|
COZYTEST_TRACE=$(COZYTEST_TRACE) "$(BATS_POSIX_SHELL)" hack/cozytest.sh "$$f" || status=1; \
|
|
done; \
|
|
exit $$status
|
|
|
|
# No cluster for the unit and controller lanes. A test that misses a stub, or
|
|
# whose stub a `timeout` or `bash -c` steps past, otherwise reaches whatever
|
|
# cluster the caller's kubeconfig points at. An empty KUBERNETES_SERVICE_HOST
|
|
# is needed beside KUBECONFIG: given an empty kubeconfig, client-go falls back
|
|
# to in-cluster credentials wherever that variable and a service-account token
|
|
# are present.
|
|
# Every prerequisite of unit-tests is listed so it is guarded when run on its
|
|
# own too; hack/unit-lane-no-cluster.bats fails when one is missing.
|
|
NO_CLUSTER_TARGETS := unit-tests test-controllers helm-unit-tests bats-unit-tests \
|
|
bats-posix-compat-tests go-unit-tests go-module-tests rd-presets-check \
|
|
test-check-readiness test-backport-batch migrations-target-check
|
|
$(NO_CLUSTER_TARGETS): export KUBECONFIG := /dev/null
|
|
$(NO_CLUSTER_TARGETS): export KUBERNETES_SERVICE_HOST :=
|
|
|
|
# Operator-facing host preflight check. Warns about a standalone
|
|
# containerd.service or docker.service running alongside the embedded
|
|
# k3s runtime. Safe to run at any time; always exits 0.
|
|
preflight:
|
|
@hack/check-host-runtime.sh
|
|
|
|
prepare-env:
|
|
make -C packages/core/testing apply
|
|
make -C packages/core/testing prepare-cluster
|
|
|
|
# Container-lane sibling of prepare-env. Same sandbox, Talos nodes as containers
|
|
# instead of QEMU guests, so no nocloud asset is copied in.
|
|
prepare-env-container:
|
|
make -C packages/core/testing apply
|
|
make -C packages/core/testing prepare-cluster-container
|
|
|
|
generate:
|
|
hack/update-codegen.sh
|
|
|
|
upload_assets: manifests
|
|
hack/upload-assets.sh
|