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

SAP / sap-btp-service-operator / 21898172920

11 Feb 2026 08:39AM UTC coverage: 78.254% (-0.09%) from 78.346%
21898172920

push

github

web-flow
allow btpAccess credentials changes (#607)

* allow btpAccess credentials changes

* delete redundant test

0 of 1 new or added line in 1 file covered. (0.0%)

2 existing lines in 1 file now uncovered.

2778 of 3550 relevant lines covered (78.25%)

0.88 hits per line

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

50.0
/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
        "k8s.io/apimachinery/pkg/runtime"
27
        ctrl "sigs.k8s.io/controller-runtime"
28
        logf "sigs.k8s.io/controller-runtime/pkg/log"
29
        "sigs.k8s.io/controller-runtime/pkg/webhook"
30
        "sigs.k8s.io/controller-runtime/pkg/webhook/admission"
31
)
32

33
func (si *ServiceInstance) SetupWebhookWithManager(mgr ctrl.Manager) error {
×
34
        return ctrl.NewWebhookManagedBy(mgr).For(si).WithValidator(si).Complete()
×
35
}
×
36

37
// +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
38

39
var _ webhook.CustomValidator = &ServiceInstance{}
40

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

44
func (si *ServiceInstance) ValidateCreate(_ context.Context, _ runtime.Object) (warnings admission.Warnings, err error) {
×
45
        return nil, nil
×
46
}
×
47

NEW
48
func (si *ServiceInstance) ValidateUpdate(_ context.Context, _, _ runtime.Object) (warnings admission.Warnings, err error) {
×
UNCOV
49
        return nil, nil
×
UNCOV
50
}
×
51

52
func (si *ServiceInstance) ValidateDelete(_ context.Context, newObj runtime.Object) (warnings admission.Warnings, err error) {
1✔
53
        newInstance := newObj.(*ServiceInstance)
1✔
54
        serviceinstancelog.Info("validate delete", "name", newInstance.ObjectMeta.Name)
1✔
55
        if newInstance.ObjectMeta.Annotations != nil {
2✔
56
                preventDeletion, ok := newInstance.ObjectMeta.Annotations[common.PreventDeletion]
1✔
57
                if ok && strings.ToLower(preventDeletion) == "true" {
2✔
58
                        return nil, fmt.Errorf("service instance '%s' is marked with \"prevent deletion\"", newInstance.ObjectMeta.Name)
1✔
59
                }
1✔
60
        }
61
        return nil, nil
1✔
62
}
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