Skip to content

Commit

Permalink
Merge pull request #1501 from kevindelgado/doc-webhook-tls
Browse files Browse the repository at this point in the history
馃摉 Better document TLS requirements for webhook servers
  • Loading branch information
k8s-ci-robot committed Apr 29, 2021
2 parents e10bf72 + d0fe020 commit 485a24a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/webhook/admission/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ type StandaloneOptions struct {
// and instrumenting the webhook with metrics.
//
// Use this to attach your webhook to an arbitrary HTTP server or mux.
//
// Note that you are responsible for terminating TLS if you use StandaloneWebhook
// in your own server/mux. In order to be accessed by a kubernetes cluster,
// all webhook servers require TLS.
func StandaloneWebhook(hook *Webhook, opts StandaloneOptions) (http.Handler, error) {
if opts.Scheme == nil {
opts.Scheme = scheme.Scheme
Expand Down
4 changes: 4 additions & 0 deletions pkg/webhook/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func Example() {

// 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
func ExampleServer_StartStandalone() {
// Create a webhook server
hookServer := &Server{
Expand Down
6 changes: 6 additions & 0 deletions pkg/webhook/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ var DefaultPort = 9443

// Server is an admission webhook server that can serve traffic and
// generates related k8s resources for deploying.
//
// TLS is required for a webhook to be accessed by kubernetes, so
// you must provide a CertName and KeyName or have valid cert/key
// at the default locations (tls.crt and tls.key). If you do not
// want to configure TLS (i.e for testing purposes) run an
// admission.StandaloneWebhook in your own server.
type Server struct {
// Host is the address that the server will listen on.
// Defaults to "" - all addresses.
Expand Down

0 comments on commit 485a24a

Please sign in to comment.