Compare commits
2 Commits
feat_shown
...
kubernetes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f61a25204a | ||
|
|
6bd6a079ad |
@@ -2245,9 +2245,21 @@ const messages = {
|
||||
recipesLabel: 'Recipes',
|
||||
network: 'Network',
|
||||
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',
|
||||
recipeSshKeyLabel: 'SSH key',
|
||||
recipeSizeLabel: 'Disk size',
|
||||
recipeNetworkCidr: 'Network CIDR',
|
||||
recipeVmConfigLabel: 'Cluster VMs config',
|
||||
|
||||
// Audit
|
||||
auditActionEvent: 'Action/Event',
|
||||
|
||||
@@ -2,12 +2,15 @@ import * as FormGrid from 'form-grid'
|
||||
import _, { messages } from 'intl'
|
||||
import decorate from 'apply-decorators'
|
||||
import React from 'react'
|
||||
import { Card, CardBlock, CardHeader } from 'card'
|
||||
import { Container } from 'grid'
|
||||
import { get } from '@xen-orchestra/defined'
|
||||
import { injectIntl } from 'react-intl'
|
||||
import { injectState, provideState } from 'reaclette'
|
||||
import { Input as DebounceInput } from 'debounce-input-decorator'
|
||||
import { isSrWritable } from 'xo'
|
||||
import { SelectPool, SelectNetwork, SelectSr } from 'select-objects'
|
||||
import { SizeInput } from 'form'
|
||||
|
||||
export default decorate([
|
||||
injectIntl,
|
||||
@@ -42,6 +45,14 @@ export default decorate([
|
||||
[name]: value,
|
||||
})
|
||||
},
|
||||
onChangeMemorySize(__, memorySize) {
|
||||
const { onChange, value } = this.props
|
||||
onChange({ ...value, memorySize })
|
||||
},
|
||||
onChangeDiskSize(__, diskSize) {
|
||||
const { onChange, value } = this.props
|
||||
onChange({ ...value, diskSize })
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
networkPredicate: (_, { value: { pool } }) => network =>
|
||||
@@ -93,6 +104,97 @@ export default decorate([
|
||||
value={value.masterName}
|
||||
/>
|
||||
</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>
|
||||
<label>{_('recipeNumberOfNodesLabel')}</label>
|
||||
<input
|
||||
@@ -120,16 +222,69 @@ export default decorate([
|
||||
</FormGrid.Row>
|
||||
<FormGrid.Row>
|
||||
<label>{_('recipeNetworkCidr')}</label>
|
||||
<input
|
||||
className='form-control'
|
||||
name='cidr'
|
||||
onChange={effects.onChangeValue}
|
||||
placeholder={formatMessage(messages.recipeNetworkCidr)}
|
||||
required
|
||||
type='text'
|
||||
value={value.cidr}
|
||||
/>
|
||||
<div className='input-group'>
|
||||
<input
|
||||
className='form-control'
|
||||
name='cidrRange'
|
||||
onChange={effects.onChangeValue}
|
||||
placeholder='IP range'
|
||||
required
|
||||
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>
|
||||
<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>
|
||||
),
|
||||
])
|
||||
|
||||
@@ -51,12 +51,41 @@ export default decorate([
|
||||
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)
|
||||
const tag = await createKubernetesCluster({
|
||||
cidr,
|
||||
cidrRange,
|
||||
cidrPrefix,
|
||||
cpus: cpus !== undefined ? +cpus : undefined,
|
||||
diskSize: diskSize !== undefined ? +diskSize : undefined,
|
||||
masterHostName,
|
||||
masterName,
|
||||
masterIp,
|
||||
masterIpPrefix,
|
||||
masterIpGateway,
|
||||
masterIpDns,
|
||||
memorySize: memorySize !== undefined ? +memorySize : undefined,
|
||||
nodeHostNamePattern,
|
||||
nodeNamePattern,
|
||||
nbNodes: +nbNodes,
|
||||
network: network.id,
|
||||
sr: sr.id,
|
||||
|
||||
Reference in New Issue
Block a user