{"id":40918383,"url":"https://github.com/imikushin/controllers-af","last_synced_at":"2026-01-22T03:21:26.305Z","repository":{"id":57575909,"uuid":"190086289","full_name":"imikushin/controllers-af","owner":"imikushin","description":"A tiny Go library for building Kubernetes Controllers - As Functions","archived":false,"fork":false,"pushed_at":"2022-05-12T21:25:58.000Z","size":76,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-16T01:11:42.317Z","etag":null,"topics":["controller-runtime","go","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","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/imikushin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-03T21:41:12.000Z","updated_at":"2022-01-13T00:09:19.000Z","dependencies_parsed_at":"2022-08-28T18:02:10.122Z","dependency_job_id":null,"html_url":"https://github.com/imikushin/controllers-af","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/imikushin/controllers-af","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imikushin%2Fcontrollers-af","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imikushin%2Fcontrollers-af/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imikushin%2Fcontrollers-af/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imikushin%2Fcontrollers-af/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imikushin","download_url":"https://codeload.github.com/imikushin/controllers-af/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imikushin%2Fcontrollers-af/sbom","scorecard":{"id":485546,"data":{"date":"2025-08-11","repo":{"name":"github.com/imikushin/controllers-af","commit":"0bcaffd904a577ff77a88382cc01adcfa7205048"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/9 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: example/Dockerfile:2","Warn: containerImage not pinned by hash: example/Dockerfile:22: pin your Docker image by updating gcr.io/distroless/static:nonroot to gcr.io/distroless/static:nonroot@sha256:cdf4daaf154e3e27cfffc799c16f343a384228f38646928a1513d925f473cb46","Info:   0 out of   2 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T17:40:02.115Z","repository_id":57575909,"created_at":"2025-08-19T17:40:02.115Z","updated_at":"2025-08-19T17:40:02.115Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28652190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"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":["controller-runtime","go","kubernetes"],"created_at":"2026-01-22T03:21:25.722Z","updated_at":"2026-01-22T03:21:26.299Z","avatar_url":"https://github.com/imikushin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Controllers AF\n\nA Go library for building Kubernetes Controllers - As Functions\n\n### Why\n\nBuilding Kubernetes controllers is hard. One of the reasons is: it is very hard to write unit-tests for controllers. Why\nis that? Controllers need to talk to the Kubernetes API all the time, and it takes enormous discipline to mock out these\ninteractions. So, what ends up happening: we don't do it, and our controllers become branching spaghetti monsters.\n\nEnter Controllers AF. It is a tiny library (or micro-framework) built on top\nof [controller-runtime](https://github.com/kubernetes-sigs/controller-runtime)\nand is designed to do one thing: separate controller logic from interactions with Kubernetes API. Usage section below\nillustrates how to use it. We also provide a fully functioning [example](example).\n\n### Usage\n\n```go\npackage yourcontroller\n\nimport (\n\t\"context\"\n\n\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\tctrl \"sigs.k8s.io/controller-runtime\"\n\t\"sigs.k8s.io/controller-runtime/pkg/client\"\n\t\"sigs.k8s.io/controller-runtime/pkg/source\"\n\n\t\"github.com/imikushin/controllers-af/function\"\n\t\"github.com/imikushin/controllers-af/reconciler\"\n\n\tyourapiv1alpha1 \"github.com/your/awesome-controller/api/v1alpha1\"\n)\n\nfunc SetupWithManager(mgr ctrl.Manager) error {\n\ttheClient := mgr.GetClient()\n\tlog := ctrl.Log.WithName(\"controllers\").WithName(\"YourObject\")\n\n\tyourReconciler := reconciler.New(theClient, log, \u0026yourapiv1alpha1.YourObject{}, ReconcileFun)\n\t\n\treturn ctrl.NewControllerManagedBy(mgr).For(\u0026yourapiv1alpha1.YourObject{}).Complete(yourReconciler)\n}\n\nfunc ReconcileFun(_ context.Context, object client.Object, getDetails function.GetDetails) (*function.Effects, error) {\n\tyourObject := object.(*yourapiv1alpha1.YourObject)\n\t\n\tyourOtherObjects := getDetails(function.Query{\n\t\tNamespace: yourObject.Namespace,\n\t\tType:      \u0026yourapiv1alpha1.YourOtherObjectList{},\n\t\tSelector:  metav1.LabelSelectorAsSelector(yourObject.Spec.YourOtherObjectSelector),\n\t}).(*YourOtherObjectList)\n\t\n\t// calculate your effects - no need to talk to the API!\n\n\treturn \u0026function.Effects{\n\t\tPersists: []client.Object{create, or, update, these},\n\t\tDeletes: []client.Object{things, toDelete},\n\t}, nil\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimikushin%2Fcontrollers-af","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimikushin%2Fcontrollers-af","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimikushin%2Fcontrollers-af/lists"}