Skip to content

Commit

Permalink
fix(console): master update ;pod search ;worker update (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-hnny committed Dec 2, 2020
1 parent 99ee25f commit 311bf67
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,25 @@ export class ClusterTablePanel extends React.Component<RootProps, State> {
<Text theme={ClusterStatus[x.status.phase]} verticalAlign="middle">
{x.status.phase || '-'}
</Text>
{x.spec.updateInfo.worker.message === '有节点正在升级中' && (
<>
<Icon className="tea-ml-1n" type="loading" />{' '}
<Button
type="link"
onClick={() => {
router.navigate(
{ sub: 'sub', mode: 'list', type: 'nodeManage', resourceName: 'node' },
{
rid: region.selection.value + '',
clusterId: x.metadata.name
}
);
}}
>
有节点正在升级中
</Button>
</>
)}
{x.status.phase !== 'Running' && <Icon className="tea-ml-1n" type="loading" />}
{x.status.phase !== 'Running' && x.status.phase !== 'Terminating' && (
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export function ClusterUpdate({ route, actions }: RootProps) {
autoMode: true
};

const [showMaxPodUnready, setShowMaxPodUnready] = useState(true);

const { clusterId, clusterVersion } = route.queries;
const [_, clusterVersionSecondPart] = clusterVersion.split('.');

Expand Down Expand Up @@ -109,20 +111,22 @@ export function ClusterUpdate({ route, actions }: RootProps) {
label="自动升级Worker"
extra="注意:启用自定升级Worker,在升级完Master后,将自动升级集群下所有Worker节点。"
>
<Checkbox>启用自动升级</Checkbox>
<Checkbox onChange={e => setShowMaxPodUnready(e.target.checked)}>启用自动升级</Checkbox>
</Form.Item>

<Form.Item
label="最大不可用Pod占比"
extra="注意如果节点过少,而设置比例过低,没有足够多的节点承载pod的迁移会导致升级卡死。如果业务对pod可用比例较高,请考虑选择升级前不驱逐节点。"
>
<Space>
<Form.Item name={['maxUnready']} noStyle rules={[{ type: 'number', required: true, min: 0, max: 100 }]}>
<InputNumber style={ItemStyle()} min={0} max={100} />
</Form.Item>
%
</Space>
</Form.Item>
{showMaxPodUnready && (
<Form.Item
label="最大不可用Pod占比"
extra="注意如果节点过少,而设置比例过低,没有足够多的节点承载pod的迁移会导致升级卡死。如果业务对pod可用比例较高,请考虑选择升级前不驱逐节点。"
>
<Space>
<Form.Item name={['maxUnready']} noStyle rules={[{ type: 'number', required: true, min: 0, max: 100 }]}>
<InputNumber style={ItemStyle()} min={0} max={100} />
</Form.Item>
%
</Space>
</Form.Item>
)}
</Form>
</AntdLayout>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export function WorkerUpdate({ route }: RootProps) {
</Checkbox>
</Form.Item>

<Form.Item label="最大不可用Pod占比" extra="升级过程中不可以Pod数超过该占比将暂停升级">
<Form.Item label="最大不可用Pod占比" extra="升级过程中不可用Pod数超过该占比将暂停升级">
<Space>
<InputNumber
style={ItemStyle()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,9 @@ export class ResourcePodActionPanel extends React.Component<RootProps, ResourceP
// tagSearch的过滤选项
const attributes = [
{
type: 'single',
type: 'input',
key: 'podName',
name: t('Pod名称'),
values: podNameValues
name: t('Pod名称')
},
{
type: 'single',
Expand Down
2 changes: 1 addition & 1 deletion web/console/src/webApi/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const updateCluster = ({
mode: autoMode ? 'Auto' : 'Manual',
strategy: {
drainNodeBeforeUpgrade,
maxUnready: maxUnready + '%'
maxUnready: autoMode ? maxUnready + '%' : undefined
}
}
}
Expand Down

0 comments on commit 311bf67

Please sign in to comment.