MCPcopy Index your code
hub / github.com/kubernetes-sigs/controller-runtime / ExampleServer_Start

Function ExampleServer_Start

pkg/webhook/example_test.go:89–105  ·  view source on GitHub ↗

This example creates a webhook server that can be ran without a controller manager. Note that this assumes and requires a valid TLS cert and key at the default locations tls.crt and tls.key.

()

Source from the content-addressed store, hash-verified

87// cert and key at the default locations
88// tls.crt and tls.key.
89func ExampleServer_Start() {
90 // Create a webhook server
91 hookServer := NewServer(Options{
92 Port: 8443,
93 })
94
95 // Register the webhooks in the server.
96 hookServer.Register("/mutating", mutatingHook)
97 hookServer.Register("/validating", validatingHook)
98
99 // Start the server without a manger
100 err := hookServer.Start(signals.SetupSignalHandler())
101 if err != nil {
102 // handle error
103 panic(err)
104 }
105}
106
107// This example creates a standalone webhook handler
108// and runs it on a vanilla go HTTP server to demonstrate

Callers

nothing calls this directly

Calls 4

RegisterMethod · 0.95
StartMethod · 0.95
SetupSignalHandlerFunction · 0.92
NewServerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…