-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
38 lines (32 loc) · 936 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package webhook
import (
admissionv1 "k8s.io/api/admission/v1"
corev1 "k8s.io/api/core/v1"
"net/http"
)
type WebHookServerInt interface {
mutating(ar *admissionv1.AdmissionReview) *admissionv1.AdmissionResponse
validating(ar *admissionv1.AdmissionReview) *admissionv1.AdmissionResponse
Start()
Stop()
}
// Webhook Server parameters
type WebHookServerParameters struct {
Port int // webhook server port
CertFile string // path to the x509 certificate for https
KeyFile string // path to the x509 private key matching `CertFile`
SidecarCfgFile string
}
type webHookServer struct {
server *http.Server
sidecarConfig *Config
}
type Config struct {
Containers []corev1.Container `yaml:"containers"`
Volumes []corev1.Volume `yaml:"volumes"`
}
type patchOperation struct {
Op string `json:"op"`
Path string `json:"path"`
Value interface{} `json:"value,omitempty"`
}