{"id":32161834,"url":"https://github.com/earnestresearch/kubernetes-webhook-haskell","last_synced_at":"2025-10-21T13:59:08.543Z","repository":{"id":56845207,"uuid":"237992405","full_name":"EarnestResearch/kubernetes-webhook-haskell","owner":"EarnestResearch","description":"Create Kubernetes Admission Webhooks in Haskell","archived":false,"fork":false,"pushed_at":"2023-12-15T17:35:23.000Z","size":44,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-21T13:59:06.206Z","etag":null,"topics":["admission-webhook","dhall","haskell","k8s","kubernetes","mutatingwebhookconfiguration","validatingwebhookconfiguration"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","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/EarnestResearch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-02-03T15:04:41.000Z","updated_at":"2020-08-14T14:52:23.000Z","dependencies_parsed_at":"2024-11-15T05:15:30.973Z","dependency_job_id":null,"html_url":"https://github.com/EarnestResearch/kubernetes-webhook-haskell","commit_stats":{"total_commits":17,"total_committers":3,"mean_commits":5.666666666666667,"dds":"0.11764705882352944","last_synced_commit":"ffbd5211dfbff5d5dab3e9f07e390f815df06b1a"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/EarnestResearch/kubernetes-webhook-haskell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EarnestResearch%2Fkubernetes-webhook-haskell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EarnestResearch%2Fkubernetes-webhook-haskell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EarnestResearch%2Fkubernetes-webhook-haskell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EarnestResearch%2Fkubernetes-webhook-haskell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EarnestResearch","download_url":"https://codeload.github.com/EarnestResearch/kubernetes-webhook-haskell/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EarnestResearch%2Fkubernetes-webhook-haskell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280272339,"owners_count":26302260,"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","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"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":["admission-webhook","dhall","haskell","k8s","kubernetes","mutatingwebhookconfiguration","validatingwebhookconfiguration"],"created_at":"2025-10-21T13:59:03.494Z","updated_at":"2025-10-21T13:59:08.537Z","avatar_url":"https://github.com/EarnestResearch.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kubernetes-webhook-haskell\n\nThis library lets you create [Kubernetes Admission Webhooks](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/) in Haskell.\n\nUsing webhooks in Kubernetes requires some configuration, in the [dhall](./dhall) directory you can find some useful templates that you can reuse to deploy your webhooks. [cert-manager](https://cert-manager.io/docs/) is required to be installed in the cluster to use the templates.\n\nExample webhook using Servant:\n```hs\nmodule Kubernetes.Example\n    ( startApp,\n    app,\n    )\nwhere\n\nimport Control.Monad.IO.Class\nimport qualified Data.Aeson as A\nimport qualified Data.ByteString as BS\nimport qualified Data.HashMap.Strict as HM\nimport Data.Text\nimport GHC.Generics\nimport qualified Kubernetes.Webhook as W\nimport Network.Wai\nimport Network.Wai.Handler.Warp\nimport Network.Wai.Handler.WarpTLS\nimport Servant\nimport System.Environment\n\ntype API =\n\"mutate\" :\u003e ReqBody '[JSON] W.AdmissionReviewRequest :\u003e Post '[JSON] W.AdmissionReviewResponse\n\ndata Toleration\n= Toleration\n    { effect :: Maybe TolerationEffect,\n        key :: Maybe Text,\n        operator :: Maybe TolerationOperator,\n        tolerationSeconds :: Maybe Integer,\n        value :: Maybe Text\n    }\nderiving (Generic, A.ToJSON)\n\ndata TolerationEffect = NoSchedule | PreferNoSchedule | NoExecute deriving (Generic, A.ToJSON)\n\ndata TolerationOperator = Exists | Equal deriving (Generic, A.ToJSON)\n\ntestToleration :: Toleration\ntestToleration =\nToleration\n    { effect = Just NoSchedule,\n    key = Just \"dedicated\",\n    operator = Just Equal,\n    tolerationSeconds = Nothing,\n    value = Just \"test\"\n    }\n\nstartApp :: IO ()\nstartApp = do\nlet tlsOpts = tlsSettings \"/certs/tls.crt\" \"/certs/tls.key\"\n    warpOpts = setPort 8080 defaultSettings\nrunTLS tlsOpts warpOpts app\n\napp :: Application\napp = serve api server\n\napi :: Proxy API\napi = Proxy\n\nserver :: Server API\nserver = mutate\n\nmutate :: W.AdmissionReviewRequest -\u003e Handler W.AdmissionReviewResponse\nmutate req = pure $ W.mutatingWebhook req (\\_ -\u003e Right addToleration)\n\naddToleration :: W.Patch\naddToleration = \nW.Patch\n    [ W.PatchOperation\n        { op = W.Add,\n        path = \"/spec/tolerations/-\",\n        from = Nothing,\n        value = Just $ A.toJSON testToleration\n        }\n    ]\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearnestresearch%2Fkubernetes-webhook-haskell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fearnestresearch%2Fkubernetes-webhook-haskell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearnestresearch%2Fkubernetes-webhook-haskell/lists"}