webhook

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvVarPVC1MountPath = "PVC_1_MOUNT_PATH"
	EnvVarPVC1UID       = "PVC_1_UID"
	EnvVarPVC1GID       = "PVC_1_GID"
)
View Source
const (
	LabelVolumeUID         = "volume.storage.kubesphere.io/uid"
	LabelVolumeGID         = "volume.storage.kubesphere.io/gid"
	LabelSpecificVolumeUID = "%s.volume.storage.kubesphere.io/uid"
	LabelSpecificVolumeGID = "%s.volume.storage.kubesphere.io/gid"
)

Variables

View Source
var CmdWebhook = &cobra.Command{
	Use:  "volume-initializer-webhook",
	Args: cobra.MaximumNArgs(0),
	Run:  main,
}

CmdWebhook is user by Cobra

Functions

This section is empty.

Types

type Admitter

type Admitter struct {
	// contains filtered or unexported fields
}

func NewAdmitter

func NewAdmitter() (*Admitter, error)

func (*Admitter) Admit

func (*Admitter) Decide

func (a *Admitter) Decide(ctx context.Context, reqInfo *ReqInfo) *admissionv1.AdmissionResponse

type AdmitterInterface

type AdmitterInterface interface {
	Admit(ar admissionv1.AdmissionReview) *admissionv1.AdmissionResponse
	Decide(ctx context.Context, reqInfo *ReqInfo) *admissionv1.AdmissionResponse
}

func NewAdmitterWithClient

func NewAdmitterWithClient(client client.Client) AdmitterInterface

type CertWatcher

type CertWatcher struct {
	sync.Mutex
	// contains filtered or unexported fields
}

CertWatcher watches certificate and key files for changes. When either file changes, it reads and parses both and calls an optional callback with the new certificate.

func NewCertWatcher

func NewCertWatcher(certPath, keyPath string) (*CertWatcher, error)

NewCertWatcher returns a new CertWatcher watching the given certificate and key.

func (*CertWatcher) GetCertificate

func (cw *CertWatcher) GetCertificate(_ *tls.ClientHelloInfo) (*tls.Certificate, error)

GetCertificate fetches the currently loaded certificate, which may be nil.

func (*CertWatcher) ReadCertificate

func (cw *CertWatcher) ReadCertificate() error

ReadCertificate reads the certificate and key files from disk, parses them, and updates the current certificate on the watcher. If a callback is set, it is invoked with the new certificate.

func (*CertWatcher) Start

func (cw *CertWatcher) Start(ctx context.Context) error

Start starts the watch on the certificate and key files.

func (*CertWatcher) Watch

func (cw *CertWatcher) Watch()

Watch reads events from the watcher's channel and reacts to changes.

type PVCInitContainer

type PVCInitContainer struct {
	PVC           *corev1.PersistentVolumeClaim
	Container     *corev1.Container
	MountPathRoot string
}

type ReqInfo

type ReqInfo struct {
	Pod *corev1.Pod
}

func NewReqInfo

func NewReqInfo(pod *corev1.Pod) *ReqInfo

Jump to

Keyboard shortcuts

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