YARN-8293. Removed "User Name for service" for deploying secure YARN service.

Contributed by Sunil G

(cherry picked from commit 7802af6e9a)
This commit is contained in:
Eric Yang 2018-05-17 17:06:58 -04:00
parent e5ff9f3922
commit c6c3b0afa0
6 changed files with 57 additions and 10 deletions

View File

@ -26,7 +26,9 @@ export default RESTAbstractAdapter.extend({
deployService(request, user) {
var url = this.buildURL();
url += "/?user.name=" + user;
if(user) {
url += "/?user.name=" + user;
}
return this.ajax(url, "POST", {data: request});
},

View File

@ -28,6 +28,7 @@ export default Ember.Component.extend({
serviceResp: null,
isLoading: false,
userName: '',
hosts: Ember.inject.service('hosts'),
actions: {
showSaveTemplateModal() {
@ -157,6 +158,10 @@ export default Ember.Component.extend({
isValidCustomServiceDef: Ember.computed.notEmpty('customServiceDef'),
isSecurityNotEnabled: Ember.computed('isSecurityEnabled', function () {
return this.get(`hosts.isSecurityEnabled`) === 'simple';
}),
enableSaveOrDeployBtn: Ember.computed('isValidServiceDef', 'isValidCustomServiceDef', 'viewType', 'isLoading', 'isUserNameGiven', function() {
if (this.get('isLoading')) {
return false;

View File

@ -75,6 +75,15 @@ function getTimeLineV1URL(rmhost, isHttpsSchemeEnabled) {
return url;
}
function getSecurityURL(rmhost) {
var url = window.location.protocol + '//' +
(ENV.hosts.localBaseAddress? ENV.hosts.localBaseAddress + '/' : '') + rmhost;
url += '/conf?name=hadoop.security.authentication';
Ember.Logger.log("Server security mode url is: " + url);
return url;
}
function updateConfigs(application) {
var hostname = window.location.hostname;
var rmhost = hostname + (window.location.port ? ':' + window.location.port: '') + skipTrailingSlash(window.location.pathname);
@ -156,6 +165,29 @@ function updateConfigs(application) {
Ember.Logger.log("Timeline V1 Address: " + ENV.hosts.timelineV1WebAddress);
application.advanceReadiness();
}
if(!ENV.hosts.isSecurityEnabled) {
var isSecurityEnabled = "";
$.ajax({
type: 'GET',
dataType: 'json',
async: true,
context: this,
url: getSecurityURL(rmhost),
success: function(data) {
isSecurityEnabled = data.property.value;
ENV.hosts.isSecurityEnabled = isSecurityEnabled;
Ember.Logger.log("Security mode is : " + isSecurityEnabled);
application.advanceReadiness();
},
error: function() {
application.advanceReadiness();
}
});
} else {
Ember.Logger.log("Security mode is: " + ENV.hosts.isSecurityEnabled);
application.advanceReadiness();
}
}
export function initialize( application ) {

View File

@ -82,5 +82,10 @@ export default Ember.Service.extend({
dashWebAddress: Ember.computed(function () {
return this.normalizeURL(this.get("env.app.hosts.dashWebAddress"));
}),
isSecurityEnabled: Ember.computed(function () {
console.log(this.get("env.app.hosts.isSecurityEnabled"));
return this.get("env.app.hosts.isSecurityEnabled");
})
});

View File

@ -29,16 +29,18 @@
</div>
</div>
{{/if}}
<div class="row">
<div class="col-md-4">
<div class="form-group shrink-height">
<label class="required">User Name for service</label>
<span class="glyphicon glyphicon-info-sign info-icon" data-info="userName"></span>
{{input type="text" class="form-control" placeholder="User Name" value=userName}}
{{#if isSecurityNotEnabled}}
<div class="row">
<div class="col-md-4">
<div class="form-group shrink-height">
<label class="required">User Name for service</label>
<span class="glyphicon glyphicon-info-sign info-icon" data-info="userName"></span>
{{input type="text" class="form-control" placeholder="User Name" value=userName}}
</div>
<br>
</div>
<br>
</div>
</div>
{{/if}}
<div class="panel panel-default {{if isLoading 'loading-state'}}">
{{#if isLoading}}
<img src="assets/images/spinner.gif" alt="Loading...">

View File

@ -22,7 +22,8 @@ module.exports = { // YARN UI App configurations
timelineWebAddress: "localhost:8188",
timelineV1WebAddress: "localhost:8188",
rmWebAddress: "localhost:8088",
protocolScheme: "http:"
protocolScheme: "http:",
isSecurityEnabled: ""
},
namespaces: {
timeline: 'ws/v1/applicationhistory',