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) { deployService(request, user) {
var url = this.buildURL(); var url = this.buildURL();
url += "/?user.name=" + user; if(user) {
url += "/?user.name=" + user;
}
return this.ajax(url, "POST", {data: request}); return this.ajax(url, "POST", {data: request});
}, },

View File

@ -28,6 +28,7 @@ export default Ember.Component.extend({
serviceResp: null, serviceResp: null,
isLoading: false, isLoading: false,
userName: '', userName: '',
hosts: Ember.inject.service('hosts'),
actions: { actions: {
showSaveTemplateModal() { showSaveTemplateModal() {
@ -157,6 +158,10 @@ export default Ember.Component.extend({
isValidCustomServiceDef: Ember.computed.notEmpty('customServiceDef'), 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() { enableSaveOrDeployBtn: Ember.computed('isValidServiceDef', 'isValidCustomServiceDef', 'viewType', 'isLoading', 'isUserNameGiven', function() {
if (this.get('isLoading')) { if (this.get('isLoading')) {
return false; return false;

View File

@ -75,6 +75,15 @@ function getTimeLineV1URL(rmhost, isHttpsSchemeEnabled) {
return url; 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) { function updateConfigs(application) {
var hostname = window.location.hostname; var hostname = window.location.hostname;
var rmhost = hostname + (window.location.port ? ':' + window.location.port: '') + skipTrailingSlash(window.location.pathname); 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); Ember.Logger.log("Timeline V1 Address: " + ENV.hosts.timelineV1WebAddress);
application.advanceReadiness(); 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 ) { export function initialize( application ) {

View File

@ -82,5 +82,10 @@ export default Ember.Service.extend({
dashWebAddress: Ember.computed(function () { dashWebAddress: Ember.computed(function () {
return this.normalizeURL(this.get("env.app.hosts.dashWebAddress")); 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>
</div> </div>
{{/if}} {{/if}}
<div class="row"> {{#if isSecurityNotEnabled}}
<div class="col-md-4"> <div class="row">
<div class="form-group shrink-height"> <div class="col-md-4">
<label class="required">User Name for service</label> <div class="form-group shrink-height">
<span class="glyphicon glyphicon-info-sign info-icon" data-info="userName"></span> <label class="required">User Name for service</label>
{{input type="text" class="form-control" placeholder="User Name" value=userName}} <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> </div>
<br>
</div> </div>
</div> {{/if}}
<div class="panel panel-default {{if isLoading 'loading-state'}}"> <div class="panel panel-default {{if isLoading 'loading-state'}}">
{{#if isLoading}} {{#if isLoading}}
<img src="assets/images/spinner.gif" alt="Loading..."> <img src="assets/images/spinner.gif" alt="Loading...">

View File

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