Skip to content

Commit 871e07e

Browse files
committed
debug
1 parent 164ed0b commit 871e07e

File tree

1 file changed

+24
-0
lines changed
  • pkg/templateservicebroker/servicebroker

1 file changed

+24
-0
lines changed

pkg/templateservicebroker/servicebroker/bind.go

+24
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,13 @@ func (b *Broker) Bind(u user.Info, instanceID, bindingID string, breq *api.BindR
141141
return api.BadRequest(errs.ToAggregate())
142142
}
143143

144+
glog.Infof("1")
145+
144146
if len(breq.Parameters) != 0 {
145147
return api.BadRequest(errors.New("parameters not supported on bind"))
146148
}
147149

150+
glog.Infof("2")
148151
brokerTemplateInstance, err := b.templateclient.BrokerTemplateInstances().Get(instanceID, metav1.GetOptions{})
149152
if err != nil {
150153
if kerrors.IsNotFound(err) {
@@ -156,6 +159,8 @@ func (b *Broker) Bind(u user.Info, instanceID, bindingID string, breq *api.BindR
156159

157160
namespace := brokerTemplateInstance.Spec.TemplateInstance.Namespace
158161

162+
glog.Infof("3")
163+
159164
// end users are not expected to have access to BrokerTemplateInstance
160165
// objects; SAR on the TemplateInstance instead.
161166
if err := util.Authorize(b.kc.Authorization().SubjectAccessReviews(), u, &authorizationv1.ResourceAttributes{
@@ -171,6 +176,8 @@ func (b *Broker) Bind(u user.Info, instanceID, bindingID string, breq *api.BindR
171176
// since we can, cross-check breq.ServiceID and
172177
// templateInstance.Spec.Template.UID.
173178

179+
glog.Infof("4")
180+
174181
templateInstance, err := b.templateclient.TemplateInstances(namespace).Get(brokerTemplateInstance.Spec.TemplateInstance.Name, metav1.GetOptions{})
175182
if err != nil {
176183
return api.InternalServerError(err)
@@ -184,7 +191,11 @@ func (b *Broker) Bind(u user.Info, instanceID, bindingID string, breq *api.BindR
184191

185192
credentials := map[string]interface{}{}
186193

194+
glog.Infof("5")
195+
187196
for _, object := range templateInstance.Status.Objects {
197+
glog.Infof("6")
198+
188199
switch object.Ref.GroupVersionKind().GroupKind() {
189200
case kapi.Kind("ConfigMap"),
190201
kapi.Kind("Secret"),
@@ -195,11 +206,15 @@ func (b *Broker) Bind(u user.Info, instanceID, bindingID string, breq *api.BindR
195206
continue
196207
}
197208

209+
glog.Infof("7")
210+
198211
mapping, err := b.restmapper.RESTMapping(object.Ref.GroupVersionKind().GroupKind())
199212
if err != nil {
200213
return api.InternalServerError(err)
201214
}
202215

216+
glog.Infof("8")
217+
203218
if err := util.Authorize(b.kc.Authorization().SubjectAccessReviews(), u, &authorizationv1.ResourceAttributes{
204219
Namespace: object.Ref.Namespace,
205220
Verb: "get",
@@ -215,6 +230,8 @@ func (b *Broker) Bind(u user.Info, instanceID, bindingID string, breq *api.BindR
215230
return api.InternalServerError(err)
216231
}
217232

233+
glog.Infof("9")
234+
218235
obj, err := cli.Get().Resource(mapping.Resource).NamespaceIfScoped(object.Ref.Namespace, mapping.Scope.Name() == meta.RESTScopeNameNamespace).Name(object.Ref.Name).Do().Get()
219236
if err != nil {
220237
return api.InternalServerError(err)
@@ -229,6 +246,8 @@ func (b *Broker) Bind(u user.Info, instanceID, bindingID string, breq *api.BindR
229246
return api.InternalServerError(kerrors.NewNotFound(schema.GroupResource{Group: mapping.GroupVersionKind.Group, Resource: mapping.Resource}, object.Ref.Name))
230247
}
231248

249+
glog.Infof("10")
250+
232251
err = updateCredentialsForObject(credentials, obj)
233252
if err != nil {
234253
return api.InternalServerError(err)
@@ -249,6 +268,8 @@ func (b *Broker) Bind(u user.Info, instanceID, bindingID string, breq *api.BindR
249268
if status == http.StatusCreated { // binding not found; create it
250269
// end users are not expected to have access to BrokerTemplateInstance
251270
// objects; SAR on the TemplateInstance instead.
271+
glog.Infof("11")
272+
252273
if err := util.Authorize(b.kc.Authorization().SubjectAccessReviews(), u, &authorizationv1.ResourceAttributes{
253274
Namespace: namespace,
254275
Verb: "update",
@@ -260,11 +281,14 @@ func (b *Broker) Bind(u user.Info, instanceID, bindingID string, breq *api.BindR
260281
}
261282

262283
brokerTemplateInstance.Spec.BindingIDs = append(brokerTemplateInstance.Spec.BindingIDs, bindingID)
284+
glog.Infof("12")
285+
263286
brokerTemplateInstance, err = b.templateclient.BrokerTemplateInstances().Update(brokerTemplateInstance)
264287
if err != nil {
265288
return api.InternalServerError(err)
266289
}
267290
}
291+
glog.Infof("13")
268292

269293
return api.NewResponse(status, &api.BindResponse{Credentials: credentials}, nil)
270294
}

0 commit comments

Comments
 (0)