{"id":13846248,"url":"https://github.com/mikkeloscar/pdb-controller","last_synced_at":"2025-04-12T05:13:08.980Z","repository":{"id":44593929,"uuid":"103788279","full_name":"mikkeloscar/pdb-controller","owner":"mikkeloscar","description":"Controller for adding default Pod Disruption Budgets to Kubernetes Deployments and StatefulSets","archived":false,"fork":false,"pushed_at":"2025-02-06T10:34:32.000Z","size":193,"stargazers_count":50,"open_issues_count":7,"forks_count":12,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-12T05:13:01.145Z","etag":null,"topics":["budget","controller","disruption","golang","kubernetes","pod"],"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/mikkeloscar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2017-09-16T22:40:34.000Z","updated_at":"2025-02-06T10:34:37.000Z","dependencies_parsed_at":"2024-04-30T09:52:19.579Z","dependency_job_id":null,"html_url":"https://github.com/mikkeloscar/pdb-controller","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikkeloscar%2Fpdb-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikkeloscar%2Fpdb-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikkeloscar%2Fpdb-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikkeloscar%2Fpdb-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikkeloscar","download_url":"https://codeload.github.com/mikkeloscar/pdb-controller/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248519556,"owners_count":21117761,"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":["budget","controller","disruption","golang","kubernetes","pod"],"created_at":"2024-08-04T18:00:20.953Z","updated_at":"2025-04-12T05:13:08.952Z","avatar_url":"https://github.com/mikkeloscar.png","language":"Go","funding_links":[],"categories":["Operators vs Controllers"],"sub_categories":["Admission"],"readme":"# Pod Disruption Budget Controller\n[![Build Status](https://github.com/mikkeloscar/pdb-controller/workflows/ci/badge.svg)](https://github.com/mikkeloscar/pdb-controller/actions?query=branch:master)\n[![Coverage Status](https://coveralls.io/repos/github/mikkeloscar/pdb-controller/badge.svg)](https://coveralls.io/github/mikkeloscar/pdb-controller)\n\nThis is a simple Kubernetes controller for adding default [Pod Disruption\nBudgets (PDBs)][pdb] for Deployments and StatefulSets in case none are defined. This\nis inspired by the dicussion in\n[kubernetes/kubernetes#35318](https://github.com/kubernetes/kubernetes/issues/35318)\nand was created for lack of an alternative.\n\n## How it works\n\nThe controller simply gets all Pod Disruption Budgets for each namespace and\ncompares them to Deployments and StatefulSets. For any resource with more than\n1 replica and no matching Pod Disruption Budget, a default PDB will be created:\n\n```yaml\napiVersion: policy/v1beta1\nkind: PodDisruptionBudget\nmetadata:\n  name: my-app\n  namespace: kube-system\n  labels:\n    application: my-app\n    heritage: pdb-controller\n    version: v1.0.0\nspec:\n  maxUnavailable: 1\n  selector:\n    matchLabels:\n      application: my-app\n```\n\nThe selector and labels are based on those from the related Deployment or\nStatefulSet. The special `heritage=pdb-controller` label is set by the\ncontroller and is used to find owned PDBs. Owned PDBs are removed in case\nreplicas of the related resource is scaled to 1 or less. This\nis done to prevent deadlocking for clients depending on the PDBs e.g. cluster\nupgrade tools.\n\nAdditionally you can run the controller with the flag `--non-ready-ttl=15m`\nwhich means it will remove owned PDBs in case the pods of a targeted deployment\nor statefulset are non-ready for more than the specified ttl. This is another\nway to ensure broken deployments doesn't block cluster operations.\n\nThis global value can also be overriden by specifying the annotation\n`pdb-controller.zalando.org/non-ready-ttl` on a deployment or statefulset.\n\n## Building\n\nThis project uses [Go modules](https://github.com/golang/go/wiki/Modules) as\nintroduced in Go 1.11 therefore you need Go \u003e=1.11 installed in order to build.\nIf using Go 1.11 you also need to [activate Module\nsupport](https://github.com/golang/go/wiki/Modules#installing-and-activating-module-support).\n\nAssuming Go has been setup with module support it can be built simply by running:\n\n```sh\n$ make\n```\n\n## Setup\n\nThe `pdb-controller` can be run as a deployment in the cluster. See\n[deployment.yaml](docs/deployment.yaml) for an example.\n\nDeploy it by running:\n\n```bash\n$ kubectl apply -f docs/deployment.yaml\n```\n\n## TODO\n\n* [ ] Instead of long polling, add a Watch feature.\n\n## LICENSE\n\nSee [LICENSE](LICENSE) file.\n\n[pdb]: https://kubernetes.io/docs/tasks/run-application/configure-pdb/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikkeloscar%2Fpdb-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikkeloscar%2Fpdb-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikkeloscar%2Fpdb-controller/lists"}