feat(go): bump relevant components to 1.21 (#987)

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
This commit is contained in:
Oliver Bähler
2024-02-20 16:15:43 +01:00
committed by GitHub
parent 65a743903d
commit e16202f3cf
48 changed files with 129 additions and 82 deletions

View File

@@ -58,7 +58,7 @@ func NewForbiddenError(key string, forbiddenSpec ForbiddenListSpec) error {
}
}
//nolint:predeclared
//nolint:predeclared,revive
func (f *ForbiddenError) appendForbiddenError() (append string) {
append += "Forbidden are "
if len(f.spec.Exact) > 0 {

View File

@@ -31,8 +31,8 @@ type CapsuleCA struct {
func (c CapsuleCA) CACertificatePem() (b *bytes.Buffer, err error) {
var crtBytes []byte
crtBytes, err = x509.CreateCertificate(rand.Reader, c.certificate, c.certificate, &c.key.PublicKey, c.key)
crtBytes, err = x509.CreateCertificate(rand.Reader, c.certificate, c.certificate, &c.key.PublicKey, c.key)
if err != nil {
return
}
@@ -147,8 +147,8 @@ func NewCertificateAuthorityFromBytes(certBytes, keyBytes []byte) (*CapsuleCA, e
//nolint:nakedret
func (c *CapsuleCA) GenerateCertificate(opts CertificateOptions) (certificatePem *bytes.Buffer, certificateKey *bytes.Buffer, err error) {
var certPrivKey *rsa.PrivateKey
certPrivKey, err = rsa.GenerateKey(rand.Reader, 4096)
certPrivKey, err = rsa.GenerateKey(rand.Reader, 4096)
if err != nil {
return nil, nil, err
}
@@ -172,18 +172,18 @@ func (c *CapsuleCA) GenerateCertificate(opts CertificateOptions) (certificatePem
}
var certBytes []byte
certBytes, err = x509.CreateCertificate(rand.Reader, cert, c.certificate, &certPrivKey.PublicKey, c.key)
certBytes, err = x509.CreateCertificate(rand.Reader, cert, c.certificate, &certPrivKey.PublicKey, c.key)
if err != nil {
return nil, nil, err
}
certificatePem = new(bytes.Buffer)
err = pem.Encode(certificatePem, &pem.Block{
Type: "CERTIFICATE",
Bytes: certBytes,
})
if err != nil {
return
}

View File

@@ -34,8 +34,8 @@ func (h *handler) OnCreate(client client.Client, decoder *admission.Decoder, rec
}
}
func (h *handler) OnDelete(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (h *handler) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -102,7 +102,7 @@ func (i ingressClassNotValidError) Error() string {
return utils.DefaultAllowedValuesErrorMessage(i.spec, err)
}
//nolint:predeclared
//nolint:predeclared,revive
func appendHostnameError(spec api.AllowedListSpec) (append string) {
if len(spec.Exact) > 0 {
append = fmt.Sprintf(", specify one of the following (%s)", strings.Join(spec.Exact, ", "))

View File

@@ -32,7 +32,6 @@ func TenantFromIngress(ctx context.Context, c client.Client, ingress Ingress) (*
return &tenantList.Items[0], nil
}
//nolint:nakedret
func FromRequest(req admission.Request, decoder *admission.Decoder) (ingress Ingress, err error) {
switch req.Kind.Group {
case "networking.k8s.io":

View File

@@ -45,7 +45,7 @@ func (r *class) OnUpdate(client client.Client, decoder *admission.Decoder, recor
}
func (r *class) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -47,7 +47,7 @@ func (r *collision) OnUpdate(client client.Client, decoder *admission.Decoder, r
}
func (r *collision) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -41,7 +41,7 @@ func (r *hostnames) OnUpdate(c client.Client, decoder *admission.Decoder, record
}
func (r *hostnames) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -31,8 +31,8 @@ func (h *wildcard) OnCreate(client client.Client, decoder *admission.Decoder, re
}
}
func (h *wildcard) OnDelete(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (h *wildcard) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -27,13 +27,13 @@ func PatchHandler() capsulewebhook.Handler {
}
func (r *patchHandler) OnCreate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
func (r *patchHandler) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -69,13 +69,13 @@ func (r *prefixHandler) OnCreate(clt client.Client, decoder *admission.Decoder,
}
func (r *prefixHandler) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
func (r *prefixHandler) OnUpdate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -59,13 +59,13 @@ func (r *quotaHandler) OnCreate(client client.Client, decoder *admission.Decoder
}
func (r *quotaHandler) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
func (r *quotaHandler) OnUpdate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -64,8 +64,8 @@ func (r *userMetadataHandler) OnCreate(client client.Client, decoder *admission.
}
}
func (r *userMetadataHandler) OnDelete(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (r *userMetadataHandler) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -10,7 +10,7 @@ import (
capsulev1beta2 "github.com/projectcapsule/capsule/pkg/api"
)
//nolint:predeclared
//nolint:predeclared,revive
func appendForbiddenError(spec *capsulev1beta2.ForbiddenListSpec) (append string) {
append += "Forbidden are "
if len(spec.Exact) > 0 {

View File

@@ -30,14 +30,14 @@ func UserMetadataHandler(configuration configuration.Configuration, ver *version
}
}
func (r *userMetadataHandler) OnCreate(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (r *userMetadataHandler) OnCreate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
func (r *userMetadataHandler) OnDelete(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (r *userMetadataHandler) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
@@ -78,8 +78,8 @@ func (r *userMetadataHandler) getForbiddenNodeAnnotations(node *corev1.Node) map
return forbiddenNodeAnnotations
}
func (r *userMetadataHandler) OnUpdate(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (r *userMetadataHandler) OnUpdate(_ client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(_ context.Context, req admission.Request) *admission.Response {
nodeWebhookSupported, _ := utils.NodeWebhookSupported(r.version)
if !nodeWebhookSupported {

View File

@@ -42,14 +42,14 @@ func (h *handler) OnCreate(client client.Client, decoder *admission.Decoder, rec
}
}
func (h *handler) OnDelete(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (h *handler) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
func (h *handler) OnUpdate(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (h *handler) OnUpdate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(_ context.Context, req admission.Request) *admission.Response {
oldNs := &corev1.Namespace{}
if err := decoder.DecodeRaw(req.OldObject, oldNs); err != nil {
return utils.ErroredResponse(err)

View File

@@ -30,7 +30,7 @@ func (h *containerRegistryHandler) OnCreate(c client.Client, decoder *admission.
}
func (h *containerRegistryHandler) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -66,13 +66,13 @@ func (r *imagePullPolicy) OnCreate(c client.Client, decoder *admission.Decoder,
}
func (r *imagePullPolicy) OnUpdate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
func (r *imagePullPolicy) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -85,13 +85,13 @@ func (h *priorityClass) OnCreate(c client.Client, decoder *admission.Decoder, re
}
func (h *priorityClass) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
func (h *priorityClass) OnUpdate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -44,13 +44,13 @@ func (h *runtimeClass) OnCreate(c client.Client, decoder *admission.Decoder, rec
}
func (h *runtimeClass) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
func (h *runtimeClass) OnUpdate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -34,7 +34,7 @@ func PersistentVolumeReuse() capsulewebhook.Handler {
}
}
func (p PV) OnCreate(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
func (p PV) OnCreate(client client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
pvc := corev1.PersistentVolumeClaim{}
if err := decoder.Decode(req, &pvc); err != nil {

View File

@@ -88,13 +88,13 @@ func (h *validating) OnCreate(c client.Client, decoder *admission.Decoder, recor
}
func (h *validating) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
func (h *validating) OnUpdate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -138,7 +138,7 @@ func (r *handler) OnUpdate(client client.Client, decoder *admission.Decoder, rec
}
func (r *handler) OnDelete(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -41,7 +41,7 @@ func (h *containerRegistryRegexHandler) validate(decoder *admission.Decoder, req
}
func (h *containerRegistryRegexHandler) OnCreate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
if err := h.validate(decoder, req); err != nil {
return err
}
@@ -56,8 +56,8 @@ func (h *containerRegistryRegexHandler) OnDelete(client.Client, *admission.Decod
}
}
func (h *containerRegistryRegexHandler) OnUpdate(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (h *containerRegistryRegexHandler) OnUpdate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(_ context.Context, req admission.Request) *admission.Response {
if response := h.validate(decoder, req); response != nil {
return response
}

View File

@@ -47,7 +47,7 @@ func (r *resourceCounterHandler) getTenantName(ctx context.Context, clt client.C
return tntList.Items[0].GetName(), nil
}
func (r *resourceCounterHandler) OnCreate(clt client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
func (r *resourceCounterHandler) OnCreate(clt client.Client, _ *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
var tntName string
@@ -79,8 +79,8 @@ func (r *resourceCounterHandler) OnCreate(clt client.Client, decoder *admission.
return err
}
used, _ := capsulev1beta2.GetUsedResourceFromTenant(*tnt, kgv)
used, _ := capsulev1beta2.GetUsedResourceFromTenant(*tnt, kgv)
if used >= limit {
return NewCustomResourceQuotaError(kgv, limit)
}
@@ -101,7 +101,7 @@ func (r *resourceCounterHandler) OnCreate(clt client.Client, decoder *admission.
}
}
func (r *resourceCounterHandler) OnDelete(clt client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
func (r *resourceCounterHandler) OnDelete(clt client.Client, _ *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
var tntName string
@@ -145,8 +145,8 @@ func (r *resourceCounterHandler) OnDelete(clt client.Client, decoder *admission.
}
}
func (r *resourceCounterHandler) OnUpdate(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (r *resourceCounterHandler) OnUpdate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -50,7 +50,7 @@ func (h *forbiddenAnnotationsRegexHandler) validate(decoder *admission.Decoder,
}
func (h *forbiddenAnnotationsRegexHandler) OnCreate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
if err := h.validate(decoder, req); err != nil {
return err
}
@@ -65,8 +65,8 @@ func (h *forbiddenAnnotationsRegexHandler) OnDelete(client.Client, *admission.De
}
}
func (h *forbiddenAnnotationsRegexHandler) OnUpdate(client client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (h *forbiddenAnnotationsRegexHandler) OnUpdate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(_ context.Context, req admission.Request) *admission.Response {
if response := h.validate(decoder, req); response != nil {
return response
}

View File

@@ -23,7 +23,7 @@ func FreezedEmitter() capsulewebhook.Handler {
}
func (h *freezedEmitterHandler) OnCreate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
@@ -35,7 +35,7 @@ func (h *freezedEmitterHandler) OnDelete(client.Client, *admission.Decoder, reco
}
func (h *freezedEmitterHandler) OnUpdate(_ client.Client, decoder *admission.Decoder, recorder record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
oldTnt := &capsulev1beta2.Tenant{}
if err := decoder.DecodeRaw(req.OldObject, oldTnt); err != nil {
return utils.ErroredResponse(err)

View File

@@ -41,7 +41,7 @@ func (h *hostnameRegexHandler) validate(decoder *admission.Decoder, req admissio
}
func (h *hostnameRegexHandler) OnCreate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
if response := h.validate(decoder, req); response != nil {
return response
}
@@ -57,7 +57,7 @@ func (h *hostnameRegexHandler) OnDelete(client.Client, *admission.Decoder, recor
}
func (h *hostnameRegexHandler) OnUpdate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
if err := h.validate(decoder, req); err != nil {
return err
}

View File

@@ -41,7 +41,7 @@ func (h *ingressClassRegexHandler) validate(decoder *admission.Decoder, req admi
}
func (h *ingressClassRegexHandler) OnCreate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
if response := h.validate(decoder, req); response != nil {
return response
}
@@ -57,7 +57,7 @@ func (h *ingressClassRegexHandler) OnDelete(client.Client, *admission.Decoder, r
}
func (h *ingressClassRegexHandler) OnUpdate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
if err := h.validate(decoder, req); err != nil {
return err
}

View File

@@ -23,8 +23,8 @@ func MetaHandler() capsulewebhook.Handler {
return &metaHandler{}
}
func (h *metaHandler) OnCreate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
func (h *metaHandler) OnCreate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}
@@ -36,7 +36,7 @@ func (h *metaHandler) OnDelete(client.Client, *admission.Decoder, record.EventRe
}
func (h *metaHandler) OnUpdate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
tenant := &capsulev1beta2.Tenant{}
if err := decoder.Decode(req, tenant); err != nil {
return utils.ErroredResponse(err)

View File

@@ -23,7 +23,7 @@ func NameHandler() capsulewebhook.Handler {
}
func (h *nameHandler) OnCreate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
tenant := &capsulev1beta2.Tenant{}
if err := decoder.Decode(req, tenant); err != nil {
return utils.ErroredResponse(err)
@@ -47,7 +47,7 @@ func (h *nameHandler) OnDelete(client.Client, *admission.Decoder, record.EventRe
}
func (h *nameHandler) OnUpdate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}

View File

@@ -28,7 +28,7 @@ func (h *protectedHandler) OnCreate(client.Client, *admission.Decoder, record.Ev
}
}
func (h *protectedHandler) OnDelete(clt client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
func (h *protectedHandler) OnDelete(clt client.Client, _ *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
tenant := &capsulev1beta2.Tenant{}

View File

@@ -41,7 +41,7 @@ func (h *storageClassRegexHandler) validate(decoder *admission.Decoder, req admi
}
func (h *storageClassRegexHandler) OnCreate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
if err := h.validate(decoder, req); err != nil {
return err
}
@@ -57,7 +57,7 @@ func (h *storageClassRegexHandler) OnDelete(client.Client, *admission.Decoder, r
}
func (h *storageClassRegexHandler) OnUpdate(_ client.Client, decoder *admission.Decoder, _ record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(_ context.Context, req admission.Request) *admission.Response {
if err := h.validate(decoder, req); err != nil {
return err
}

View File

@@ -71,7 +71,7 @@ func (h *cordoningHandler) handler(ctx context.Context, clt client.Client, req a
}
func (h *cordoningHandler) OnCreate(client.Client, *admission.Decoder, record.EventRecorder) capsulewebhook.Func {
return func(ctx context.Context, req admission.Request) *admission.Response {
return func(context.Context, admission.Request) *admission.Response {
return nil
}
}