You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: kubernetes-webhook-haskell.cabal
+1-84Lines changed: 1 addition & 84 deletions
Original file line number
Diff line number
Diff line change
@@ -11,90 +11,7 @@ category: Web
11
11
build-type: Simple
12
12
extra-source-files: README.md
13
13
cabal-version: >=1.10
14
-
description:
15
-
This library lets you create [Kubernetes Admission Webhooks](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/) in Haskell.
16
-
17
-
Using 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.
18
-
19
-
Example webhook using Servant:
20
-
```hs
21
-
module Kubernetes.Example
22
-
( startApp,
23
-
app,
24
-
)
25
-
where
26
-
27
-
import Control.Monad.IO.Class
28
-
import qualified Data.Aeson as A
29
-
import qualified Data.ByteString as BS
30
-
import qualified Data.HashMap.Strict as HM
31
-
import Data.Text
32
-
import GHC.Generics
33
-
import qualified Kubernetes.Webhook as W
34
-
import Network.Wai
35
-
import Network.Wai.Handler.Warp
36
-
import Network.Wai.Handler.WarpTLS
37
-
import Servant
38
-
import System.Environment
39
-
40
-
type API =
41
-
"mutate" :> ReqBody '[JSON] W.AdmissionReviewRequest :> Post '[JSON] W.AdmissionReviewResponse
mutate req = pure $ W.mutatingWebhook req (\_ -> Right W.Allowed) addToleration
84
-
85
-
addToleration :: W.Patch
86
-
addToleration =
87
-
W.Patch
88
-
[ W.PatchOperation
89
-
{ op = W.Add,
90
-
path = "/spec/tolerations/-",
91
-
from = Nothing,
92
-
value = Just $ A.toJSON testToleration
93
-
}
94
-
]
95
-
```
96
-
97
-
14
+
description: This library lets you create [Kubernetes Admission Webhooks](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/) in Haskell.
0 commit comments