Skip to content

Commit

Permalink
Support option of DNS names instead of IP addresses for nodes in YW (…
Browse files Browse the repository at this point in the history
…frontend) #4951

Summary: Add toggle for on-prem provider to use hostnames instead of ip addresses and change labelling from IP->Hostname for nodes related to the on-prem provider if this toggle is enabled.

Test Plan: Create on-prem provider with the toggle enabled, verify form labels have updated.

Reviewers: sanketh, andrew, sshevchenko

Reviewed By: sshevchenko

Subscribers: yugaware

Differential Revision: https://phabricator.dev.yugabyte.com/D8890
  • Loading branch information
daniel-yb committed Jul 15, 2020
1 parent c68b775 commit 6deb22f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion managed/ui/src/components/config/OnPrem/OnPremNodesList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) YugaByte, Inc.

import _ from 'lodash';
import React, { Component } from 'react';
import { Row, Col, Alert } from 'react-bootstrap';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
Expand Down Expand Up @@ -146,7 +147,9 @@ class OnPremNodesList extends Component {

let provisionMessage = <span />;
const onPremProvider = providers.data.find((provider)=>provider.code === "onprem");
let useHostname = false;
if (isDefinedNotNull(onPremProvider)) {
useHostname = _.get(onPremProvider, 'config.USE_HOSTNAME', false)
const onPremKey = accessKeys.data.find((accessKey) => accessKey.idKey.providerUUID === onPremProvider.uuid);
if (isDefinedNotNull(onPremKey) && onPremKey.keyInfo.airGapInstall) {
provisionMessage = (
Expand Down Expand Up @@ -185,6 +188,7 @@ class OnPremNodesList extends Component {
&& this.state.nodeToBeDeleted.nodeName
? ' ' + this.state.nodeToBeDeleted.nodeName
: ''}?`;
const nodeAddressLabel = useHostname ? "Hostname" : "IP";
return (
<div>
<span className="buttons pull-right">
Expand All @@ -202,7 +206,7 @@ class OnPremNodesList extends Component {
<Col xs={12}>
<BootstrapTable data={nodeListItems} >
<TableHeaderColumn dataField="nodeId" isKey={true} hidden={true} />
<TableHeaderColumn dataField="ip">IP</TableHeaderColumn>
<TableHeaderColumn dataField="ip">{nodeAddressLabel}</TableHeaderColumn>
<TableHeaderColumn dataField="inUse">In Use</TableHeaderColumn>
<TableHeaderColumn dataField="region">Region</TableHeaderColumn>
<TableHeaderColumn dataField="zone">Zone</TableHeaderColumn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class OnPremProviderAndAccessKey extends Component {
const {handleSubmit, switchToJsonEntry, isEditProvider} = this.props;
const {nameHelpContent, userHelpContent, pkHelpContent,
passwordlessSudoHelp, airGapInstallHelp, homeDirHelp,
portHelpContent} = constants;
portHelpContent, useHostnameHelp} = constants;
const isReadOnly = this.props.isEditProvider;

return (
Expand All @@ -43,6 +43,9 @@ export default class OnPremProviderAndAccessKey extends Component {
<Field name="sshPort" component={YBNumericInput} label="SSH Port" insetError={true}
isReadOnly={isReadOnly} infoContent={portHelpContent}
infoTitle="SSH Port" />
<Field name="useHostnames" component={YBToggle}
label="Use Hostnames" defaultChecked={false} isReadOnly={isReadOnly}
infoContent={useHostnameHelp} infoTitle="Use Hostnames"/>
<Field name="passwordlessSudoAccess" component={YBToggle}
label="Passwordless Sudo" defaultChecked={true} isReadOnly={isReadOnly}
infoContent={passwordlessSudoHelp} infoTitle="Passwordless Sudo"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const mapDispatchToProps = (dispatch, ownProps) => {
const formSubmitVals = {
provider: {
name: formData.name,
config: { YB_HOME_DIR: formData.homeDir }
config: { YB_HOME_DIR: formData.homeDir, USE_HOSTNAME: formData.useHostnames.toString() }
},
key: {
code: formData.name.toLowerCase().replace(/ /g, "-") + "-key",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"pkHelpContent": "Enter the full content of the private key that the SSH User can use to SSH into your instances.",
"passwordlessSudoHelp": "If enabled, the SSH User specified above must have passwordless sudo access to all machines. If not enabled, you are responsible for pre-provisioning all machines before use.",
"airGapInstallHelp": "If not enabled we would pre-provisiong the machines before creating universes. If enabled, you are responsible for pre-provisioning all machines before use.",
"homeDirHelp": "Enter the desired home directory for YB nodes."
"homeDirHelp": "Enter the desired home directory for YB nodes.",
"useHostnameHelp": "If enabled, nodes are expected to be specified by hostname instead of IP address. This will mean that all communication between YugaWare and nodes as well as amongst nodes in a cluster will happen by way of DNS resolution."
}

0 comments on commit 6deb22f

Please sign in to comment.