dist/origin-web-common-services.js
function(serviceInstance, application, serviceClass, parameters) {
        var parametersSecretName;
        if (!_.isEmpty(parameters)) {
          parametersSecretName = generateSecretName(serviceInstance.metadata.name + '-bind-parameters-');
        }

        var newBinding = makeBinding(serviceInstance, application, parametersSecretName);
        var context = {
          namespace: serviceInstance.metadata.namespace
        };

        var promise = DataService.create(serviceBindingsVersion, null, newBinding, context);
        if (!parametersSecretName) {
          return promise;
        }

        // Create the secret as well if the binding has parameters.
        return promise.then(function(binding) {
          var parametersSecret = makeParametersSecret(parametersSecretName, parameters, binding);
          return DataService.create(secretsVersion, null, parametersSecret, context).then(function() {
            return binding;
          });
        });
      }
function(serviceInstance, application, serviceClass, parameters) {
        var parametersSecretName;
        if (!_.isEmpty(parameters)) {
          parametersSecretName = generateSecretName(serviceInstance.metadata.name + '-bind-parameters-');
        }

        var newBinding = makeBinding(serviceInstance, application, parametersSecretName);
        var context = {
          namespace: serviceInstance.metadata.namespace
        };

        var promise = DataService.create(serviceBindingsVersion, null, newBinding, context);
        if (!parametersSecretName) {
          return promise;
        }

        // Create the secret as well if the binding has parameters.
        return promise.then(function(binding) {
          var parametersSecret = makeParametersSecret(parametersSecretName, parameters, binding);
          return DataService.create(secretsVersion, null, parametersSecret, context).then(function() {
            return binding;
          });
        });
      }
function ( serviceInstance , application , serviceClass , parameters ) { var parametersSecretName ; if ( ! _ . isEmpty ( parameters ) ) { parametersSecretName = generateSecretName ( serviceInstance . metadata . name + '-bind-parameters-' ) ; } var newBinding = makeBinding ( serviceInstance , application , parametersSecretName ) ; var context = { namespace : serviceInstance . metadata . namespace } ; var promise = DataService . create ( serviceBindingsVersion , null , newBinding , context ) ; if ( ! parametersSecretName ) { return promise ; } // Create the secret as well if the binding has parameters. return promise . then ( function ( binding ) { var parametersSecret = makeParametersSecret ( parametersSecretName , parameters , binding ) ; return DataService . create ( secretsVersion , null , parametersSecret , context ) . then ( function ( ) { return binding ; } ) ; } ) ; }
Create a binding for `serviceInstance`. If an `application` API object is specified, also create a pod preset for that application using its `spec.selector`. `serviceClass` is required to determine if any parameters need to be set when creating the binding.
Create a binding for serviceInstance . If an application API object is specified also create a pod preset for that application using its spec . selector . serviceClass is required to determine if any parameters need to be set when creating the binding .