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

SAP / sap-btp-service-operator / 25664426865

11 May 2026 10:22AM UTC coverage: 77.719% (-0.6%) from 78.279%
25664426865

push

github

web-flow
[INFRA] update dependencies (#633)

* [INFRA] update dependencies

* fix lint

---------

Co-authored-by: I501080 <keren.lahav@sap.com>

0 of 20 new or added lines in 2 files covered. (0.0%)

4 existing lines in 3 files now uncovered.

2815 of 3622 relevant lines covered (77.72%)

0.88 hits per line

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

82.5
/api/v1/servicebinding_types.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
        "github.com/SAP/sap-btp-service-operator/api/common"
21
        "github.com/SAP/sap-btp-service-operator/client/sm/types"
22
        v1 "k8s.io/api/authentication/v1"
23
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24
        "k8s.io/apimachinery/pkg/runtime"
25
)
26

27
// EDIT THIS FILE!  THIS IS SCAFFOLDING FOR YOU TO OWN!
28
// NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.
29

30
// ServiceBindingSpec defines the desired state of ServiceBinding
31
type ServiceBindingSpec struct {
32
        // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
33
        // Important: Run "make" to regenerate code after modifying this file
34

35
        // The k8s name of the service instance to bind, should be in the namespace of the binding
36
        // +required
37
        // +kubebuilder:validation:MinLength=1
38
        ServiceInstanceName string `json:"serviceInstanceName"`
39

40
        // The namespace of the referenced instance, if empty Binding's namespace will be used
41
        // +optional
42
        ServiceInstanceNamespace string `json:"serviceInstanceNamespace,omitempty"`
43

44
        // The name of the binding in Service Manager
45
        // +optional
46
        ExternalName string `json:"externalName"`
47

48
        // SecretName is the name of the secret where credentials will be stored
49
        // +optional
50
        SecretName string `json:"secretName"`
51

52
        // SecretKey is used as the key inside the secret to store the credentials
53
        // returned by the broker encoded as json to support complex data structures.
54
        // If not specified, the credentials returned by the broker will be used
55
        // directly as the secrets data.
56
        // +optional
57
        SecretKey *string `json:"secretKey,omitempty"`
58

59
        // SecretRootKey is used as the key inside the secret to store all binding
60
        // data including credentials returned by the broker and additional info under single key.
61
        // Convenient way to store whole binding data in single file when using `volumeMounts`.
62
        // +optional
63
        SecretRootKey *string `json:"secretRootKey,omitempty"`
64

65
        // Parameters for the binding.
66
        //
67
        // The Parameters field is NOT secret or secured in any way and should
68
        // NEVER be used to hold sensitive information. To set parameters that
69
        // contain secret information, you should ALWAYS store that information
70
        // in a Secret and use the ParametersFrom field.
71
        // +optional
72
        // +kubebuilder:pruning:PreserveUnknownFields
73
        Parameters *runtime.RawExtension `json:"parameters,omitempty"`
74

75
        // List of sources to populate parameters.
76
        // If a top-level parameter name exists in multiples sources among
77
        // `Parameters` and `ParametersFrom` fields, it is
78
        // considered to be a user error in the specification
79
        // +optional
80
        ParametersFrom []ParametersFromSource `json:"parametersFrom,omitempty"`
81

82
        // UserInfo contains information about the user that last modified this
83
        // instance. This field is set by the API server and not settable by the
84
        // end-user. User-provided values for this field are not saved.
85
        // +optional
86
        UserInfo *v1.UserInfo `json:"userInfo,omitempty"`
87

88
        // CredentialsRotationPolicy holds automatic credentials rotation configuration.
89
        // +optional
90
        CredRotationPolicy *CredentialsRotationPolicy `json:"credentialsRotationPolicy,omitempty"`
91

92
        // SecretTemplate is a Go template that generates a custom Kubernetes
93
        // v1/Secret based on data from the service binding returned by Service Manager and the instance information.
94
        // The generated secret is used instead of the default secret.
95
        // This is useful if the consumer of service binding data expects them in
96
        // a specific format.
97
        // For Go templates see https://pkg.go.dev/text/template.
98
        // For supported funcs see: https://pkg.go.dev/text/template#hdr-Functions, https://masterminds.github.io/sprig/
99
        // +optional
100
        // +kubebuilder:pruning:PreserveUnknownFields
101
        SecretTemplate string `json:"secretTemplate,omitempty"`
102
}
103

104
// ServiceBindingStatus defines the observed state of ServiceBinding
105
type ServiceBindingStatus struct {
106
        // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
107
        // Important: Run "make" to regenerate code after modifying this file
108

109
        // The ID of the instance in SM associated with binding
110
        // +optional
111
        InstanceID string `json:"instanceID,omitempty"`
112

113
        // The generated ID of the binding, will be automatically filled once the binding is created
114
        // +optional
115
        BindingID string `json:"bindingID,omitempty"`
116

117
        // URL of ongoing operation for the service binding
118
        OperationURL string `json:"operationURL,omitempty"`
119

120
        // The operation type (CREATE/UPDATE/DELETE) for ongoing operation
121
        OperationType types.OperationCategory `json:"operationType,omitempty"`
122

123
        // Service binding conditions
124
        Conditions []metav1.Condition `json:"conditions"`
125

126
        // Indicates whether binding is ready for usage
127
        Ready metav1.ConditionStatus `json:"ready,omitempty"`
128

129
        // Indicates when binding secret was rotated
130
        LastCredentialsRotationTime *metav1.Time `json:"lastCredentialsRotationTime,omitempty"`
131

132
        // The subaccount id of the service binding
133
        SubaccountID string `json:"subaccountID,omitempty"`
134

135
        // Last generation that was acted on
136
        ObservedGeneration int64 `json:"observedGeneration,omitempty"`
137

138
        AsyncBindFailed *bool `json:"asyncBindFailed,omitempty"`
139
}
140

141
// +kubebuilder:object:root=true
142
// +kubebuilder:subresource:status
143
// +kubebuilder:storageversion
144
// +kubebuilder:printcolumn:JSONPath=".spec.serviceInstanceName",name="Instance",type=string
145
// +kubebuilder:printcolumn:JSONPath=".status.conditions[0].reason",name="Status",type=string
146
// +kubebuilder:printcolumn:JSONPath=".status.ready",name="Ready",type=string
147
// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date
148
// +kubebuilder:printcolumn:JSONPath=".status.bindingID",name="ID",type=string,priority=1
149
// +kubebuilder:printcolumn:JSONPath=".status.conditions[0].message",name="Message",type=string,priority=1
150

151
// ServiceBinding is the Schema for the servicebindings API
152
type ServiceBinding struct {
153
        metav1.TypeMeta   `json:",inline"`
154
        metav1.ObjectMeta `json:"metadata,omitempty"`
155

156
        Spec   ServiceBindingSpec   `json:"spec,omitempty"`
157
        Status ServiceBindingStatus `json:"status,omitempty"`
158
}
159

160
func (sb *ServiceBinding) IsAsyncBindFailed() bool {
×
161
        return sb.Status.AsyncBindFailed != nil && *sb.Status.AsyncBindFailed
×
162
}
×
163

164
func (sb *ServiceBinding) GetConditions() []metav1.Condition {
1✔
165
        return sb.Status.Conditions
1✔
166
}
1✔
167

168
func (sb *ServiceBinding) SetConditions(conditions []metav1.Condition) {
1✔
169
        sb.Status.Conditions = conditions
1✔
170
}
1✔
171

172
func (sb *ServiceBinding) GetControllerName() common.ControllerName {
1✔
173
        return common.ServiceBindingController
1✔
174
}
1✔
175

176
func (sb *ServiceBinding) GetParameters() *runtime.RawExtension {
1✔
177
        return sb.Spec.Parameters
1✔
178
}
1✔
179

180
func (sb *ServiceBinding) GetStatus() interface{} {
1✔
181
        return sb.Status
1✔
182
}
1✔
183

184
func (sb *ServiceBinding) SetStatus(status interface{}) {
1✔
185
        sb.Status = status.(ServiceBindingStatus)
1✔
186
}
1✔
187

188
func (sb *ServiceBinding) DeepClone() common.SAPBTPResource {
1✔
189
        return sb.DeepCopy()
1✔
190
}
1✔
191

192
func (sb *ServiceBinding) GetReady() metav1.ConditionStatus {
1✔
193
        return sb.Status.Ready
1✔
194
}
1✔
195

196
func (sb *ServiceBinding) SetReady(ready metav1.ConditionStatus) {
1✔
197
        sb.Status.Ready = ready
1✔
198
}
1✔
199

200
func (sb *ServiceBinding) GetAnnotations() map[string]string {
1✔
201
        return sb.ObjectMeta.Annotations
1✔
202
}
1✔
203

204
func (sb *ServiceBinding) SetAnnotations(annotations map[string]string) {
1✔
205
        sb.ObjectMeta.Annotations = annotations
1✔
206
}
1✔
207

208
func (sb *ServiceBinding) SetObservedGeneration(newObserved int64) {
×
209
        sb.Status.ObservedGeneration = newObserved
×
210
}
×
211

212
// +kubebuilder:object:root=true
213

214
// ServiceBindingList contains a list of ServiceBinding
215
type ServiceBindingList struct {
216
        metav1.TypeMeta `json:",inline"`
217
        metav1.ListMeta `json:"metadata,omitempty"`
218
        Items           []ServiceBinding `json:"items"`
219
}
220

221
type CredentialsRotationPolicy struct {
222
        Enabled bool `json:"enabled"`
223
        // What frequency to perform binding rotation.
224
        RotationFrequency string `json:"rotationFrequency,omitempty"`
225
        // For how long to keep the rotated binding.
226
        RotatedBindingTTL string `json:"rotatedBindingTTL,omitempty"`
227
}
228

UNCOV
229
func (sb *ServiceBinding) Hub() {}
×
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