hook

command module
v0.1.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

hook

kubernetes admission webhook framework

install

go get github.com/chenhuazhong/hook

demo

package main

import (
    "github.com/chenhuazhong/hook/hook"
    "github.com/chenhuazhong/hook/service"
    "github.com/chenhuazhong/hook/utils"
    "k8s.io/apimachinery/pkg/runtime"
    "net/http"
)

func main(){
    h := service.Default()
    h.Validating("/validate", hook.ValidateFun{
        ValidateCreate: func(obj runtime.Object) hook.RST {
            return hook.RST{
                Code: 200,
                Result: true,
                Message: "ok",
            }
        },
    })
    h.Route("/health", func(w *utils.Reponse, r *http.Request) {
        w.WriteReponse([]byte("ok"), 200)
    })
    h.Run("0.0.0.0:8088", "server-cert.pem", "server-key.pem")
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL