Chore: fixes for admisison handlers (#90033)

This commit is contained in:
Andres Martinez Gotor 2024-07-04 10:49:51 +02:00 committed by GitHub
parent eef9a7b4e5
commit 844d575681
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 4 deletions

View File

@ -48,8 +48,8 @@ func (s *Service) MutateAdmission(ctx context.Context, req *backend.AdmissionReq
default:
return getBadRequest(fmt.Sprintf("expected apiVersion: v0alpha1, found: %s", settings.APIVersion)), nil
}
if settings.URL != "" {
return getBadRequest("unsupported URL value"), nil
if settings.URL == "" {
return getBadRequest("missing URL value"), nil
}
pb, err := backend.DataSourceInstanceSettingsToProtoBytes(settings)

View File

@ -48,8 +48,8 @@ func (s *Service) MutateAdmission(ctx context.Context, req *backend.AdmissionReq
default:
return getBadRequest(fmt.Sprintf("expected apiVersion: v0alpha1, found: %s", settings.APIVersion)), nil
}
if settings.URL != "" {
return getBadRequest("unsupported URL value"), nil
if settings.URL == "" {
return getBadRequest("missing URL value"), nil
}
pb, err := backend.DataSourceInstanceSettingsToProtoBytes(settings)

View File

@ -45,6 +45,17 @@ func (s *Service) CheckHealth(ctx context.Context, req *backend.CheckHealthReque
return s.lib.CheckHealth(ctx, req)
}
func (s *Service) ValidateAdmission(ctx context.Context, req *backend.AdmissionRequest) (*backend.ValidationResponse, error) {
return s.lib.ValidateAdmission(ctx, req)
}
func (s *Service) MutateAdmission(ctx context.Context, req *backend.AdmissionRequest) (*backend.MutationResponse, error) {
return s.lib.MutateAdmission(ctx, req)
}
func (s *Service) ConvertObject(ctx context.Context, req *backend.ConversionRequest) (*backend.ConversionResponse, error) {
return s.lib.ConvertObject(ctx, req)
}
func extendClientOpts(ctx context.Context, settings backend.DataSourceInstanceSettings, clientOpts *sdkhttpclient.Options) error {
// Set SigV4 service namespace
if clientOpts.SigV4 != nil {