Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
origin-web-common
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Java-于龙
origin-web-common
Commits
5a278b38
Commit
5a278b38
authored
Sep 22, 2017
by
Samuel Padgett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adopt service catalog API changes
parent
1ae1d255
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
117 additions
and
99 deletions
+117
-99
origin-web-common-services.js
dist/origin-web-common-services.js
+32
-29
origin-web-common-ui.js
dist/origin-web-common-ui.js
+6
-3
origin-web-common.js
dist/origin-web-common.js
+39
-33
origin-web-common.min.js
dist/origin-web-common.min.js
+0
-0
templates.js
dist/scripts/templates.js
+2
-2
bindApplicationForm.html
src/components/binding/bindApplicationForm.html
+1
-1
bindServiceForm.html
src/components/binding/bindServiceForm.html
+1
-1
bindServiceForm.js
src/components/binding/bindServiceForm.js
+0
-1
apiPreferredVersions.js
src/constants/apiPreferredVersions.js
+6
-3
resources.js
src/filters/resources.js
+4
-0
bindService.js
src/services/bindService.js
+26
-26
No files found.
dist/origin-web-common-services.js
View file @
5a278b38
...
...
@@ -1112,25 +1112,26 @@ angular.module("openshiftCommonServices")
.
service
(
"BindingService"
,
function
(
$filter
,
$q
,
APIService
,
AuthService
,
DataService
,
DNS1123_SUBDOMAIN_VALIDATION
)
{
// The secret key this service uses for the parameters JSON blob when binding.
var
PARAMETERS_SECRET_KEY
=
'parameters'
;
var
bindingResource
=
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstancecredentials'
};
var
bindingResource
=
APIService
.
getPreferredVersion
(
'servicebindings'
);
var
getServiceClassForInstance
=
function
(
serviceInstance
,
serviceClasses
)
{
var
serviceClassName
=
_
.
get
(
serviceInstance
,
'spec.serviceClassName'
);
return
_
.
get
(
serviceClasses
,
[
serviceClassName
]);
};
if
(
!
serviceClasses
)
{
return
null
;
}
var
serviceClassName
=
_
.
get
(
serviceInstance
,
'spec.serviceClassRef.name'
);
if
(
!
serviceClassName
)
{
return
null
;
}
var
getPlanForInstance
=
function
(
serviceInstance
,
serviceClass
)
{
var
planName
=
_
.
get
(
serviceInstance
,
'spec.planName'
);
return
_
.
find
(
serviceClass
.
plans
,
{
name
:
planName
});
return
serviceClasses
[
serviceClassName
];
};
var
generateName
=
$filter
(
'generateName'
);
...
...
@@ -1173,7 +1174,6 @@ angular.module("openshiftCommonServices")
};
var
makeBinding
=
function
(
serviceInstance
,
application
,
parametersSecretName
)
{
var
parametersSecretName
;
var
instanceName
=
serviceInstance
.
metadata
.
name
;
var
credentialSecretName
=
generateSecretName
(
serviceInstance
.
metadata
.
name
+
'-credentials-'
);
...
...
@@ -1217,7 +1217,11 @@ angular.module("openshiftCommonServices")
return
binding
;
};
var
isServiceBindable
=
function
(
serviceInstance
,
serviceClasses
)
{
var
isServiceBindable
=
function
(
serviceInstance
,
serviceClass
,
servicePlan
)
{
if
(
!
serviceInstance
||
!
serviceClass
||
!
servicePlan
)
{
return
false
;
}
// If being deleted, it is not bindable
if
(
_
.
get
(
serviceInstance
,
'metadata.deletionTimestamp'
))
{
return
false
;
...
...
@@ -1228,13 +1232,7 @@ angular.module("openshiftCommonServices")
return
false
;
}
var
serviceClass
=
getServiceClassForInstance
(
serviceInstance
,
serviceClasses
);
if
(
!
serviceClass
)
{
return
!!
serviceInstance
;
}
var
plan
=
getPlanForInstance
(
serviceInstance
,
serviceClass
);
var
planBindable
=
_
.
get
(
plan
,
'bindable'
);
var
planBindable
=
_
.
get
(
servicePlan
,
'spec.bindable'
);
if
(
planBindable
===
true
)
{
return
true
;
}
...
...
@@ -1242,8 +1240,8 @@ angular.module("openshiftCommonServices")
return
false
;
}
// If `plan.
bindable` is not set, fall back to `serviceClass
.bindable`.
return
serviceClass
.
bindable
;
// If `plan.
spec.bindable` is not set, fall back to `serviceClass.spec
.bindable`.
return
serviceClass
.
spec
.
bindable
;
};
var
getPodPresetSelectorsForBindings
=
function
(
bindings
)
{
...
...
@@ -1285,13 +1283,15 @@ angular.module("openshiftCommonServices")
return
resourceBindings
;
};
var
filterBindableServiceInstances
=
function
(
serviceInstances
,
serviceClasses
)
{
if
(
!
serviceInstances
&&
!
serviceClasse
s
)
{
var
filterBindableServiceInstances
=
function
(
serviceInstances
,
serviceClasses
,
servicePlans
)
{
if
(
!
serviceInstances
||
!
serviceClasses
||
!
servicePlan
s
)
{
return
null
;
}
return
_
.
filter
(
serviceInstances
,
function
(
serviceInstance
)
{
return
isServiceBindable
(
serviceInstance
,
serviceClasses
);
var
serviceClassName
=
_
.
get
(
serviceInstance
,
'spec.serviceClassRef.name'
);
var
servicePlanName
=
_
.
get
(
serviceInstance
,
'spec.servicePlanRef.name'
);
return
isServiceBindable
(
serviceInstance
,
serviceClasses
[
serviceClassName
],
servicePlans
[
servicePlanName
]);
});
};
...
...
@@ -1302,7 +1302,8 @@ angular.module("openshiftCommonServices")
return
_
.
sortBy
(
serviceInstances
,
function
(
item
)
{
return
_
.
get
(
serviceClasses
,
[
item
.
spec
.
serviceClassName
,
'externalMetadata'
,
'displayName'
])
||
item
.
spec
.
serviceClassName
;
var
serviceClassName
=
_
.
get
(
item
,
'spec.serviceClassRef.name'
);
return
_
.
get
(
serviceClasses
,
[
serviceClassName
,
'spec'
,
'externalMetadata'
,
'displayName'
])
||
item
.
spec
.
externalServiceClassName
;
},
function
(
item
)
{
return
_
.
get
(
item
,
'metadata.name'
,
''
);
...
...
@@ -1313,7 +1314,6 @@ angular.module("openshiftCommonServices")
return
{
bindingResource
:
bindingResource
,
getServiceClassForInstance
:
getServiceClassForInstance
,
getPlanForInstance
:
getPlanForInstance
,
// Create a binding for `serviceInstance`. If an `application` API object
// is specified, also create a pod preset for that application using its
...
...
@@ -3669,6 +3669,10 @@ angular.module('openshiftCommonServices')
'buildconfigs/instantiate'
:
{
group
:
'build.openshift.io'
,
version
:
'v1'
,
resource
:
'buildconfigs/instantiate'
},
buildconfigs
:
{
group
:
'build.openshift.io'
,
version
:
'v1'
,
resource
:
'buildconfigs'
},
configmaps
:
{
version
:
'v1'
,
resource
:
'configmaps'
},
// Using the anticipated name for the resources, even though they aren't yet prefixed with `cluster`.
// https://github.com/kubernetes-incubator/service-catalog/issues/1288
clusterserviceclasses
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceclasses'
},
clusterserviceplans
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceplans'
},
deployments
:
{
group
:
'apps'
,
version
:
'v1beta1'
,
resource
:
'deployments'
},
deploymentconfigs
:
{
group
:
'apps.openshift.io'
,
version
:
'v1'
,
resource
:
'deploymentconfigs'
},
'deploymentconfigs/instantiate'
:
{
group
:
'apps.openshift.io'
,
version
:
'v1'
,
resource
:
'deploymentconfigs/instantiate'
},
...
...
@@ -3691,9 +3695,8 @@ angular.module('openshiftCommonServices')
selfsubjectrulesreviews
:
{
group
:
'authorization.openshift.io'
,
version
:
'v1'
,
resource
:
'selfsubjectrulesreviews'
},
services
:
{
version
:
'v1'
,
resource
:
'services'
},
serviceaccounts
:
{
version
:
'v1'
,
resource
:
'serviceaccounts'
},
// TODO: add version once these reach beta
serviceclasses
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceclasses'
},
serviceinstancecredentials
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstancecredentials'
},
// Using the anticipated name for this resource, even though it's not currently called servicebindings.
servicebindings
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstancecredentials'
},
serviceinstances
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstances'
},
statefulsets
:
{
group
:
'apps'
,
version
:
'v1beta1'
,
resource
:
'statefulsets'
},
templates
:
{
group
:
'template.openshift.io'
,
verison
:
'v1'
,
resource
:
'templates'
}
...
...
dist/origin-web-common-ui.js
View file @
5a278b38
...
...
@@ -63,7 +63,7 @@ hawtioPluginLoader.addModule('openshiftCommonUI');
" <div ng-repeat=
\"
serviceInstance in ctrl.bindableServiceInstances
\"
class=
\"
bind-service-selection
\"
>
\
n"
+
" <label>
\
n"
+
" <input type=
\"
radio
\"
ng-model=
\"
ctrl.serviceToBind
\"
ng-value=
\"
serviceInstance
\"
>
\
n"
+
" {{ctrl.serviceClasses[serviceInstance.spec.serviceClass
Name].externalMetadata.displayName || serviceInstance.spec.serviceClassN
ame}}
\
n"
+
" {{ctrl.serviceClasses[serviceInstance.spec.serviceClass
Ref.name].spec.externalMetadata.displayName || serviceInstance.spec.serviceClassRef.n
ame}}
\
n"
+
" </label>
\
n"
+
" <div class=
\"
bind-description
\"
>
\
n"
+
" <span class=
\"
pficon pficon-info
\"
\
n"
+
...
...
@@ -162,7 +162,7 @@ hawtioPluginLoader.addModule('openshiftCommonUI');
" <form>
\
n"
+
" <div class=
\"
form-group
\"
>
\
n"
+
" <label>
\
n"
+
" <h3>Create a binding for <strong>{{ctrl.serviceClass.
externalMetadata.displayName || ctrl.serviceClass
Name}}</strong></h3>
\
n"
+
" <h3>Create a binding for <strong>{{ctrl.serviceClass.
spec.externalMetadata.displayName || ctrl.serviceClass.spec.external
Name}}</strong></h3>
\
n"
+
" </label>
\
n"
+
" <span class=
\"
help-block
\"
>Bindings create a secret containing the necessary information for an application to use this service.</span>
\
n"
+
" </div>
\
n"
+
...
...
@@ -534,7 +534,6 @@ angular.module('openshiftCommonUI').component('bindServiceForm', {
controllerAs
:
'ctrl'
,
bindings
:
{
serviceClass
:
'<'
,
serviceClassName
:
'<'
,
showPodPresets
:
'<'
,
applications
:
'<'
,
formName
:
'='
,
...
...
@@ -1750,6 +1749,10 @@ angular.module('openshiftCommonUI')
return
kind
;
}
if
(
kind
===
'ServiceInstance'
)
{
return
useTitleCase
?
'Provisioned Service'
:
'provisioned service'
;
}
var
humanized
=
_
.
startCase
(
kind
);
if
(
useTitleCase
)
{
return
humanized
;
...
...
dist/origin-web-common.js
View file @
5a278b38
...
...
@@ -234,7 +234,7 @@ hawtioPluginLoader.addModule('openshiftCommonUI');
" <div ng-repeat=
\"
serviceInstance in ctrl.bindableServiceInstances
\"
class=
\"
bind-service-selection
\"
>
\
n"
+
" <label>
\
n"
+
" <input type=
\"
radio
\"
ng-model=
\"
ctrl.serviceToBind
\"
ng-value=
\"
serviceInstance
\"
>
\
n"
+
" {{ctrl.serviceClasses[serviceInstance.spec.serviceClass
Name].externalMetadata.displayName || serviceInstance.spec.serviceClassN
ame}}
\
n"
+
" {{ctrl.serviceClasses[serviceInstance.spec.serviceClass
Ref.name].spec.externalMetadata.displayName || serviceInstance.spec.serviceClassRef.n
ame}}
\
n"
+
" </label>
\
n"
+
" <div class=
\"
bind-description
\"
>
\
n"
+
" <span class=
\"
pficon pficon-info
\"
\
n"
+
...
...
@@ -333,7 +333,7 @@ hawtioPluginLoader.addModule('openshiftCommonUI');
" <form>
\
n"
+
" <div class=
\"
form-group
\"
>
\
n"
+
" <label>
\
n"
+
" <h3>Create a binding for <strong>{{ctrl.serviceClass.
externalMetadata.displayName || ctrl.serviceClass
Name}}</strong></h3>
\
n"
+
" <h3>Create a binding for <strong>{{ctrl.serviceClass.
spec.externalMetadata.displayName || ctrl.serviceClass.spec.external
Name}}</strong></h3>
\
n"
+
" </label>
\
n"
+
" <span class=
\"
help-block
\"
>Bindings create a secret containing the necessary information for an application to use this service.</span>
\
n"
+
" </div>
\
n"
+
...
...
@@ -705,7 +705,6 @@ angular.module('openshiftCommonUI').component('bindServiceForm', {
controllerAs
:
'ctrl'
,
bindings
:
{
serviceClass
:
'<'
,
serviceClassName
:
'<'
,
showPodPresets
:
'<'
,
applications
:
'<'
,
formName
:
'='
,
...
...
@@ -1440,6 +1439,10 @@ angular.module('openshiftCommonServices')
'buildconfigs/instantiate'
:
{
group
:
'build.openshift.io'
,
version
:
'v1'
,
resource
:
'buildconfigs/instantiate'
},
buildconfigs
:
{
group
:
'build.openshift.io'
,
version
:
'v1'
,
resource
:
'buildconfigs'
},
configmaps
:
{
version
:
'v1'
,
resource
:
'configmaps'
},
// Using the anticipated name for the resources, even though they aren't yet prefixed with `cluster`.
// https://github.com/kubernetes-incubator/service-catalog/issues/1288
clusterserviceclasses
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceclasses'
},
clusterserviceplans
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceplans'
},
deployments
:
{
group
:
'apps'
,
version
:
'v1beta1'
,
resource
:
'deployments'
},
deploymentconfigs
:
{
group
:
'apps.openshift.io'
,
version
:
'v1'
,
resource
:
'deploymentconfigs'
},
'deploymentconfigs/instantiate'
:
{
group
:
'apps.openshift.io'
,
version
:
'v1'
,
resource
:
'deploymentconfigs/instantiate'
},
...
...
@@ -1462,9 +1465,8 @@ angular.module('openshiftCommonServices')
selfsubjectrulesreviews
:
{
group
:
'authorization.openshift.io'
,
version
:
'v1'
,
resource
:
'selfsubjectrulesreviews'
},
services
:
{
version
:
'v1'
,
resource
:
'services'
},
serviceaccounts
:
{
version
:
'v1'
,
resource
:
'serviceaccounts'
},
// TODO: add version once these reach beta
serviceclasses
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceclasses'
},
serviceinstancecredentials
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstancecredentials'
},
// Using the anticipated name for this resource, even though it's not currently called servicebindings.
servicebindings
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstancecredentials'
},
serviceinstances
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstances'
},
statefulsets
:
{
group
:
'apps'
,
version
:
'v1beta1'
,
resource
:
'statefulsets'
},
templates
:
{
group
:
'template.openshift.io'
,
verison
:
'v1'
,
resource
:
'templates'
}
...
...
@@ -1960,6 +1962,10 @@ angular.module('openshiftCommonUI')
return
kind
;
}
if
(
kind
===
'ServiceInstance'
)
{
return
useTitleCase
?
'Provisioned Service'
:
'provisioned service'
;
}
var
humanized
=
_
.
startCase
(
kind
);
if
(
useTitleCase
)
{
return
humanized
;
...
...
@@ -3121,27 +3127,28 @@ angular.module('openshiftCommonServices')
angular
.
module
(
"openshiftCommonServices"
)
.
service
(
"BindingService"
,
[
"$filter"
,
"$q"
,
"AuthService"
,
"DataService"
,
"DNS1123_SUBDOMAIN_VALIDATION"
,
function
(
$filter
,
[
"$filter"
,
"$q"
,
"A
PIService"
,
"A
uthService"
,
"DataService"
,
"DNS1123_SUBDOMAIN_VALIDATION"
,
function
(
$filter
,
$q
,
APIService
,
AuthService
,
DataService
,
DNS1123_SUBDOMAIN_VALIDATION
)
{
// The secret key this service uses for the parameters JSON blob when binding.
var
PARAMETERS_SECRET_KEY
=
'parameters'
;
var
bindingResource
=
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstancecredentials'
};
var
bindingResource
=
APIService
.
getPreferredVersion
(
'servicebindings'
);
var
getServiceClassForInstance
=
function
(
serviceInstance
,
serviceClasses
)
{
var
serviceClassName
=
_
.
get
(
serviceInstance
,
'spec.serviceClassName'
);
return
_
.
get
(
serviceClasses
,
[
serviceClassName
])
;
};
if
(
!
serviceClasses
)
{
return
null
;
}
var
getPlanForInstance
=
function
(
serviceInstance
,
serviceClass
)
{
var
planName
=
_
.
get
(
serviceInstance
,
'spec.planName'
);
return
_
.
find
(
serviceClass
.
plans
,
{
name
:
planName
});
var
serviceClassName
=
_
.
get
(
serviceInstance
,
'spec.serviceClassRef.name'
);
if
(
!
serviceClassName
)
{
return
null
;
}
return
serviceClasses
[
serviceClassName
];
};
var
generateName
=
$filter
(
'generateName'
);
...
...
@@ -3184,7 +3191,6 @@ angular.module("openshiftCommonServices")
};
var
makeBinding
=
function
(
serviceInstance
,
application
,
parametersSecretName
)
{
var
parametersSecretName
;
var
instanceName
=
serviceInstance
.
metadata
.
name
;
var
credentialSecretName
=
generateSecretName
(
serviceInstance
.
metadata
.
name
+
'-credentials-'
);
...
...
@@ -3228,7 +3234,11 @@ angular.module("openshiftCommonServices")
return
binding
;
};
var
isServiceBindable
=
function
(
serviceInstance
,
serviceClasses
)
{
var
isServiceBindable
=
function
(
serviceInstance
,
serviceClass
,
servicePlan
)
{
if
(
!
serviceInstance
||
!
serviceClass
||
!
servicePlan
)
{
return
false
;
}
// If being deleted, it is not bindable
if
(
_
.
get
(
serviceInstance
,
'metadata.deletionTimestamp'
))
{
return
false
;
...
...
@@ -3239,13 +3249,7 @@ angular.module("openshiftCommonServices")
return
false
;
}
var
serviceClass
=
getServiceClassForInstance
(
serviceInstance
,
serviceClasses
);
if
(
!
serviceClass
)
{
return
!!
serviceInstance
;
}
var
plan
=
getPlanForInstance
(
serviceInstance
,
serviceClass
);
var
planBindable
=
_
.
get
(
plan
,
'bindable'
);
var
planBindable
=
_
.
get
(
servicePlan
,
'spec.bindable'
);
if
(
planBindable
===
true
)
{
return
true
;
}
...
...
@@ -3253,8 +3257,8 @@ angular.module("openshiftCommonServices")
return
false
;
}
// If `plan.
bindable` is not set, fall back to `serviceClass
.bindable`.
return
serviceClass
.
bindable
;
// If `plan.
spec.bindable` is not set, fall back to `serviceClass.spec
.bindable`.
return
serviceClass
.
spec
.
bindable
;
};
var
getPodPresetSelectorsForBindings
=
function
(
bindings
)
{
...
...
@@ -3296,13 +3300,15 @@ angular.module("openshiftCommonServices")
return
resourceBindings
;
};
var
filterBindableServiceInstances
=
function
(
serviceInstances
,
serviceClasses
)
{
if
(
!
serviceInstances
&&
!
serviceClasse
s
)
{
var
filterBindableServiceInstances
=
function
(
serviceInstances
,
serviceClasses
,
servicePlans
)
{
if
(
!
serviceInstances
||
!
serviceClasses
||
!
servicePlan
s
)
{
return
null
;
}
return
_
.
filter
(
serviceInstances
,
function
(
serviceInstance
)
{
return
isServiceBindable
(
serviceInstance
,
serviceClasses
);
var
serviceClassName
=
_
.
get
(
serviceInstance
,
'spec.serviceClassRef.name'
);
var
servicePlanName
=
_
.
get
(
serviceInstance
,
'spec.servicePlanRef.name'
);
return
isServiceBindable
(
serviceInstance
,
serviceClasses
[
serviceClassName
],
servicePlans
[
servicePlanName
]);
});
};
...
...
@@ -3313,7 +3319,8 @@ angular.module("openshiftCommonServices")
return
_
.
sortBy
(
serviceInstances
,
function
(
item
)
{
return
_
.
get
(
serviceClasses
,
[
item
.
spec
.
serviceClassName
,
'externalMetadata'
,
'displayName'
])
||
item
.
spec
.
serviceClassName
;
var
serviceClassName
=
_
.
get
(
item
,
'spec.serviceClassRef.name'
);
return
_
.
get
(
serviceClasses
,
[
serviceClassName
,
'spec'
,
'externalMetadata'
,
'displayName'
])
||
item
.
spec
.
externalServiceClassName
;
},
function
(
item
)
{
return
_
.
get
(
item
,
'metadata.name'
,
''
);
...
...
@@ -3324,7 +3331,6 @@ angular.module("openshiftCommonServices")
return
{
bindingResource
:
bindingResource
,
getServiceClassForInstance
:
getServiceClassForInstance
,
getPlanForInstance
:
getPlanForInstance
,
// Create a binding for `serviceInstance`. If an `application` API object
// is specified, also create a pod preset for that application using its
...
...
dist/origin-web-common.min.js
View file @
5a278b38
This diff is collapsed.
Click to expand it.
dist/scripts/templates.js
View file @
5a278b38
...
...
@@ -34,7 +34,7 @@ angular.module('openshiftCommonUI').run(['$templateCache', function($templateCac
" <div ng-repeat=
\"
serviceInstance in ctrl.bindableServiceInstances
\"
class=
\"
bind-service-selection
\"
>
\
n"
+
" <label>
\
n"
+
" <input type=
\"
radio
\"
ng-model=
\"
ctrl.serviceToBind
\"
ng-value=
\"
serviceInstance
\"
>
\
n"
+
" {{ctrl.serviceClasses[serviceInstance.spec.serviceClass
Name].externalMetadata.displayName || serviceInstance.spec.serviceClassN
ame}}
\
n"
+
" {{ctrl.serviceClasses[serviceInstance.spec.serviceClass
Ref.name].spec.externalMetadata.displayName || serviceInstance.spec.serviceClassRef.n
ame}}
\
n"
+
" </label>
\
n"
+
" <div class=
\"
bind-description
\"
>
\
n"
+
" <span class=
\"
pficon pficon-info
\"
\
n"
+
...
...
@@ -133,7 +133,7 @@ angular.module('openshiftCommonUI').run(['$templateCache', function($templateCac
" <form>
\
n"
+
" <div class=
\"
form-group
\"
>
\
n"
+
" <label>
\
n"
+
" <h3>Create a binding for <strong>{{ctrl.serviceClass.
externalMetadata.displayName || ctrl.serviceClass
Name}}</strong></h3>
\
n"
+
" <h3>Create a binding for <strong>{{ctrl.serviceClass.
spec.externalMetadata.displayName || ctrl.serviceClass.spec.external
Name}}</strong></h3>
\
n"
+
" </label>
\
n"
+
" <span class=
\"
help-block
\"
>Bindings create a secret containing the necessary information for an application to use this service.</span>
\
n"
+
" </div>
\
n"
+
...
...
src/components/binding/bindApplicationForm.html
View file @
5a278b38
...
...
@@ -30,7 +30,7 @@
<div
ng-repeat=
"serviceInstance in ctrl.bindableServiceInstances"
class=
"bind-service-selection"
>
<label>
<input
type=
"radio"
ng-model=
"ctrl.serviceToBind"
ng-value=
"serviceInstance"
>
{{ctrl.serviceClasses[serviceInstance.spec.serviceClass
Name].externalMetadata.displayName || serviceInstance.spec.serviceClassN
ame}}
{{ctrl.serviceClasses[serviceInstance.spec.serviceClass
Ref.name].spec.externalMetadata.displayName || serviceInstance.spec.serviceClassRef.n
ame}}
</label>
<div
class=
"bind-description"
>
<span
class=
"pficon pficon-info"
...
...
src/components/binding/bindServiceForm.html
View file @
5a278b38
...
...
@@ -2,7 +2,7 @@
<form>
<div
class=
"form-group"
>
<label>
<h3>
Create a binding for
<strong>
{{ctrl.serviceClass.
externalMetadata.displayName || ctrl.serviceClass
Name}}
</strong></h3>
<h3>
Create a binding for
<strong>
{{ctrl.serviceClass.
spec.externalMetadata.displayName || ctrl.serviceClass.spec.external
Name}}
</strong></h3>
</label>
<span
class=
"help-block"
>
Bindings create a secret containing the necessary information for an application to use this service.
</span>
</div>
...
...
src/components/binding/bindServiceForm.js
View file @
5a278b38
...
...
@@ -4,7 +4,6 @@ angular.module('openshiftCommonUI').component('bindServiceForm', {
controllerAs
:
'ctrl'
,
bindings
:
{
serviceClass
:
'<'
,
serviceClassName
:
'<'
,
showPodPresets
:
'<'
,
applications
:
'<'
,
formName
:
'='
,
...
...
src/constants/apiPreferredVersions.js
View file @
5a278b38
...
...
@@ -8,6 +8,10 @@ angular.module('openshiftCommonServices')
'buildconfigs/instantiate'
:
{
group
:
'build.openshift.io'
,
version
:
'v1'
,
resource
:
'buildconfigs/instantiate'
},
buildconfigs
:
{
group
:
'build.openshift.io'
,
version
:
'v1'
,
resource
:
'buildconfigs'
},
configmaps
:
{
version
:
'v1'
,
resource
:
'configmaps'
},
// Using the anticipated name for the resources, even though they aren't yet prefixed with `cluster`.
// https://github.com/kubernetes-incubator/service-catalog/issues/1288
clusterserviceclasses
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceclasses'
},
clusterserviceplans
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceplans'
},
deployments
:
{
group
:
'apps'
,
version
:
'v1beta1'
,
resource
:
'deployments'
},
deploymentconfigs
:
{
group
:
'apps.openshift.io'
,
version
:
'v1'
,
resource
:
'deploymentconfigs'
},
'deploymentconfigs/instantiate'
:
{
group
:
'apps.openshift.io'
,
version
:
'v1'
,
resource
:
'deploymentconfigs/instantiate'
},
...
...
@@ -30,9 +34,8 @@ angular.module('openshiftCommonServices')
selfsubjectrulesreviews
:
{
group
:
'authorization.openshift.io'
,
version
:
'v1'
,
resource
:
'selfsubjectrulesreviews'
},
services
:
{
version
:
'v1'
,
resource
:
'services'
},
serviceaccounts
:
{
version
:
'v1'
,
resource
:
'serviceaccounts'
},
// TODO: add version once these reach beta
serviceclasses
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceclasses'
},
serviceinstancecredentials
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstancecredentials'
},
// Using the anticipated name for this resource, even though it's not currently called servicebindings.
servicebindings
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstancecredentials'
},
serviceinstances
:
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstances'
},
statefulsets
:
{
group
:
'apps'
,
version
:
'v1beta1'
,
resource
:
'statefulsets'
},
templates
:
{
group
:
'template.openshift.io'
,
verison
:
'v1'
,
resource
:
'templates'
}
...
...
src/filters/resources.js
View file @
5a278b38
...
...
@@ -107,6 +107,10 @@ angular.module('openshiftCommonUI')
return
kind
;
}
if
(
kind
===
'ServiceInstance'
)
{
return
useTitleCase
?
'Provisioned Service'
:
'provisioned service'
;
}
var
humanized
=
_
.
startCase
(
kind
);
if
(
useTitleCase
)
{
return
humanized
;
...
...
src/services/bindService.js
View file @
5a278b38
...
...
@@ -4,25 +4,26 @@ angular.module("openshiftCommonServices")
.
service
(
"BindingService"
,
function
(
$filter
,
$q
,
APIService
,
AuthService
,
DataService
,
DNS1123_SUBDOMAIN_VALIDATION
)
{
// The secret key this service uses for the parameters JSON blob when binding.
var
PARAMETERS_SECRET_KEY
=
'parameters'
;
var
bindingResource
=
{
group
:
'servicecatalog.k8s.io'
,
resource
:
'serviceinstancecredentials'
};
var
bindingResource
=
APIService
.
getPreferredVersion
(
'servicebindings'
);
var
getServiceClassForInstance
=
function
(
serviceInstance
,
serviceClasses
)
{
var
serviceClassName
=
_
.
get
(
serviceInstance
,
'spec.serviceClassName'
);
return
_
.
get
(
serviceClasses
,
[
serviceClassName
]);
};
if
(
!
serviceClasses
)
{
return
null
;
}
var
serviceClassName
=
_
.
get
(
serviceInstance
,
'spec.serviceClassRef.name'
);
if
(
!
serviceClassName
)
{
return
null
;
}
var
getPlanForInstance
=
function
(
serviceInstance
,
serviceClass
)
{
var
planName
=
_
.
get
(
serviceInstance
,
'spec.planName'
);
return
_
.
find
(
serviceClass
.
plans
,
{
name
:
planName
});
return
serviceClasses
[
serviceClassName
];
};
var
generateName
=
$filter
(
'generateName'
);
...
...
@@ -65,7 +66,6 @@ angular.module("openshiftCommonServices")
};
var
makeBinding
=
function
(
serviceInstance
,
application
,
parametersSecretName
)
{
var
parametersSecretName
;
var
instanceName
=
serviceInstance
.
metadata
.
name
;
var
credentialSecretName
=
generateSecretName
(
serviceInstance
.
metadata
.
name
+
'-credentials-'
);
...
...
@@ -109,7 +109,11 @@ angular.module("openshiftCommonServices")
return
binding
;
};
var
isServiceBindable
=
function
(
serviceInstance
,
serviceClasses
)
{
var
isServiceBindable
=
function
(
serviceInstance
,
serviceClass
,
servicePlan
)
{
if
(
!
serviceInstance
||
!
serviceClass
||
!
servicePlan
)
{
return
false
;
}
// If being deleted, it is not bindable
if
(
_
.
get
(
serviceInstance
,
'metadata.deletionTimestamp'
))
{
return
false
;
...
...
@@ -120,13 +124,7 @@ angular.module("openshiftCommonServices")
return
false
;
}
var
serviceClass
=
getServiceClassForInstance
(
serviceInstance
,
serviceClasses
);
if
(
!
serviceClass
)
{
return
!!
serviceInstance
;
}
var
plan
=
getPlanForInstance
(
serviceInstance
,
serviceClass
);
var
planBindable
=
_
.
get
(
plan
,
'bindable'
);
var
planBindable
=
_
.
get
(
servicePlan
,
'spec.bindable'
);
if
(
planBindable
===
true
)
{
return
true
;
}
...
...
@@ -134,8 +132,8 @@ angular.module("openshiftCommonServices")
return
false
;
}
// If `plan.
bindable` is not set, fall back to `serviceClass
.bindable`.
return
serviceClass
.
bindable
;
// If `plan.
spec.bindable` is not set, fall back to `serviceClass.spec
.bindable`.
return
serviceClass
.
spec
.
bindable
;
};
var
getPodPresetSelectorsForBindings
=
function
(
bindings
)
{
...
...
@@ -177,13 +175,15 @@ angular.module("openshiftCommonServices")
return
resourceBindings
;
};
var
filterBindableServiceInstances
=
function
(
serviceInstances
,
serviceClasses
)
{
if
(
!
serviceInstances
&&
!
serviceClasse
s
)
{
var
filterBindableServiceInstances
=
function
(
serviceInstances
,
serviceClasses
,
servicePlans
)
{
if
(
!
serviceInstances
||
!
serviceClasses
||
!
servicePlan
s
)
{
return
null
;
}
return
_
.
filter
(
serviceInstances
,
function
(
serviceInstance
)
{
return
isServiceBindable
(
serviceInstance
,
serviceClasses
);
var
serviceClassName
=
_
.
get
(
serviceInstance
,
'spec.serviceClassRef.name'
);
var
servicePlanName
=
_
.
get
(
serviceInstance
,
'spec.servicePlanRef.name'
);
return
isServiceBindable
(
serviceInstance
,
serviceClasses
[
serviceClassName
],
servicePlans
[
servicePlanName
]);
});
};
...
...
@@ -194,7 +194,8 @@ angular.module("openshiftCommonServices")
return
_
.
sortBy
(
serviceInstances
,
function
(
item
)
{
return
_
.
get
(
serviceClasses
,
[
item
.
spec
.
serviceClassName
,
'externalMetadata'
,
'displayName'
])
||
item
.
spec
.
serviceClassName
;
var
serviceClassName
=
_
.
get
(
item
,
'spec.serviceClassRef.name'
);
return
_
.
get
(
serviceClasses
,
[
serviceClassName
,
'spec'
,
'externalMetadata'
,
'displayName'
])
||
item
.
spec
.
externalServiceClassName
;
},
function
(
item
)
{
return
_
.
get
(
item
,
'metadata.name'
,
''
);
...
...
@@ -205,7 +206,6 @@ angular.module("openshiftCommonServices")
return
{
bindingResource
:
bindingResource
,
getServiceClassForInstance
:
getServiceClassForInstance
,
getPlanForInstance
:
getPlanForInstance
,
// Create a binding for `serviceInstance`. If an `application` API object
// is specified, also create a pod preset for that application using its
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment