{"id":51858590,"url":"https://github.com/stuttgart-things/function-homerun2-pitcher","last_synced_at":"2026-07-24T03:31:08.886Z","repository":{"id":357997964,"uuid":"1237804387","full_name":"stuttgart-things/function-homerun2-pitcher","owner":"stuttgart-things","description":"Crossplane v2 Operation function (Python) that pitches watched-resource events to homerun2-omni-pitcher /pitch endpoint","archived":false,"fork":false,"pushed_at":"2026-05-15T06:43:44.000Z","size":32,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-15T08:14:40.029Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stuttgart-things.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-13T14:22:17.000Z","updated_at":"2026-05-15T06:43:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/stuttgart-things/function-homerun2-pitcher","commit_stats":null,"previous_names":["stuttgart-things/function-homerun2-pitcher"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/stuttgart-things/function-homerun2-pitcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuttgart-things%2Ffunction-homerun2-pitcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuttgart-things%2Ffunction-homerun2-pitcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuttgart-things%2Ffunction-homerun2-pitcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuttgart-things%2Ffunction-homerun2-pitcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stuttgart-things","download_url":"https://codeload.github.com/stuttgart-things/function-homerun2-pitcher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuttgart-things%2Ffunction-homerun2-pitcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35826032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-24T02:00:07.870Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-24T03:31:07.452Z","updated_at":"2026-07-24T03:31:08.827Z","avatar_url":"https://github.com/stuttgart-things.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# function-homerun2-pitcher\n\nA Crossplane **v2 Operation function** (Python) that pitches every\nwatched-resource event to the\n[homerun2-omni-pitcher](https://github.com/stuttgart-things/homerun2-omni-pitcher)\n`/pitch` endpoint. The pitcher then writes the payload to a Redis\nstream for downstream consumers.\n\n```\n+------------------+    inject     +-------------------------+    POST /pitch\n| WatchOperation   | ------------\u003e | function-homerun2-pitch | --------------\u003e homerun2-omni-pitcher --\u003e Redis Streams\n| (watches K8s     |               | (this function)         |\n|  resources)      |               +-------------------------+\n+------------------+\n```\n\n## Requirements\n\n- Crossplane **v2.x** installed with `--enable-operations`\n  (Operations is the API group that ships `WatchOperation`).\n- A reachable `homerun2-omni-pitcher` service.\n- A Bearer token shared between this function and the pitcher.\n\n## Install\n\nApply the Function manifest (see [`examples/function.yaml`](examples/function.yaml)):\n\n```yaml\napiVersion: pkg.crossplane.io/v1\nkind: Function\nmetadata:\n  name: function-homerun2-pitcher\nspec:\n  package: ghcr.io/stuttgart-things/function-homerun2-pitcher:v0.1.0\n  runtimeConfigRef:\n    apiVersion: pkg.crossplane.io/v1beta1\n    kind: DeploymentRuntimeConfig\n    name: function-homerun2-pitcher\n```\n\nThe package declares `spec.capabilities: [operation]`, so Crossplane\nwill accept it in `WatchOperation` pipeline steps.\n\n## Configure\n\n### Input schema (`fn.homerun.io/v1alpha1` · `PitchInput`)\n\nSet this on the WatchOperation's `pipeline[].input`:\n\n| Field            | Required | Default      | Notes                                                                  |\n| ---------------- | -------- | ------------ | ---------------------------------------------------------------------- |\n| `endpoint`       | yes      | —            | Base URL of `homerun2-omni-pitcher`; the function POSTs to `/pitch`.   |\n| `stream`         | yes      | —            | Redis stream name forwarded to the pitcher.                            |\n| `payloadMode`    | no       | `envelope`   | `full` = entire watched resource; `envelope` = stable subset (below).  |\n| `timeoutSeconds` | no       | `10`         | HTTP timeout (`\u003e0`, `\u003c=300`).                                          |\n\nEnvelope shape:\n\n```json\n{\n  \"apiVersion\": \"...\", \"kind\": \"...\",\n  \"namespace\": \"...\", \"name\": \"...\",\n  \"uid\": \"...\", \"resourceVersion\": \"...\",\n  \"spec\": { ... }, \"status\": { ... }\n}\n```\n\n### Auth token\n\nThe function reads `PITCH_AUTH_TOKEN` from its pod environment and\nsends it as `Authorization: Bearer \u003ctoken\u003e`. Mount it from a\n`Secret` via `DeploymentRuntimeConfig`:\n\n```yaml\n# secret.yaml\napiVersion: v1\nkind: Secret\nmetadata:\n  name: homerun2-pitcher-auth\n  namespace: crossplane-system\nstringData:\n  token: \u003cbearer token shared with the pitcher\u003e\n```\n\n```yaml\n# runtimeconfig.yaml — wires the secret into the function pod\napiVersion: pkg.crossplane.io/v1beta1\nkind: DeploymentRuntimeConfig\nmetadata:\n  name: function-homerun2-pitcher\nspec:\n  deploymentTemplate:\n    spec:\n      selector: {}\n      template:\n        spec:\n          containers:\n            - name: package-runtime\n              env:\n                - name: PITCH_AUTH_TOKEN\n                  valueFrom:\n                    secretKeyRef:\n                      name: homerun2-pitcher-auth\n                      key: token\n```\n\nThe pod fails fast on startup if `PITCH_AUTH_TOKEN` is missing — pass\n`--skip-token-check` only when running locally (`hatch run development`).\n\n## Example\n\nA runnable end-to-end demo (watch ConfigMaps in `demo` → pitch each\nchange → land messages in Redis) lives in\n[`examples/`](examples/README.md).\n\n## Develop\n\n```sh\nhatch env create\nhatch run development              # gRPC server on :9443 (insecure, debug)\nhatch run test                     # pytest\ntask build                         # both amd64 + arm64 xpkgs into dist/\n```\n\nA quick render check against the example WatchOperation:\n\n```sh\ncrossplane render \\\n  examples/watchoperation.yaml \\\n  examples/function.yaml \\\n  \u003c(echo \"{}\")\n```\n\n## Troubleshooting\n\n| Symptom                                                                     | Likely cause                                                                                       |\n| --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |\n| `FATAL: PITCH_AUTH_TOKEN env var is required` in function pod logs           | Secret/runtimeconfig not applied before the Function. Apply them, then `kubectl rollout restart`. |\n| Result `pitcher returned 401: …`                                            | Token in the Secret doesn't match `AUTH_TOKEN` on the pitcher.                                     |\n| Result `no watched resource found under required-resource key …`            | Crossplane is not running with `--enable-operations`, or the Function lacks `operation` capability.|\n| Result `pitcher request timed out after Ns`                                 | Pitcher unreachable or slow; raise `timeoutSeconds` or check service.                              |\n| Function pod healthy but no pitches arrive                                  | Confirm WatchOperation is selecting the resource: `kubectl describe watchoperation \u003cname\u003e`.        |\n\n## Related\n\n- [homerun2-omni-pitcher](https://github.com/stuttgart-things/homerun2-omni-pitcher) — the receiving service.\n- [Crossplane Operations](https://docs.crossplane.io/) — `WatchOperation`, `CronOperation`, `Operation`.\n- [function-template-python](https://github.com/crossplane/function-template-python) — upstream scaffold.\n\n## License\n\nApache-2.0 — see [`LICENSE`](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuttgart-things%2Ffunction-homerun2-pitcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstuttgart-things%2Ffunction-homerun2-pitcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuttgart-things%2Ffunction-homerun2-pitcher/lists"}