webhook

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Source                  = "JsPolicy"
	PolicyReportPrefix      = "js-policy-report-ns-"
	ClusterPolicyReportName = "js-cluster-policy-report"

	CategoryAnnotation = "policy.jspolicy.com/category"
	SeverityAnnotation = "policy.jspolicy.com/severity"
)
View Source
const DefaultAuditLogSize = 20

Variables

This section is empty.

Functions

func LogRequest

func LogRequest(ctx context.Context, client client.Client, request admission.Request, response admission.Response, jsPolicy *policyv1beta1.JsPolicy, scheme *runtime.Scheme, retryCounter int)

func Register

func Register(mgr ctrl.Manager, vmPool vmpool.VMPool, enablePolicyReports bool, policyReportMaxEvents int) error

func ReportRequest added in v0.2.0

func ReportRequest(
	ctx context.Context,
	client client.Client,
	request admission.Request,
	response admission.Response,
	jsPolicy *policyv1beta1.JsPolicy,
	scheme *runtime.Scheme,
	maxEvents int,
	retryCounter int,
)

Types

type Handler

type Handler interface {
	Handle(context.Context, admission.Request, *policyv1beta1.JsPolicy) (admission.Response, *Response)
}

func NewHandler

func NewHandler(client client.Client, vmPool vmpool.VMPool) Handler

type Response

type Response struct {
	Deny     bool                   `json:"deny,omitempty"`
	Reason   string                 `json:"reason,omitempty"`
	Message  string                 `json:"message,omitempty"`
	Code     int                    `json:"code,omitempty"`
	Patched  map[string]interface{} `json:"patched,omitempty"`
	Warnings []string               `json:"warnings,omitempty"`

	// this is only used in background policies
	Reschedule bool `json:"reschedule,omitempty"`
}

type Webhook

type Webhook struct {
	Client  client.Client
	Handler Handler
	Scheme  *runtime.Scheme
	// contains filtered or unexported fields
}

func (*Webhook) ServeHTTP

func (wh *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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