Compare commits
2 Commits
persian-lo
...
kubernetes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f61a25204a | ||
|
|
6bd6a079ad |
@@ -2245,9 +2245,21 @@ const messages = {
|
|||||||
recipesLabel: 'Recipes',
|
recipesLabel: 'Recipes',
|
||||||
network: 'Network',
|
network: 'Network',
|
||||||
recipeMasterNameLabel: 'Master name',
|
recipeMasterNameLabel: 'Master name',
|
||||||
|
recipeMasterHostNameLabel: 'Master hostname',
|
||||||
|
recipeMasterIpConfigLabel: 'Master IP configuration (optional)',
|
||||||
|
recipeMasterIpLabel: 'Master IP',
|
||||||
|
recipeMasterIpPrefixLabel: 'Master IP CIDR prefix',
|
||||||
|
recipeMasterIpGatewayLabel: 'Gateway',
|
||||||
|
recipeMasterIpDnsLabel: 'DNS list',
|
||||||
|
recipeNodeNamePatternLabel:
|
||||||
|
'Node name pattern (put "%" for node index in name)',
|
||||||
|
recipeNodeHostNamePatternLabel:
|
||||||
|
'Node hostname pattern (put "%" for node index in hostname)',
|
||||||
recipeNumberOfNodesLabel: 'Number of nodes',
|
recipeNumberOfNodesLabel: 'Number of nodes',
|
||||||
recipeSshKeyLabel: 'SSH key',
|
recipeSshKeyLabel: 'SSH key',
|
||||||
|
recipeSizeLabel: 'Disk size',
|
||||||
recipeNetworkCidr: 'Network CIDR',
|
recipeNetworkCidr: 'Network CIDR',
|
||||||
|
recipeVmConfigLabel: 'Cluster VMs config',
|
||||||
|
|
||||||
// Audit
|
// Audit
|
||||||
auditActionEvent: 'Action/Event',
|
auditActionEvent: 'Action/Event',
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ import * as FormGrid from 'form-grid'
|
|||||||
import _, { messages } from 'intl'
|
import _, { messages } from 'intl'
|
||||||
import decorate from 'apply-decorators'
|
import decorate from 'apply-decorators'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { Card, CardBlock, CardHeader } from 'card'
|
||||||
import { Container } from 'grid'
|
import { Container } from 'grid'
|
||||||
import { get } from '@xen-orchestra/defined'
|
import { get } from '@xen-orchestra/defined'
|
||||||
import { injectIntl } from 'react-intl'
|
import { injectIntl } from 'react-intl'
|
||||||
import { injectState, provideState } from 'reaclette'
|
import { injectState, provideState } from 'reaclette'
|
||||||
|
import { Input as DebounceInput } from 'debounce-input-decorator'
|
||||||
import { isSrWritable } from 'xo'
|
import { isSrWritable } from 'xo'
|
||||||
import { SelectPool, SelectNetwork, SelectSr } from 'select-objects'
|
import { SelectPool, SelectNetwork, SelectSr } from 'select-objects'
|
||||||
|
import { SizeInput } from 'form'
|
||||||
|
|
||||||
export default decorate([
|
export default decorate([
|
||||||
injectIntl,
|
injectIntl,
|
||||||
@@ -42,6 +45,14 @@ export default decorate([
|
|||||||
[name]: value,
|
[name]: value,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
onChangeMemorySize(__, memorySize) {
|
||||||
|
const { onChange, value } = this.props
|
||||||
|
onChange({ ...value, memorySize })
|
||||||
|
},
|
||||||
|
onChangeDiskSize(__, diskSize) {
|
||||||
|
const { onChange, value } = this.props
|
||||||
|
onChange({ ...value, diskSize })
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
networkPredicate: (_, { value: { pool } }) => network =>
|
networkPredicate: (_, { value: { pool } }) => network =>
|
||||||
@@ -93,6 +104,97 @@ export default decorate([
|
|||||||
value={value.masterName}
|
value={value.masterName}
|
||||||
/>
|
/>
|
||||||
</FormGrid.Row>
|
</FormGrid.Row>
|
||||||
|
<FormGrid.Row>
|
||||||
|
<label>{_('recipeMasterHostNameLabel')}</label>
|
||||||
|
<input
|
||||||
|
className='form-control'
|
||||||
|
name='masterHostName'
|
||||||
|
onChange={effects.onChangeValue}
|
||||||
|
placeholder={formatMessage(messages.recipeMasterHostNameLabel)}
|
||||||
|
required
|
||||||
|
type='text'
|
||||||
|
value={value.masterHostName}
|
||||||
|
/>
|
||||||
|
</FormGrid.Row>
|
||||||
|
{/* TODO:
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<label>{_('recipeMasterIpConfigLabel')}</label>
|
||||||
|
</CardHeader>
|
||||||
|
<CardBlock>
|
||||||
|
<FormGrid.Row>
|
||||||
|
<label>{_('recipeMasterIpLabel')}</label>
|
||||||
|
<div className='input-group'>
|
||||||
|
<input
|
||||||
|
className='form-control'
|
||||||
|
name='masterIp'
|
||||||
|
onChange={effects.onChangeValue}
|
||||||
|
placeholder={formatMessage(messages.recipeMasterIpLabel)}
|
||||||
|
type='text'
|
||||||
|
value={value.masterIp}
|
||||||
|
/>
|
||||||
|
<span className='input-group-addon'>/</span>
|
||||||
|
<input
|
||||||
|
className='form-control'
|
||||||
|
max='32'
|
||||||
|
min='0'
|
||||||
|
name='masterIpPrefix'
|
||||||
|
onChange={effects.onChangeValue}
|
||||||
|
placeholder={formatMessage(messages.recipeMasterIpPrefixLabel)}
|
||||||
|
type='number'
|
||||||
|
value={value.masterIpPrefix}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</FormGrid.Row>
|
||||||
|
<FormGrid.Row>
|
||||||
|
<label>{_('recipeMasterIpGatewayLabel')}</label>
|
||||||
|
<input
|
||||||
|
className='form-control'
|
||||||
|
name='masterIpGateway'
|
||||||
|
onChange={effects.onChangeValue}
|
||||||
|
placeholder={formatMessage(messages.recipeMasterIpGatewayLabel)}
|
||||||
|
type='text'
|
||||||
|
value={value.masterIpGateway}
|
||||||
|
/>
|
||||||
|
</FormGrid.Row>
|
||||||
|
<FormGrid.Row>
|
||||||
|
<label>{_('recipeMasterIpDnsLabel')}</label>
|
||||||
|
<textarea
|
||||||
|
className='form-control'
|
||||||
|
name='masterIpDns'
|
||||||
|
onChange={effects.onChangeValue}
|
||||||
|
placeholder="DNS list separated by comma:','"
|
||||||
|
rows={1}
|
||||||
|
value={value.masterIpRange}
|
||||||
|
/>
|
||||||
|
</FormGrid.Row>
|
||||||
|
</CardBlock>
|
||||||
|
</Card>
|
||||||
|
*/}
|
||||||
|
<FormGrid.Row>
|
||||||
|
<label>{_('recipeNodeNamePatternLabel')}</label>
|
||||||
|
<input
|
||||||
|
className='form-control'
|
||||||
|
name='nodeNamePattern'
|
||||||
|
onChange={effects.onChangeValue}
|
||||||
|
placeholder={formatMessage(messages.recipeNodeNamePatternLabel)}
|
||||||
|
required
|
||||||
|
type='text'
|
||||||
|
value={value.nodeNamePattern}
|
||||||
|
/>
|
||||||
|
</FormGrid.Row>
|
||||||
|
<FormGrid.Row>
|
||||||
|
<label>{_('recipeNodeHostNamePatternLabel')}</label>
|
||||||
|
<input
|
||||||
|
className='form-control'
|
||||||
|
name='nodeHostNamePattern'
|
||||||
|
onChange={effects.onChangeValue}
|
||||||
|
placeholder={formatMessage(messages.recipeNodeHostNamePatternLabel)}
|
||||||
|
required
|
||||||
|
type='text'
|
||||||
|
value={value.nodeHostNamePattern}
|
||||||
|
/>
|
||||||
|
</FormGrid.Row>
|
||||||
<FormGrid.Row>
|
<FormGrid.Row>
|
||||||
<label>{_('recipeNumberOfNodesLabel')}</label>
|
<label>{_('recipeNumberOfNodesLabel')}</label>
|
||||||
<input
|
<input
|
||||||
@@ -120,16 +222,69 @@ export default decorate([
|
|||||||
</FormGrid.Row>
|
</FormGrid.Row>
|
||||||
<FormGrid.Row>
|
<FormGrid.Row>
|
||||||
<label>{_('recipeNetworkCidr')}</label>
|
<label>{_('recipeNetworkCidr')}</label>
|
||||||
<input
|
<div className='input-group'>
|
||||||
className='form-control'
|
<input
|
||||||
name='cidr'
|
className='form-control'
|
||||||
onChange={effects.onChangeValue}
|
name='cidrRange'
|
||||||
placeholder={formatMessage(messages.recipeNetworkCidr)}
|
onChange={effects.onChangeValue}
|
||||||
required
|
placeholder='IP range'
|
||||||
type='text'
|
required
|
||||||
value={value.cidr}
|
type='text'
|
||||||
/>
|
value={value.cidrRange}
|
||||||
|
/>
|
||||||
|
<span className='input-group-addon'>/</span>
|
||||||
|
<input
|
||||||
|
className='form-control'
|
||||||
|
max='32'
|
||||||
|
min='0'
|
||||||
|
name='cidrPrefix'
|
||||||
|
onChange={effects.onChangeValue}
|
||||||
|
placeholder='CIDR prefix'
|
||||||
|
required
|
||||||
|
type='number'
|
||||||
|
value={value.cidrPrefix}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</FormGrid.Row>
|
</FormGrid.Row>
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<label>{_('recipeVmConfigLabel')}</label>
|
||||||
|
</CardHeader>
|
||||||
|
<CardBlock>
|
||||||
|
<FormGrid.Row>
|
||||||
|
<label>{_('newVmVcpusLabel')}</label>
|
||||||
|
<DebounceInput
|
||||||
|
className='form-control'
|
||||||
|
min={1}
|
||||||
|
name='cpus'
|
||||||
|
onChange={effects.onChangeValue}
|
||||||
|
placeholder={formatMessage(messages.newVmVcpusLabel)}
|
||||||
|
type='number'
|
||||||
|
value={value.cpus}
|
||||||
|
/>
|
||||||
|
</FormGrid.Row>
|
||||||
|
<FormGrid.Row>
|
||||||
|
<label>{_('newVmRamLabel')}</label>
|
||||||
|
<SizeInput
|
||||||
|
className='form-control'
|
||||||
|
name='memorySize'
|
||||||
|
onChange={effects.onChangeMemorySize}
|
||||||
|
placeholder={formatMessage(messages.newVmRamLabel)}
|
||||||
|
value={value.memorySize}
|
||||||
|
/>
|
||||||
|
</FormGrid.Row>
|
||||||
|
<FormGrid.Row>
|
||||||
|
<label>{_('recipeSizeLabel')}</label>
|
||||||
|
<SizeInput
|
||||||
|
className='form-control'
|
||||||
|
name='memorySize'
|
||||||
|
onChange={effects.onChangeDiskSize}
|
||||||
|
placeholder={formatMessage(messages.recipeSizeLabel)}
|
||||||
|
value={value.diskSize}
|
||||||
|
/>
|
||||||
|
</FormGrid.Row>
|
||||||
|
</CardBlock>
|
||||||
|
</Card>
|
||||||
</Container>
|
</Container>
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -51,12 +51,41 @@ export default decorate([
|
|||||||
size: 'medium',
|
size: 'medium',
|
||||||
})
|
})
|
||||||
|
|
||||||
const { cidr, masterName, nbNodes, network, sr, sshKey } = recipeParams
|
const {
|
||||||
|
cidrRange,
|
||||||
|
cidrPrefix,
|
||||||
|
cpus,
|
||||||
|
diskSize,
|
||||||
|
masterHostName,
|
||||||
|
masterName,
|
||||||
|
masterIp,
|
||||||
|
masterIpPrefix,
|
||||||
|
masterIpGateway,
|
||||||
|
masterIpDns,
|
||||||
|
memorySize,
|
||||||
|
nodeHostNamePattern,
|
||||||
|
nodeNamePattern,
|
||||||
|
nbNodes,
|
||||||
|
network,
|
||||||
|
sr,
|
||||||
|
sshKey,
|
||||||
|
} = recipeParams
|
||||||
|
|
||||||
markRecipeAsCreating(RECIPE_INFO.id)
|
markRecipeAsCreating(RECIPE_INFO.id)
|
||||||
const tag = await createKubernetesCluster({
|
const tag = await createKubernetesCluster({
|
||||||
cidr,
|
cidrRange,
|
||||||
|
cidrPrefix,
|
||||||
|
cpus: cpus !== undefined ? +cpus : undefined,
|
||||||
|
diskSize: diskSize !== undefined ? +diskSize : undefined,
|
||||||
|
masterHostName,
|
||||||
masterName,
|
masterName,
|
||||||
|
masterIp,
|
||||||
|
masterIpPrefix,
|
||||||
|
masterIpGateway,
|
||||||
|
masterIpDns,
|
||||||
|
memorySize: memorySize !== undefined ? +memorySize : undefined,
|
||||||
|
nodeHostNamePattern,
|
||||||
|
nodeNamePattern,
|
||||||
nbNodes: +nbNodes,
|
nbNodes: +nbNodes,
|
||||||
network: network.id,
|
network: network.id,
|
||||||
sr: sr.id,
|
sr: sr.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user