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
1a9a6d41
Unverified
Commit
1a9a6d41
authored
Jun 08, 2017
by
Jessica Forrester
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optionally send AlphaPodPresetTemplate when creating Binding
parent
d6f53769
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
27 deletions
+68
-27
origin-web-common-services.js
dist/origin-web-common-services.js
+19
-7
origin-web-common.js
dist/origin-web-common.js
+19
-7
origin-web-common.min.js
dist/origin-web-common.min.js
+11
-6
bindService.js
src/services/bindService.js
+19
-7
No files found.
dist/origin-web-common-services.js
View file @
1a9a6d41
...
@@ -1014,10 +1014,10 @@ angular.module("openshiftCommonServices")
...
@@ -1014,10 +1014,10 @@ angular.module("openshiftCommonServices")
resource
:
'bindings'
resource
:
'bindings'
};
};
var
makeBinding
=
function
(
serviceToBind
)
{
var
makeBinding
=
function
(
serviceToBind
,
appToBind
)
{
var
generateName
=
$filter
(
'generateName'
);
var
generateName
=
$filter
(
'generateName'
);
var
relatedObjName
=
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
'-'
);
return
{
var
binding
=
{
kind
:
'Binding'
,
kind
:
'Binding'
,
apiVersion
:
'servicecatalog.k8s.io/v1alpha1'
,
apiVersion
:
'servicecatalog.k8s.io/v1alpha1'
,
metadata
:
{
metadata
:
{
...
@@ -1027,17 +1027,29 @@ angular.module("openshiftCommonServices")
...
@@ -1027,17 +1027,29 @@ angular.module("openshiftCommonServices")
instanceRef
:
{
instanceRef
:
{
name
:
serviceToBind
name
:
serviceToBind
},
},
secretName
:
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
'-'
)
secretName
:
relatedObjName
}
}
};
};
var
appSelector
=
_
.
get
(
appToBind
,
'spec.selector'
);
if
(
appSelector
)
{
if
(
!
appSelector
.
matchLabels
&&
!
appSelector
.
matchExpressions
)
{
// Then this is the old format of selector, pod preset requires the new format
appSelector
=
{
matchLabels
:
appSelector
};
}
binding
.
spec
.
alphaPodPresetTemplate
=
{
name
:
relatedObjName
,
selector
:
appSelector
};
}
return
binding
;
};
};
return
{
return
{
bindingResource
:
bindingResource
,
bindingResource
:
bindingResource
,
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
var
newBinding
=
makeBinding
(
serviceToBind
);
var
newBinding
=
makeBinding
(
serviceToBind
,
appToBind
);
// TODO: Use appToBind to bind the service to the application
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
},
},
isServiceBindable
:
function
(
serviceInstance
,
serviceClasses
)
{
isServiceBindable
:
function
(
serviceInstance
,
serviceClasses
)
{
...
...
dist/origin-web-common.js
View file @
1a9a6d41
...
@@ -2648,10 +2648,10 @@ angular.module("openshiftCommonServices")
...
@@ -2648,10 +2648,10 @@ angular.module("openshiftCommonServices")
resource
:
'bindings'
resource
:
'bindings'
};
};
var
makeBinding
=
function
(
serviceToBind
)
{
var
makeBinding
=
function
(
serviceToBind
,
appToBind
)
{
var
generateName
=
$filter
(
'generateName'
);
var
generateName
=
$filter
(
'generateName'
);
var
relatedObjName
=
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
'-'
);
return
{
var
binding
=
{
kind
:
'Binding'
,
kind
:
'Binding'
,
apiVersion
:
'servicecatalog.k8s.io/v1alpha1'
,
apiVersion
:
'servicecatalog.k8s.io/v1alpha1'
,
metadata
:
{
metadata
:
{
...
@@ -2661,17 +2661,29 @@ angular.module("openshiftCommonServices")
...
@@ -2661,17 +2661,29 @@ angular.module("openshiftCommonServices")
instanceRef
:
{
instanceRef
:
{
name
:
serviceToBind
name
:
serviceToBind
},
},
secretName
:
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
'-'
)
secretName
:
relatedObjName
}
}
};
};
var
appSelector
=
_
.
get
(
appToBind
,
'spec.selector'
);
if
(
appSelector
)
{
if
(
!
appSelector
.
matchLabels
&&
!
appSelector
.
matchExpressions
)
{
// Then this is the old format of selector, pod preset requires the new format
appSelector
=
{
matchLabels
:
appSelector
};
}
binding
.
spec
.
alphaPodPresetTemplate
=
{
name
:
relatedObjName
,
selector
:
appSelector
};
}
return
binding
;
};
};
return
{
return
{
bindingResource
:
bindingResource
,
bindingResource
:
bindingResource
,
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
var
newBinding
=
makeBinding
(
serviceToBind
);
var
newBinding
=
makeBinding
(
serviceToBind
,
appToBind
);
// TODO: Use appToBind to bind the service to the application
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
},
},
isServiceBindable
:
function
(
serviceInstance
,
serviceClasses
)
{
isServiceBindable
:
function
(
serviceInstance
,
serviceClasses
)
{
...
...
dist/origin-web-common.min.js
View file @
1a9a6d41
...
@@ -1080,9 +1080,8 @@ return data;
...
@@ -1080,9 +1080,8 @@ return data;
var
bindingResource
=
{
var
bindingResource
=
{
group
:
"servicecatalog.k8s.io"
,
group
:
"servicecatalog.k8s.io"
,
resource
:
"bindings"
resource
:
"bindings"
},
makeBinding
=
function
(
serviceToBind
)
{
},
makeBinding
=
function
(
serviceToBind
,
appToBind
)
{
var
generateName
=
$filter
(
"generateName"
);
var
generateName
=
$filter
(
"generateName"
),
relatedObjName
=
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
"-"
),
binding
=
{
return
{
kind
:
"Binding"
,
kind
:
"Binding"
,
apiVersion
:
"servicecatalog.k8s.io/v1alpha1"
,
apiVersion
:
"servicecatalog.k8s.io/v1alpha1"
,
metadata
:{
metadata
:{
...
@@ -1092,14 +1091,20 @@ spec:{
...
@@ -1092,14 +1091,20 @@ spec:{
instanceRef
:{
instanceRef
:{
name
:
serviceToBind
name
:
serviceToBind
},
},
secretName
:
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
"-"
)
secretName
:
relatedObjName
}
}
};
},
appSelector
=
_
.
get
(
appToBind
,
"spec.selector"
);
return
appSelector
&&
(
appSelector
.
matchLabels
||
appSelector
.
matchExpressions
||
(
appSelector
=
{
matchLabels
:
appSelector
}),
binding
.
spec
.
alphaPodPresetTemplate
=
{
name
:
relatedObjName
,
selector
:
appSelector
}),
binding
;
};
};
return
{
return
{
bindingResource
:
bindingResource
,
bindingResource
:
bindingResource
,
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
var
newBinding
=
makeBinding
(
serviceToBind
);
var
newBinding
=
makeBinding
(
serviceToBind
,
appToBind
);
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
},
},
isServiceBindable
:
function
(
serviceInstance
,
serviceClasses
)
{
isServiceBindable
:
function
(
serviceInstance
,
serviceClasses
)
{
...
...
src/services/bindService.js
View file @
1a9a6d41
...
@@ -7,10 +7,10 @@ angular.module("openshiftCommonServices")
...
@@ -7,10 +7,10 @@ angular.module("openshiftCommonServices")
resource
:
'bindings'
resource
:
'bindings'
};
};
var
makeBinding
=
function
(
serviceToBind
)
{
var
makeBinding
=
function
(
serviceToBind
,
appToBind
)
{
var
generateName
=
$filter
(
'generateName'
);
var
generateName
=
$filter
(
'generateName'
);
var
relatedObjName
=
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
'-'
);
return
{
var
binding
=
{
kind
:
'Binding'
,
kind
:
'Binding'
,
apiVersion
:
'servicecatalog.k8s.io/v1alpha1'
,
apiVersion
:
'servicecatalog.k8s.io/v1alpha1'
,
metadata
:
{
metadata
:
{
...
@@ -20,17 +20,29 @@ angular.module("openshiftCommonServices")
...
@@ -20,17 +20,29 @@ angular.module("openshiftCommonServices")
instanceRef
:
{
instanceRef
:
{
name
:
serviceToBind
name
:
serviceToBind
},
},
secretName
:
generateName
(
_
.
trunc
(
serviceToBind
,
DNS1123_SUBDOMAIN_VALIDATION
.
maxlength
-
6
)
+
'-'
)
secretName
:
relatedObjName
}
}
};
};
var
appSelector
=
_
.
get
(
appToBind
,
'spec.selector'
);
if
(
appSelector
)
{
if
(
!
appSelector
.
matchLabels
&&
!
appSelector
.
matchExpressions
)
{
// Then this is the old format of selector, pod preset requires the new format
appSelector
=
{
matchLabels
:
appSelector
};
}
binding
.
spec
.
alphaPodPresetTemplate
=
{
name
:
relatedObjName
,
selector
:
appSelector
};
}
return
binding
;
};
};
return
{
return
{
bindingResource
:
bindingResource
,
bindingResource
:
bindingResource
,
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
bindService
:
function
(
context
,
serviceToBind
,
appToBind
)
{
var
newBinding
=
makeBinding
(
serviceToBind
);
var
newBinding
=
makeBinding
(
serviceToBind
,
appToBind
);
// TODO: Use appToBind to bind the service to the application
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
return
DataService
.
create
(
bindingResource
,
null
,
newBinding
,
context
);
},
},
isServiceBindable
:
function
(
serviceInstance
,
serviceClasses
)
{
isServiceBindable
:
function
(
serviceInstance
,
serviceClasses
)
{
...
...
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