| Files | Last commit | Last update |
|---|---|---|
Use Kubernetes declarative validation (#1215) This mostly eliminates the need to hand-write validation code. This PR is a long series of commits which add DV for most of Actor and all of Atespace. Here is a map to the commits: * The first few take a dep on a new Kubernetes tag, import the code into third_party, and apply a single patch. Because we have different Go modules for tools, I had to do it twice. When that patch lands, we can revert these commits, but that won't be until the 1.38 cycle in a few months. * The next commits slowly add DV support, so a human can review each of them in a reasonable amount of time. The emphasis is on great test cases. * I made a bad choice early on as to where to generate the code into, so I moved it. Rebasing on that was exceedingly hard, so I left it as a move. * This required changing update/go-generate -> update/codegen -- we need to get the ordering of tools right, which `go generate` does not guarantee. * Then I added a "middle" layer called "ServiceImpl" between the RPC and storage layers. This allows things like workflow to call the same business logic as the RPC layer, including validation. Lots of test fixes. * Then I finished the Create() and Update() paths for Actor. Those represent the "right" (or closest to) way to implement resources, and tests for validation. I strongly encourage reviewers to read it commit-by-commit. Rebasing this is VERY tedious, so the sooner it lands or dies completely, the better. Then we can start converting the rest. `./hack/run-tool.sh validation-gen --docs` will produce some docs on the tool and the available tags. @laoj2 @juli4n @EItanya @HavenXia @lalitc375 @yongruilin @jpbetz FYI | 3 months ago | |
tools: remove setup-gcp and hack/teardown.sh (#3505) Supersedes #3396 by @stshrive, rebased onto current `main`. The commit keeps his authorship and sign-off. The GKE provisioning and teardown tooling now lives in https://github.com/ai-on-gke/substrate-gke under tools/setup-gcp, so core no longer carries a copy. Docs and comments that pointed at the removed files now point at substrate-gke. go mod tidy drops the GCP client modules only setup-gcp used, and vendor/ and _LICENSES/ are regenerated to match. Covers #3390, except that hack/teardown.sh is removed here as well; substrate-gke's tools/setup-gcp/teardown.sh replaces it. Part of #2304 ### Rebase notes Conflicts were mostly from the Hugo docsite move (#1974): - `tools/setup-gcp/cloud-sql.md`: deleted, as in the original PR. - `docs/guides/operator-install.md`, `docs/guides/postgres.md`: the original edits, re-applied at the new paths. - `docs/guides/observability.md`: kept main's version, since #1974 already removed the Dashboards section the original PR edited. - `cmd/kubectl-ate/README.md`: kept main's stub that points to `docs/reference/kubectl-ate.md`. That page no longer has the setup-gcp line, so the edit had nowhere to go. --------- Signed-off-by: Steven Shriver <6007067+stshrive@users.noreply.github.com> Signed-off-by: Grant McCloskey <gmccloskey@google.com> Co-authored-by: Steven Shriver <6007067+stshrive@users.noreply.github.com> | 25 days ago | |
Use Kubernetes declarative validation (#1215) This mostly eliminates the need to hand-write validation code. This PR is a long series of commits which add DV for most of Actor and all of Atespace. Here is a map to the commits: * The first few take a dep on a new Kubernetes tag, import the code into third_party, and apply a single patch. Because we have different Go modules for tools, I had to do it twice. When that patch lands, we can revert these commits, but that won't be until the 1.38 cycle in a few months. * The next commits slowly add DV support, so a human can review each of them in a reasonable amount of time. The emphasis is on great test cases. * I made a bad choice early on as to where to generate the code into, so I moved it. Rebasing on that was exceedingly hard, so I left it as a move. * This required changing update/go-generate -> update/codegen -- we need to get the ordering of tools right, which `go generate` does not guarantee. * Then I added a "middle" layer called "ServiceImpl" between the RPC and storage layers. This allows things like workflow to call the same business logic as the RPC layer, including validation. Lots of test fixes. * Then I finished the Create() and Update() paths for Actor. Those represent the "right" (or closest to) way to implement resources, and tests for validation. I strongly encourage reviewers to read it commit-by-commit. Rebasing this is VERY tedious, so the sooner it lands or dies completely, the better. Then we can start converting the rest. `./hack/run-tool.sh validation-gen --docs` will produce some docs on the tool and the available tags. @laoj2 @juli4n @EItanya @HavenXia @lalitc375 @yongruilin @jpbetz FYI | 3 months ago | |
Upgrade Kubernetes libraries to v0.38.0-beta.0 (#4053) <!-- The PR title becomes the release note. Write it for users. --> `go.mod` replaced `k8s.io/apimachinery` with an untagged commit, and `hack/tools/code-generator` pinned the generators the same way, because declarative validation needs changes that first ship in Kubernetes 1.38. `v0.38.0-beta.0` has them, so the `k8s.io/*` modules move to that tag and the `replace` is gone. controller-runtime is pinned to a commit on `main`. Its releases still use structured-merge-diff v6, so their fake client does not compile against apimachinery v0.38. Only the first and last commits are hand edits. The rest are tool output: `go get` and `go mod tidy` for the two bump commits, and the script named in the title for the others. Runtime changes that come with the new modules: - atecontroller prints klog text lines on stderr at startup. The pinned controller-runtime logs its cache sync waits through klog. - Range errors on enum fields name the constant: `must be less than or equal to ACTOR_STATE_REVERTING`, where it was `7`. - atecontroller's metrics port serves OpenMetrics to scrapers that ask for it. - gRPC moves to v1.85.0 and OTel to v1.47.0. The regenerated validation code accepts and rejects the same input as before. The WorkerPool CRD diff is description text. Part of #3821 <!-- e.g. "AI-assisted, I reviewed and tested it." No AI co-author trailers. --> AI use: AI-assisted with Claude Code. It ran the bump and the generators, and drafted the commit messages and this description. I reviewed the diff. <!-- Breaking change? Describe what users must do on upgrade and ask for the `breaking-change` label. --> - [x] Tests pass (e2e and the root-gated tests were not run locally) - [x] Docs updated --------- Signed-off-by: Yongrui Lin <yongrlin@outlook.com> | 4 days ago | |
(feat): Actor lifecycle events over otlp (#1658) ## What this does ateapi writes a record every time an actor changes state. Until now those records only went to the pod's stdout, and nothing reads stdout. This sends the same records to a collector as OTLP log events. Actor name and uid cannot be metric labels (too many values), and traces are sampled at 1%. So these records are the only way to answer "what state is this actor in, and since when". ## Changes - `serverboot.InitLogging` sets up a LoggerProvider, next to the existing tracer and meter ones. - New `internal/actorevent` package builds the log records. - ateapi emits at the two places that already write the stdout records. - Two event names: `ate.actor.state_changed` and `ate.actor.crashed`. - Both names are registered in `docs/metrics/registry/events.yaml`, so `make verify` checks them. - kind gets a logs pipeline and a count connector. The e2e suite reads the counts back. - Docs updated. `otel-collector.md` said substrate has no LoggerProvider, which is no longer true. ## Opt-in `OTEL_LOGS_EXPORTER` defaults to `none`. Only the kind overlay sets it to `otlp`. The base ConfigMap is untouched, so no deployed environment changes when this merges. ## Notes on the design - **No slog bridge.** Only two call sites emit these records, so emitting twice costs two lines. A bridge would also send every ateapi log over the wire, could not set the event name, and would loop, because SDK export errors are logged through slog. - **Batching processor, not the simple one.** These records sit on the actor resume path. A processor that exports inside the emit call would add a blocking gRPC call there, so a slow collector would become control plane latency. - **Two event names, not one per state.** `ate.actor.state` already says which transition happened. A crash gets its own name because it carries two extra attributes and a higher severity. - **Both copies are kept on purpose.** No collector in this repo reads pod stdout, so nothing is duplicated today. `kubectl logs` keeps working. If a filelog agent is ever added, drop one of the two. The escape hatch is written down in `docs/metrics/substrate.yaml`. ## Dependencies Adds `otel/log`, `otel/sdk/log` and `otlploggrpc`, all pinned at v0.20.0. That is the release that matches the pinned `otel v1.44.0`. v0.21.0 would pull the core modules to v1.45.0, which this change does not need. The logs API has a v1.47.0 release candidate upstream, so it is on its way to stable. ## Testing - Unit tests for the exporter resolver, the record builder, and both ateapi emit sites. - The record builder test checks the attribute set matches what the event name declares, in both directions. - The ateapi tests check the OTLP record carries the same attributes as the stdout record. - Ran end to end on kind. Records arrive with the right event name, severity, attributes, and with trace context on the record's own fields rather than as attributes. - Checked the off state too. With `OTEL_LOGS_EXPORTER` removed, the collector receives no log records and stdout is unchanged. - [x] Tests pass - [x] Appropriate changes to documentation are included in the PR | 2 months ago | |
Initialize OpenFGA server on ATE API Server bootstrap. (#1670) Working on https://github.com/agent-substrate/substrate/issues/1563 ## Summary Initializes an embedded OpenFGA server within `ateapi` backed by PostgreSQL and updates the top-level authorization scope. ## Key Changes - **Rename scope to `global`**: Renamed `type cluster` and `parent_cluster` to `type global` and `parent_global`, adding `can_set_policy` and `can_get_policy` to `global`. - **Embedded OpenFGA server (`internal/authz/server.go`)**: - Compiles `model.fga` into OpenFGA's protobuf representation. - Runs OpenFGA PostgreSQL schema migrations (`goose_db_version`). - Serializes startup via `pg_advisory_lock` to avoid multi-replica races. - Connects OpenFGA's PostgreSQL adapter with a new dedicated `*pgxpool.Pool`. - Idempotently creates or reuses the `"substrate"` store and authorization model. - **Service wiring (`cmd/ateapi`)**: Exposes `Pool()` on `*atepg.Persistence` and initializes `authz.NewServer` on bootstrap. ## Verification - `openfga model test`: 103/103 checks passing (`model_test.fga.yaml`). - `go test -mod=mod ./internal/authz/...`: Passes against PostgreSQL (migrations, tuple writes, permission checks, and restart idempotency). | 2 months ago | |
Use Kubernetes declarative validation (#1215) This mostly eliminates the need to hand-write validation code. This PR is a long series of commits which add DV for most of Actor and all of Atespace. Here is a map to the commits: * The first few take a dep on a new Kubernetes tag, import the code into third_party, and apply a single patch. Because we have different Go modules for tools, I had to do it twice. When that patch lands, we can revert these commits, but that won't be until the 1.38 cycle in a few months. * The next commits slowly add DV support, so a human can review each of them in a reasonable amount of time. The emphasis is on great test cases. * I made a bad choice early on as to where to generate the code into, so I moved it. Rebasing on that was exceedingly hard, so I left it as a move. * This required changing update/go-generate -> update/codegen -- we need to get the ordering of tools right, which `go generate` does not guarantee. * Then I added a "middle" layer called "ServiceImpl" between the RPC and storage layers. This allows things like workflow to call the same business logic as the RPC layer, including validation. Lots of test fixes. * Then I finished the Create() and Update() paths for Actor. Those represent the "right" (or closest to) way to implement resources, and tests for validation. I strongly encourage reviewers to read it commit-by-commit. Rebasing this is VERY tedious, so the sooner it lands or dies completely, the better. Then we can start converting the rest. `./hack/run-tool.sh validation-gen --docs` will produce some docs on the tool and the available tags. @laoj2 @juli4n @EItanya @HavenXia @lalitc375 @yongruilin @jpbetz FYI | 3 months ago | |
Initialize OpenFGA server on ATE API Server bootstrap. (#1670) Working on https://github.com/agent-substrate/substrate/issues/1563 ## Summary Initializes an embedded OpenFGA server within `ateapi` backed by PostgreSQL and updates the top-level authorization scope. ## Key Changes - **Rename scope to `global`**: Renamed `type cluster` and `parent_cluster` to `type global` and `parent_global`, adding `can_set_policy` and `can_get_policy` to `global`. - **Embedded OpenFGA server (`internal/authz/server.go`)**: - Compiles `model.fga` into OpenFGA's protobuf representation. - Runs OpenFGA PostgreSQL schema migrations (`goose_db_version`). - Serializes startup via `pg_advisory_lock` to avoid multi-replica races. - Connects OpenFGA's PostgreSQL adapter with a new dedicated `*pgxpool.Pool`. - Idempotently creates or reuses the `"substrate"` store and authorization model. - **Service wiring (`cmd/ateapi`)**: Exposes `Pool()` on `*atepg.Persistence` and initializes `authz.NewServer` on bootstrap. ## Verification - `openfga model test`: 103/103 checks passing (`model_test.fga.yaml`). - `go test -mod=mod ./internal/authz/...`: Passes against PostgreSQL (migrations, tuple writes, permission checks, and restart idempotency). | 2 months ago | |
Use Kubernetes declarative validation (#1215) This mostly eliminates the need to hand-write validation code. This PR is a long series of commits which add DV for most of Actor and all of Atespace. Here is a map to the commits: * The first few take a dep on a new Kubernetes tag, import the code into third_party, and apply a single patch. Because we have different Go modules for tools, I had to do it twice. When that patch lands, we can revert these commits, but that won't be until the 1.38 cycle in a few months. * The next commits slowly add DV support, so a human can review each of them in a reasonable amount of time. The emphasis is on great test cases. * I made a bad choice early on as to where to generate the code into, so I moved it. Rebasing on that was exceedingly hard, so I left it as a move. * This required changing update/go-generate -> update/codegen -- we need to get the ordering of tools right, which `go generate` does not guarantee. * Then I added a "middle" layer called "ServiceImpl" between the RPC and storage layers. This allows things like workflow to call the same business logic as the RPC layer, including validation. Lots of test fixes. * Then I finished the Create() and Update() paths for Actor. Those represent the "right" (or closest to) way to implement resources, and tests for validation. I strongly encourage reviewers to read it commit-by-commit. Rebasing this is VERY tedious, so the sooner it lands or dies completely, the better. Then we can start converting the rest. `./hack/run-tool.sh validation-gen --docs` will produce some docs on the tool and the available tags. @laoj2 @juli4n @EItanya @HavenXia @lalitc375 @yongruilin @jpbetz FYI | 3 months ago | |
Initialize OpenFGA server on ATE API Server bootstrap. (#1670) Working on https://github.com/agent-substrate/substrate/issues/1563 ## Summary Initializes an embedded OpenFGA server within `ateapi` backed by PostgreSQL and updates the top-level authorization scope. ## Key Changes - **Rename scope to `global`**: Renamed `type cluster` and `parent_cluster` to `type global` and `parent_global`, adding `can_set_policy` and `can_get_policy` to `global`. - **Embedded OpenFGA server (`internal/authz/server.go`)**: - Compiles `model.fga` into OpenFGA's protobuf representation. - Runs OpenFGA PostgreSQL schema migrations (`goose_db_version`). - Serializes startup via `pg_advisory_lock` to avoid multi-replica races. - Connects OpenFGA's PostgreSQL adapter with a new dedicated `*pgxpool.Pool`. - Idempotently creates or reuses the `"substrate"` store and authorization model. - **Service wiring (`cmd/ateapi`)**: Exposes `Pool()` on `*atepg.Persistence` and initializes `authz.NewServer` on bootstrap. ## Verification - `openfga model test`: 103/103 checks passing (`model_test.fga.yaml`). - `go test -mod=mod ./internal/authz/...`: Passes against PostgreSQL (migrations, tuple writes, permission checks, and restart idempotency). | 2 months ago | |
Use Kubernetes declarative validation (#1215) This mostly eliminates the need to hand-write validation code. This PR is a long series of commits which add DV for most of Actor and all of Atespace. Here is a map to the commits: * The first few take a dep on a new Kubernetes tag, import the code into third_party, and apply a single patch. Because we have different Go modules for tools, I had to do it twice. When that patch lands, we can revert these commits, but that won't be until the 1.38 cycle in a few months. * The next commits slowly add DV support, so a human can review each of them in a reasonable amount of time. The emphasis is on great test cases. * I made a bad choice early on as to where to generate the code into, so I moved it. Rebasing on that was exceedingly hard, so I left it as a move. * This required changing update/go-generate -> update/codegen -- we need to get the ordering of tools right, which `go generate` does not guarantee. * Then I added a "middle" layer called "ServiceImpl" between the RPC and storage layers. This allows things like workflow to call the same business logic as the RPC layer, including validation. Lots of test fixes. * Then I finished the Create() and Update() paths for Actor. Those represent the "right" (or closest to) way to implement resources, and tests for validation. I strongly encourage reviewers to read it commit-by-commit. Rebasing this is VERY tedious, so the sooner it lands or dies completely, the better. Then we can start converting the rest. `./hack/run-tool.sh validation-gen --docs` will produce some docs on the tool and the available tags. @laoj2 @juli4n @EItanya @HavenXia @lalitc375 @yongruilin @jpbetz FYI | 3 months ago | |
Initialize OpenFGA server on ATE API Server bootstrap. (#1670) Working on https://github.com/agent-substrate/substrate/issues/1563 ## Summary Initializes an embedded OpenFGA server within `ateapi` backed by PostgreSQL and updates the top-level authorization scope. ## Key Changes - **Rename scope to `global`**: Renamed `type cluster` and `parent_cluster` to `type global` and `parent_global`, adding `can_set_policy` and `can_get_policy` to `global`. - **Embedded OpenFGA server (`internal/authz/server.go`)**: - Compiles `model.fga` into OpenFGA's protobuf representation. - Runs OpenFGA PostgreSQL schema migrations (`goose_db_version`). - Serializes startup via `pg_advisory_lock` to avoid multi-replica races. - Connects OpenFGA's PostgreSQL adapter with a new dedicated `*pgxpool.Pool`. - Idempotently creates or reuses the `"substrate"` store and authorization model. - **Service wiring (`cmd/ateapi`)**: Exposes `Pool()` on `*atepg.Persistence` and initializes `authz.NewServer` on bootstrap. ## Verification - `openfga model test`: 103/103 checks passing (`model_test.fga.yaml`). - `go test -mod=mod ./internal/authz/...`: Passes against PostgreSQL (migrations, tuple writes, permission checks, and restart idempotency). | 2 months ago | |
Upgrade Kubernetes libraries to v0.38.0-beta.0 (#4053) <!-- The PR title becomes the release note. Write it for users. --> `go.mod` replaced `k8s.io/apimachinery` with an untagged commit, and `hack/tools/code-generator` pinned the generators the same way, because declarative validation needs changes that first ship in Kubernetes 1.38. `v0.38.0-beta.0` has them, so the `k8s.io/*` modules move to that tag and the `replace` is gone. controller-runtime is pinned to a commit on `main`. Its releases still use structured-merge-diff v6, so their fake client does not compile against apimachinery v0.38. Only the first and last commits are hand edits. The rest are tool output: `go get` and `go mod tidy` for the two bump commits, and the script named in the title for the others. Runtime changes that come with the new modules: - atecontroller prints klog text lines on stderr at startup. The pinned controller-runtime logs its cache sync waits through klog. - Range errors on enum fields name the constant: `must be less than or equal to ACTOR_STATE_REVERTING`, where it was `7`. - atecontroller's metrics port serves OpenMetrics to scrapers that ask for it. - gRPC moves to v1.85.0 and OTel to v1.47.0. The regenerated validation code accepts and rejects the same input as before. The WorkerPool CRD diff is description text. Part of #3821 <!-- e.g. "AI-assisted, I reviewed and tested it." No AI co-author trailers. --> AI use: AI-assisted with Claude Code. It ran the bump and the generators, and drafted the commit messages and this description. I reviewed the diff. <!-- Breaking change? Describe what users must do on upgrade and ask for the `breaking-change` label. --> - [x] Tests pass (e2e and the root-gated tests were not run locally) - [x] Docs updated --------- Signed-off-by: Yongrui Lin <yongrlin@outlook.com> | 4 days ago | |
Upgrade Kubernetes libraries to v0.38.0-beta.0 (#4053) <!-- The PR title becomes the release note. Write it for users. --> `go.mod` replaced `k8s.io/apimachinery` with an untagged commit, and `hack/tools/code-generator` pinned the generators the same way, because declarative validation needs changes that first ship in Kubernetes 1.38. `v0.38.0-beta.0` has them, so the `k8s.io/*` modules move to that tag and the `replace` is gone. controller-runtime is pinned to a commit on `main`. Its releases still use structured-merge-diff v6, so their fake client does not compile against apimachinery v0.38. Only the first and last commits are hand edits. The rest are tool output: `go get` and `go mod tidy` for the two bump commits, and the script named in the title for the others. Runtime changes that come with the new modules: - atecontroller prints klog text lines on stderr at startup. The pinned controller-runtime logs its cache sync waits through klog. - Range errors on enum fields name the constant: `must be less than or equal to ACTOR_STATE_REVERTING`, where it was `7`. - atecontroller's metrics port serves OpenMetrics to scrapers that ask for it. - gRPC moves to v1.85.0 and OTel to v1.47.0. The regenerated validation code accepts and rejects the same input as before. The WorkerPool CRD diff is description text. Part of #3821 <!-- e.g. "AI-assisted, I reviewed and tested it." No AI co-author trailers. --> AI use: AI-assisted with Claude Code. It ran the bump and the generators, and drafted the commit messages and this description. I reviewed the diff. <!-- Breaking change? Describe what users must do on upgrade and ask for the `breaking-change` label. --> - [x] Tests pass (e2e and the root-gated tests were not run locally) - [x] Docs updated --------- Signed-off-by: Yongrui Lin <yongrlin@outlook.com> | 4 days ago | |
Drop k8s third_party deps now that HEAD is updated (#1480) The changes we need are live on HEAD of the k8s published repos. It was a bit of a journey, since Go fought me all the way. --- ### Drop our third_party fork of k8s deps in tools The changes we need are released now (sort of - on HEAD anyway). --- ### Bump k8s.io/streaming to v0.37.0 (not rc) in tools --- ### Bump codegen deps to HEAD in tools GOPROXY=direct go get \ k8s.io/apimachinery@master \ k8s.io/code-generator@master This pins them to HEAD of master. Go is terrible here: The HEAD is not actually tagged, so Go just uses the next "reachable" tag which is v0.36.0-alpha. The datestamp is correct, though. --- ### Drop our third_party fork of k8s deps in root The changes we need are released now (sort of - on HEAD anyway). --- ### Bump k8s deps to v0.37.0 (not rc) in root --- ### Bump apimachinery dep in root to HEAD in root GOPROXY=direct go mod edit -replace k8s.io/apimachinery=k8s.io/apimachinery@master GOPROXY=direct go mod tidy GOPROXY=direct go mod vendor GOPROXY=direct go mod tidy This approach (-replace) is needed because Go is horrible here. The master branch of k8s.io/apimachinery is not tagged, per se, but there is an OLDER tag which is "reachable" from HEAD. So go helpfully decides to use that (v0.36.0-alpha.2). If we just `go get ... @master` it works for that dep (pinned to the right date) but then it looks at transitive deps. Because the tag seems to be 0.36 (older), it recalculates all the OTHER dependencies and downgrades a whole tangle of things to versions that match 0.36, but we are ACTUALLY on 0.37+. This was the only approach that I (and Gemini) could find. Blech. --- ### Run updated codegens --- ### Use DV's new maxBytes capability for `[]byte` Removes 1 custom. | 2 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 3 months ago | ||
| 25 days ago | ||
| 3 months ago | ||
| 4 days ago | ||
| 2 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 3 months ago | ||
| 2 months ago | ||
| 4 days ago | ||
| 4 days ago | ||
| 2 months ago |