func (c *BackingServiceInstanceController) bindInstanceUPS(dc string, bsi *backingserviceinstanceapi.BackingServiceInstance) (err error) { glog.Infoln(backingserviceinstanceapi.UPS, "bsi to bind ", bsi.Name, " and ", dc) instanceBinding := backingserviceinstanceapi.InstanceBinding{} now := unversioned.Now() instanceBinding.BoundTime = &now //&unversioned.Now() instanceBinding.BindUuid = backingserviceinstanceapi.UPS instanceBinding.BindDeploymentConfig = dc instanceBinding.Credentials = bsi.Spec.Credentials /* instanceBinding.Credentials = make(map[string]string) for k, v := range bsi.Spec.Credentials{ instanceBinding.Credentials[k] = v } */ glog.Infoln("deploymentconfig_inject_envs") err = c.deploymentconfig_inject_envs_ups(dc, bsi, &instanceBinding) if err != nil { return err } else { bsi.Spec.Binding = append(bsi.Spec.Binding, instanceBinding) } glog.Infoln("bsi bound. ", bsi.Name) bsi.Spec.Bound += 1 bsi.Status.Phase = backingserviceinstanceapi.BackingServiceInstancePhaseBound bsi.Annotations[dc] = backingserviceinstanceapi.BindDeploymentConfigBound bsi.Status.Action = "" //remove_action_word(bsi.Status.Action, backingserviceinstanceapi.BackingServiceInstanceActionToBind) return }
func (c *BackingServiceInstanceController) bindInstance(dc string, bs *backingserviceapi.BackingService, bsi *backingserviceinstanceapi.BackingServiceInstance) (result error) { glog.Infoln("bsi to bind ", bsi.Name, " and ", dc) servicebroker, err := servicebroker_load(c.Client, bs.GenerateName) if err != nil { return err } bind_uuid := string(util.NewUUID()) servicebinding := &ServiceBinding{ ServiceId: bs.Spec.Id, PlanId: bsi.Spec.BackingServicePlanGuid, AppGuid: bsi.Namespace, //BindResource: , //Parameters: , svc_instance_id: bsi.Spec.InstanceID, } glog.Infoln("bsi to bind", bsi.Name) bindingresponse, err := servicebroker_binding(servicebinding, bind_uuid, servicebroker) if err != nil { return err } instanceBinding := backingserviceinstanceapi.InstanceBinding{} now := unversioned.Now() instanceBinding.BoundTime = &now //&unversioned.Now() instanceBinding.BindUuid = bind_uuid instanceBinding.BindDeploymentConfig = dc instanceBinding.Credentials = make(map[string]string) instanceBinding.Credentials["Uri"] = bindingresponse.Credentials.Uri instanceBinding.Credentials["Name"] = bindingresponse.Credentials.Name instanceBinding.Credentials["Username"] = bindingresponse.Credentials.Username instanceBinding.Credentials["Password"] = bindingresponse.Credentials.Password instanceBinding.Credentials["Host"] = bindingresponse.Credentials.Host instanceBinding.Credentials["Port"] = bindingresponse.Credentials.Port instanceBinding.Credentials["Vhost"] = bindingresponse.Credentials.Vhost // = bindingresponse.SyslogDrainUrl // = bindingresponse.RouteServiceUrl glog.Infoln("deploymentconfig_inject_envs") err = c.deploymentconfig_inject_envs(dc, bsi, &instanceBinding) if err != nil { return err } else { bsi.Spec.Binding = append(bsi.Spec.Binding, instanceBinding) } glog.Infoln("bsi bound. ", bsi.Name) bsi.Spec.Bound += 1 bsi.Status.Phase = backingserviceinstanceapi.BackingServiceInstancePhaseBound bsi.Annotations[dc] = backingserviceinstanceapi.BindDeploymentConfigBound bsi.Status.Action = "" //remove_action_word(bsi.Status.Action, backingserviceinstanceapi.BackingServiceInstanceActionToBind) return }