webhook

package
v0.0.0-...-caa799e Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: AGPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Deserializer is used to decode the admission request body.
	Deserializer = codecs.UniversalDeserializer()

	// UUIDAnnotation uuid key for annotation.
	UUIDAnnotation = "sidecar.bytetrade.io/proxy-uuid"
)

Functions

func CreatePatchForDeployment

func CreatePatchForDeployment(tpl *corev1.PodTemplateSpec, namespace string, gpuRequired *resource.Quantity, typeKey string, envKeyValues []EnvKeyValue) ([]byte, error)

CreatePatchForDeployment add gpu env for deployment and returns patch bytes.

Types

type EnvKeyValue

type EnvKeyValue struct {
	Key   string
	Value string
}

type Webhook

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

Webhook used to implement a webhook.

func New

func New(config *rest.Config) (*Webhook, error)

New create a webhook client.

func (*Webhook) AdmissionError

func (wh *Webhook) AdmissionError(uid types.UID, err error) *admissionv1.AdmissionResponse

AdmissionError wraps error as AdmissionResponse

func (*Webhook) CreateOrUpdateAppLabelMutatingWebhook

func (wh *Webhook) CreateOrUpdateAppLabelMutatingWebhook() error

CreateOrUpdateAppLabelMutatingWebhook creates or updates app mutating webhook.

func (*Webhook) CreateOrUpdateAppNamespaceValidatingWebhook

func (wh *Webhook) CreateOrUpdateAppNamespaceValidatingWebhook() error

CreateOrUpdateAppNamespaceValidatingWebhook creates or updates app namespace validating webhook.

func (*Webhook) CreateOrUpdateApplicationManagerMutatingWebhook

func (wh *Webhook) CreateOrUpdateApplicationManagerMutatingWebhook() error

CreateOrUpdateApplicationManagerMutatingWebhook creates or updates the ApplicationManager mutating webhook.

func (*Webhook) CreateOrUpdateApplicationManagerValidatingWebhook

func (wh *Webhook) CreateOrUpdateApplicationManagerValidatingWebhook() error

CreateOrUpdateApplicationManagerValidatingWebhook creates or updates the ApplicationManager validating webhook.

func (*Webhook) CreateOrUpdateArgoResourceValidatingWebhook

func (wh *Webhook) CreateOrUpdateArgoResourceValidatingWebhook() error

CreateOrUpdateArgoResourceValidatingWebhook creates or updates the argo resource validating webhook.

func (*Webhook) CreateOrUpdateCronWorkflowMutatingWebhook

func (wh *Webhook) CreateOrUpdateCronWorkflowMutatingWebhook() error

func (*Webhook) CreateOrUpdateGpuLimitMutatingWebhook

func (wh *Webhook) CreateOrUpdateGpuLimitMutatingWebhook() error

CreateOrUpdateGpuLimitMutatingWebhook creates or updates gpu limit mutating webhook.

func (*Webhook) CreateOrUpdateProviderRegistryValidatingWebhook

func (wh *Webhook) CreateOrUpdateProviderRegistryValidatingWebhook() error

func (*Webhook) CreateOrUpdateRunAsUserMutatingWebhook

func (wh *Webhook) CreateOrUpdateRunAsUserMutatingWebhook() error

CreateOrUpdateRunAsUserMutatingWebhook creates or updates gpu limit mutating webhook.

func (*Webhook) CreateOrUpdateSandboxMutatingWebhook

func (wh *Webhook) CreateOrUpdateSandboxMutatingWebhook() error

CreateOrUpdateSandboxMutatingWebhook creates or updates the sandbox mutating webhook.

func (*Webhook) CreateOrUpdateUserValidatingWebhook

func (wh *Webhook) CreateOrUpdateUserValidatingWebhook() error

CreateOrUpdateUserValidatingWebhook creates or updates user validating webhook.

func (*Webhook) CreatePatch

func (wh *Webhook) CreatePatch(
	ctx context.Context,
	pod *corev1.Pod,
	req *admissionv1.AdmissionRequest,
	proxyUUID uuid.UUID, injectPolicy, injectWs, injectUpload bool,
	injectSharedPod *bool,
	appmgr *v1alpha1.ApplicationManager,
	appcfg *appcfg_mod.ApplicationConfig,
	perms []appcfg.ProviderPermission,
) ([]byte, error)

CreatePatch create a patch for a pod.

func (*Webhook) DeleteKubeletEvictionValidatingWebhook

func (wh *Webhook) DeleteKubeletEvictionValidatingWebhook() error

func (*Webhook) GetAdmissionRequestBody

func (wh *Webhook) GetAdmissionRequestBody(req *restful.Request, resp *restful.Response) ([]byte, bool)

GetAdmissionRequestBody returns admission request body.

func (*Webhook) GetAppConfig

func (wh *Webhook) GetAppConfig(namespace string) (appMgr *v1alpha1.ApplicationManager, appCfg *appcfg_mod.ApplicationConfig, isShared bool, err error)

GetAppConfig get app config by namespace.

func (*Webhook) MustInject

func (wh *Webhook) MustInject(ctx context.Context, pod *corev1.Pod, namespace string) (
	injectPolicy, injectWs, injectUpload bool, injectSharedPod *bool, perms []appcfg.ProviderPermission,
	appCfg *appcfg_mod.ApplicationConfig, appMgr *v1alpha1.ApplicationManager, err error)

MustInject checks which inject operation should do for a pod.

func (*Webhook) PatchAdmissionResponse

func (wh *Webhook) PatchAdmissionResponse(resp *admissionv1.AdmissionResponse, patchBytes []byte)

PatchAdmissionResponse returns an admission response with patch data.

Jump to

Keyboard shortcuts

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