-
Notifications
You must be signed in to change notification settings - Fork 30
Add additional host, machine and node selectors #355
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './selectors'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { find, get } from 'lodash'; | ||
|
||
export const getMachineNode = (nodes, machine) => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you please move this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
find(nodes, node => get(node, 'metadata.name') === get(machine, 'status.nodeRef.name')); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './selectors'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { get } from 'lodash'; | ||
|
||
export const getNodeUnschedulable = node => get(node, 'spec.unschedulable', false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isNodeUnschedulable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
import { getOperationalStatus, getProvisioningState, getHostErrorMessage } from '../../../selectors'; | ||
import { | ||
getOperationalStatus, | ||
getProvisioningState, | ||
getHostErrorMessage, | ||
getNodeUnschedulable, | ||
} from '../../../selectors'; | ||
|
||
import { HOST_STATUS_TO_TEXT, HOST_STATUS_READY, HOST_STATUS_REGISTERING } from './constants'; | ||
|
||
|
@@ -18,3 +23,5 @@ export const getHostStatus = host => { | |
export const getSimpleHostStatus = host => getHostStatus(host).status; | ||
|
||
export const canHostAddMachine = host => [HOST_STATUS_READY].includes(getSimpleHostStatus(host)); | ||
export const canHostStartMaintenance = hostNode => hostNode && !getNodeUnschedulable(hostNode); | ||
export const canHostStopMaintenance = hostNode => hostNode && getNodeUnschedulable(hostNode); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isHostPoweredOn
? maybe also good to indicate default as false?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done