• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SAP / sap-btp-service-operator / 24987069232

27 Apr 2026 09:24AM UTC coverage: 78.534% (-0.05%) from 78.585%
24987069232

push

github

web-flow
go update (#625)

* go update

* update libs

* update libs

* update libs

* update libs

* Revert "update libs"

This reverts commit c9effaab1.

24 of 29 new or added lines in 3 files covered. (82.76%)

5 existing lines in 1 file now uncovered.

2828 of 3601 relevant lines covered (78.53%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.06
/api/v1/serviceinstance_validating_webhook.go
1
/*
2

3

4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7

8
    http://www.apache.org/licenses/LICENSE-2.0
9

10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16

17
package v1
18

19
import (
20
        "context"
21
        "fmt"
22
        "strings"
23

24
        "github.com/SAP/sap-btp-service-operator/api/common"
25

26
        ctrl "sigs.k8s.io/controller-runtime"
27
        logf "sigs.k8s.io/controller-runtime/pkg/log"
28
        "sigs.k8s.io/controller-runtime/pkg/webhook/admission"
29
)
30

31
func (si *ServiceInstance) SetupWebhookWithManager(mgr ctrl.Manager) error {
×
NEW
32
        return ctrl.NewWebhookManagedBy(mgr, si).WithValidator(si).Complete()
×
33
}
×
34

35
// +kubebuilder:webhook:verbs=delete;update;create,path=/validate-services-cloud-sap-com-v1-serviceinstance,mutating=false,failurePolicy=fail,groups=services.cloud.sap.com,resources=serviceinstances,versions=v1,name=vserviceinstance.kb.io,sideEffects=None,admissionReviewVersions=v1beta1;v1
36

37
var _ admission.Validator[*ServiceInstance] = &ServiceInstance{}
38

39
// log is for logging in this package.
40
var serviceinstancelog = logf.Log.WithName("serviceinstance-resource")
41

NEW
42
func (si *ServiceInstance) ValidateCreate(_ context.Context, _ *ServiceInstance) (warnings admission.Warnings, err error) {
×
43
        return nil, nil
×
44
}
×
45

NEW
46
func (si *ServiceInstance) ValidateUpdate(_ context.Context, _, _ *ServiceInstance) (warnings admission.Warnings, err error) {
×
47
        return nil, nil
×
48
}
×
49

50
func (si *ServiceInstance) ValidateDelete(_ context.Context, obj *ServiceInstance) (warnings admission.Warnings, err error) {
1✔
51
        serviceinstancelog.Info("validate delete", "name", obj.ObjectMeta.Name)
1✔
52
        if obj.ObjectMeta.Annotations != nil {
2✔
53
                preventDeletion, ok := obj.ObjectMeta.Annotations[common.PreventDeletion]
1✔
54
                if ok && strings.ToLower(preventDeletion) == "true" {
2✔
55
                        return nil, fmt.Errorf("service instance '%s' is marked with \"prevent deletion\"", obj.ObjectMeta.Name)
1✔
56
                }
1✔
57
        }
58
        return nil, nil
1✔
59
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc