{"id":20083371,"url":"https://github.com/naeemrashid/k8s-controller-template","last_synced_at":"2025-10-29T15:11:33.246Z","repository":{"id":123986510,"uuid":"181870420","full_name":"naeemrashid/k8s-controller-template","owner":"naeemrashid","description":"A template to quick-start with kubernetes controller/operator implementation.","archived":false,"fork":false,"pushed_at":"2019-04-20T10:31:03.000Z","size":3662,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-13T01:47:43.958Z","etag":null,"topics":["k8s-controller","kubernetes-controller","kubernetes-operator"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/naeemrashid.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-17T10:39:07.000Z","updated_at":"2019-04-20T10:31:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"6eb0c3a1-64e0-433f-a2e7-f459ff4905db","html_url":"https://github.com/naeemrashid/k8s-controller-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naeemrashid%2Fk8s-controller-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naeemrashid%2Fk8s-controller-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naeemrashid%2Fk8s-controller-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/naeemrashid%2Fk8s-controller-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/naeemrashid","download_url":"https://codeload.github.com/naeemrashid/k8s-controller-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241515957,"owners_count":19975140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["k8s-controller","kubernetes-controller","kubernetes-operator"],"created_at":"2024-11-13T15:46:55.085Z","updated_at":"2025-10-29T15:11:33.134Z","avatar_url":"https://github.com/naeemrashid.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# k8s-controller-template\nA template to quick-start with kubernetes controller/operator implementation or more precisely kubernetes watcher to watch for changes in resources and apply custom logic. Template does not introduces new CRDs(Custom Resource Definitions) but that is intentional, have a look at kubernetes [sample-controller](https://github.com/kubernetes/sample-controller) for refrences.\n### Specify type of resources to watch for\nBelow is a watch loop for changes in Deployment resources\n```\ndeploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc:    controller.Create,\n\t\tUpdateFunc: controller.Update,\n\t\tDeleteFunc: controller.Delete,\n\t})\n```\n### Implement your custom logic Here\n\n```\n// ObjectCreated performs logic to create event.\nfunc (c *Controller) ObjectCreated(key string) error {\n\treturn nil\n}\n\n// ObjectUpdated performs logic to create event.\nfunc (c *Controller) ObjectUpdated(key string) error {\n\treturn nil\n}\n\n// ObjectDeleted performs logic to create event.\nfunc (c *Controller) ObjectDeleted(key string) error {\n\treturn nil\n}\n\n```\n### Build and Run\n\n```\n// vendor the project using\ngo get github.com/thenaeem/k8s-controller-template\n// Build container\nmake container\n// Deploy to Kuberentes as a single replica of Deployment.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaeemrashid%2Fk8s-controller-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaeemrashid%2Fk8s-controller-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaeemrashid%2Fk8s-controller-template/lists"}