Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(console): add use BGP checkbox #1336

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions web/console/src/modules/cluster/WebAPI/ClusterAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ export async function createIC(clusters: CreateIC[]) {
cilium,
networkMode,
asNumber,
switchIp
switchIp,
useBGP
} = clusters[0];

const resourceInfo = resourceConfig()['cluster'];
Expand Down Expand Up @@ -196,7 +197,7 @@ export async function createIC(clusters: CreateIC[]) {
networkArgs: {
networkMode,

...(networkMode === 'underlay'
...(networkMode === 'underlay' && useBGP
? {
asn: asNumber,
'switch-ip': switchIp
Expand Down
7 changes: 7 additions & 0 deletions web/console/src/modules/cluster/actions/createICAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ export const createICAction = {
};
},

setUseBGP: (useBGP: boolean) => {
return {
type: ActionType.IC_UseBGP,
payload: useBGP
};
},

inputGPUType: (type: string): ReduxAction<string> => {
return {
type: ActionType.v_IC_GpuType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ export class CreateICPanel extends React.Component<RootProps, State> {
asNumber,
switchIp,
v_asNumber,
v_switchIp
v_switchIp,
useBGP
} = createIC;

const hasEditing = computerList.filter(c => c.isEditing).length > 0 || this.state.isAdding;
Expand All @@ -137,7 +138,7 @@ export class CreateICPanel extends React.Component<RootProps, State> {
showExistVipUnuseTip = nodeNum > 1 ? false : true;
} else if (vipType === CreateICVipType.tke) {
canSave = canSave && v_vipAddress.status === 1;
} else if (cilium === 'Cilium' && networkMode === 'underlay') {
} else if (cilium === 'Cilium' && networkMode === 'underlay' && useBGP) {
canSave = canSave && v_asNumber.status === 1 && v_switchIp.status === 1;
}

Expand Down Expand Up @@ -290,6 +291,12 @@ export class CreateICPanel extends React.Component<RootProps, State> {
)}

{cilium === 'Cilium' && networkMode === 'underlay' && (
<FormPanel.Item label="BGP" text>
<FormPanel.Checkbox value={useBGP} onChange={actions.createIC.setUseBGP} />
</FormPanel.Item>
)}

{cilium === 'Cilium' && networkMode === 'underlay' && useBGP && (
<>
<FormPanel.Item
validator={v_asNumber}
Expand Down
1 change: 1 addition & 0 deletions web/console/src/modules/cluster/constants/ActionType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ export const v_IC_AS = 'v_IC_AS';
export const IC_AS = 'IC_AS';
export const v_IC_SwitchIp = 'v_IC_SwitchIp';
export const IC_SwitchIp = 'IC_SwitchIp';
export const IC_UseBGP = 'IC_UseBGP';

export const IC_K8SVersion = 'IC_K8SVersion';
export const IC_Cidr = 'IC_Cidr';
Expand Down
2 changes: 2 additions & 0 deletions web/console/src/modules/cluster/models/CreateIC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ export interface CreateIC extends Identifiable {

switchIp?: string;
v_switchIp: Validation;

useBGP: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ const TempReducer = combineReducers({
switchIp: reduceToPayload(ActionType.IC_SwitchIp, ''),
v_switchIp: reduceToPayload(ActionType.v_IC_SwitchIp, initValidator),

gpuType: reduceToPayload(ActionType.v_IC_GpuType, GPUTYPE.PGPU)
gpuType: reduceToPayload(ActionType.v_IC_GpuType, GPUTYPE.PGPU),

useBGP: reduceToPayload(ActionType.IC_UseBGP, false)
});

export const CreateICReducer = (state, action) => {
Expand Down