{"id":20673847,"url":"https://github.com/bbbmj/k8s-crd-controller-example","last_synced_at":"2026-04-17T08:31:24.624Z","repository":{"id":57657089,"uuid":"154258950","full_name":"bbbmj/k8s-crd-controller-example","owner":"bbbmj","description":"Base example for a custom controller in Kubernetes working with custom resources. Based on https://github.com/resouer/k8s-controller-custom-resource.","archived":false,"fork":false,"pushed_at":"2018-10-23T08:51:44.000Z","size":4321,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T14:43:11.589Z","etag":null,"topics":["code-generator","crd","custom-control","custom-resource-definition","custom-resources","kubernetes","kubernetes-controller"],"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/bbbmj.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":"2018-10-23T03:52:10.000Z","updated_at":"2024-06-25T03:37:49.000Z","dependencies_parsed_at":"2022-08-26T05:20:35.127Z","dependency_job_id":null,"html_url":"https://github.com/bbbmj/k8s-crd-controller-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bbbmj/k8s-crd-controller-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbbmj%2Fk8s-crd-controller-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbbmj%2Fk8s-crd-controller-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbbmj%2Fk8s-crd-controller-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbbmj%2Fk8s-crd-controller-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbbmj","download_url":"https://codeload.github.com/bbbmj/k8s-crd-controller-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbbmj%2Fk8s-crd-controller-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31921774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","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":["code-generator","crd","custom-control","custom-resource-definition","custom-resources","kubernetes","kubernetes-controller"],"created_at":"2024-11-16T20:42:47.027Z","updated_at":"2026-04-17T08:31:24.601Z","avatar_url":"https://github.com/bbbmj.png","language":"Go","readme":"# k8s-crd-controller-example\n\nBased on `https://github.com/resouer/k8s-controller-custom-resource`.\n\n**Note**: the source code is _verbosely_ commented, so the source is meant to be read and to teach.\n\n## What's this?\n\nAn example of a custom Kubernetes controller that's only purpose is to watch for the creation, updating, or deletion of all custom resource of type `Network` (in the all namespaces). This was created as an exercise to understand how Kubernetes controllers work and interact with the cluster and resources.\n\n## Running\n\nClone repo:\n\n```bash\ngit clone https://github.com/bbbmj/k8s-crd-controller-example\ncd k8s-crd-controller-example\n```\n\nBuild and run:\n\n```bash\ngo build -o bin/samplecrd-controller ./cmd/\n./bin/samplecrd-controller -kubeconfig=$HOME/.kube/config -alsologtostderr=true\n```\n\nYou can also use `samplecrd-controller` to create a Deployment and run it in Kubernetes. Note in this case, you don't need to specify `-kubeconfig` in CMD as default `InClusterConfig` will be used.\n\n## Usage\n\nYou should create the CRD of Network first:\n\n```bash\nkubectl apply -f artifacts/network-crd.yaml\n```\n\nYou can then trigger an event by creating a Network API instance:\n\n```bash\nkubectl apply -f artifacts/my-network.yaml\n```\n\nCURD the Network API instance, and check the logs of controller.\n\nEnjoy!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbbmj%2Fk8s-crd-controller-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbbmj%2Fk8s-crd-controller-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbbmj%2Fk8s-crd-controller-example/lists"}