@@ -415,6 +442,72 @@ const Affinity = ({
)}
+
+
+ Tolerations
+
+ {validationErrors["tolerations"]}
+
+
+ {tolerations &&
+ tolerations.map((tol, i) => {
+ return (
+
+ {
+ updateToleration(i, "effect", value);
+ }}
+ tolerationKey={tol.key}
+ onTolerationKeyChange={(value) => {
+ updateToleration(i, "key", value);
+ }}
+ operator={tol.operator}
+ onOperatorChange={(value) => {
+ updateToleration(i, "operator", value);
+ }}
+ value={tol.value}
+ onValueChange={(value) => {
+ updateToleration(i, "value", value);
+ }}
+ tolerationSeconds={tol.tolerationSeconds?.seconds || 0}
+ onSecondsChange={(value) => {
+ updateToleration(i, "tolerationSeconds", {
+ seconds: value,
+ });
+ }}
+ index={i}
+ />
+
+
+
+ removeToleration(i)}
+ disabled={tolerations.length <= 1}
+ >
+
+
+
+
+ );
+ })}
+
+
+
);
};
@@ -427,6 +520,7 @@ const mapState = (state: AppState) => {
nodeSelectorLabels: createTenant.fields.affinity.nodeSelectorLabels,
withPodAntiAffinity: createTenant.fields.affinity.withPodAntiAffinity,
keyValuePairs: createTenant.nodeSelectorPairs,
+ tolerations: createTenant.tolerations,
};
};
@@ -435,6 +529,9 @@ const connector = connect(mapState, {
updateAddField,
isPageValid,
setKeyValuePairs,
+ setTolerationInfo,
+ addNewToleration,
+ removeToleration,
});
export default withStyles(styles)(connector(Affinity));
diff --git a/portal-ui/src/screens/Console/Tenants/actions.ts b/portal-ui/src/screens/Console/Tenants/actions.ts
index a7abe9b59..e3ed758b7 100644
--- a/portal-ui/src/screens/Console/Tenants/actions.ts
+++ b/portal-ui/src/screens/Console/Tenants/actions.ts
@@ -44,8 +44,11 @@ import {
TENANT_DETAILS_SET_TAB,
TENANT_DETAILS_SET_TENANT,
ADD_TENANT_SET_KEY_PAIR_VALUE,
- LabelKeyPair,
+ ADD_TENANT_SET_TOLERATION_VALUE,
+ ADD_TENANT_ADD_NEW_TOLERATION,
+ LabelKeyPair, ADD_TENANT_REMOVE_TOLERATION_ROW,
} from "./types";
+import {ITolerationModel} from "../../../common/types";
// Basic actions
export const setWizardPage = (page: number) => {
@@ -295,3 +298,24 @@ export const setKeyValuePairs = (newArray: LabelKeyPair[]) => {
newArray,
};
};
+
+export const setTolerationInfo = (index: number, tolerationValue: ITolerationModel) => {
+ return {
+ type: ADD_TENANT_SET_TOLERATION_VALUE,
+ index,
+ toleration: tolerationValue,
+ }
+};
+
+export const addNewToleration = () => {
+ return {
+ type: ADD_TENANT_ADD_NEW_TOLERATION,
+ }
+};
+
+export const removeToleration = (index: number) => {
+ return {
+ type: ADD_TENANT_REMOVE_TOLERATION_ROW,
+ index
+ }
+};
diff --git a/portal-ui/src/screens/Console/Tenants/reducer.ts b/portal-ui/src/screens/Console/Tenants/reducer.ts
index d1cfc00df..841295f26 100644
--- a/portal-ui/src/screens/Console/Tenants/reducer.ts
+++ b/portal-ui/src/screens/Console/Tenants/reducer.ts
@@ -23,6 +23,7 @@ import {
ADD_TENANT_ADD_FILE_TO_CONSOLE_CA_KEYPAIR,
ADD_TENANT_ADD_FILE_TO_MINIO_KEYPAIR,
ADD_TENANT_ADD_MINIO_KEYPAIR,
+ ADD_TENANT_ADD_NEW_TOLERATION,
ADD_TENANT_DELETE_CA_KEYPAIR,
ADD_TENANT_DELETE_CONSOLE_CA_KEYPAIR,
ADD_TENANT_DELETE_MINIO_KEYPAIR,
@@ -31,13 +32,15 @@ import {
ADD_TENANT_ENCRYPTION_SERVER_CERT,
ADD_TENANT_ENCRYPTION_VAULT_CA,
ADD_TENANT_ENCRYPTION_VAULT_CERT,
+ ADD_TENANT_REMOVE_TOLERATION_ROW,
ADD_TENANT_RESET_FORM,
ADD_TENANT_SET_CURRENT_PAGE,
ADD_TENANT_SET_KEY_PAIR_VALUE,
ADD_TENANT_SET_LIMIT_SIZE,
ADD_TENANT_SET_PAGE_VALID,
- ADD_TENANT_SET_STORAGE_TYPE,
ADD_TENANT_SET_STORAGE_CLASSES_LIST,
+ ADD_TENANT_SET_STORAGE_TYPE,
+ ADD_TENANT_SET_TOLERATION_VALUE,
ADD_TENANT_UPDATE_FIELD,
ITenantState,
TENANT_DETAILS_SET_CURRENT_TENANT,
@@ -49,6 +52,7 @@ import {
import { KeyPair } from "./ListTenants/utils";
import { getRandomString } from "./utils";
import { addTenantSetStorageTypeReducer } from "./reducers/add-tenant-reducer";
+import { ITolerationEffect, ITolerationOperator } from "../../../common/types";
const initialState: ITenantState = {
createTenant: {
@@ -334,6 +338,15 @@ const initialState: ITenantState = {
},
},
nodeSelectorPairs: [{ key: "", value: "" }],
+ tolerations: [
+ {
+ key: "",
+ tolerationSeconds: { seconds: 0 },
+ value: "",
+ effect: ITolerationEffect.NoSchedule,
+ operator: ITolerationOperator.Equal,
+ },
+ ],
},
tenantDetails: {
currentTenant: "",
@@ -886,6 +899,15 @@ export function tenantsReducer(
},
},
nodeSelectorPairs: [{ key: "", value: "" }],
+ tolerations: [
+ {
+ key: "",
+ tolerationSeconds: { seconds: 0 },
+ value: "",
+ effect: ITolerationEffect.NoSchedule,
+ operator: ITolerationOperator.Equal,
+ },
+ ],
},
};
case ADD_TENANT_SET_KEY_PAIR_VALUE:
@@ -939,6 +961,51 @@ export function tenantsReducer(
...newTab,
},
};
+ case ADD_TENANT_SET_TOLERATION_VALUE:
+ const newSetTolerationValue = [...state.createTenant.tolerations];
+
+ newSetTolerationValue[action.index] = action.toleration;
+
+ return {
+ ...state,
+ createTenant: {
+ ...state.createTenant,
+ tolerations: [...newSetTolerationValue],
+ },
+ };
+ case ADD_TENANT_ADD_NEW_TOLERATION:
+ const newTolerationArray = [
+ ...state.createTenant.tolerations,
+ {
+ key: "",
+ tolerationSeconds: { seconds: 0 },
+ value: "",
+ effect: ITolerationEffect.NoSchedule,
+ operator: ITolerationOperator.Equal,
+ },
+ ];
+ return {
+ ...state,
+ createTenant: {
+ ...state.createTenant,
+ tolerations: [...newTolerationArray],
+ },
+ };
+ case ADD_TENANT_REMOVE_TOLERATION_ROW:
+ const cleanTolerationArray = state.createTenant.tolerations.filter(
+ (_, index) => index !== action.index
+ );
+
+ console.log("action", action.index, cleanTolerationArray)
+
+ return {
+ ...state,
+ createTenant: {
+ ...state.createTenant,
+ tolerations: [...cleanTolerationArray],
+ },
+ };
+
default:
return state;
}
diff --git a/portal-ui/src/screens/Console/Tenants/types.ts b/portal-ui/src/screens/Console/Tenants/types.ts
index ac0b6149a..c37e61492 100644
--- a/portal-ui/src/screens/Console/Tenants/types.ts
+++ b/portal-ui/src/screens/Console/Tenants/types.ts
@@ -20,6 +20,7 @@ import {
IErasureCodeCalc,
IGCPConfig,
IGemaltoCredentials,
+ ITolerationModel,
} from "../../../common/types";
import { IResourcesSize, ITenant } from "./ListTenants/types";
import { KeyPair, Opts } from "./ListTenants/utils";
@@ -69,6 +70,12 @@ export const ADD_TENANT_ENCRYPTION_GEMALTO_CA =
// Affinity Node Selector KeyPairs
export const ADD_TENANT_SET_KEY_PAIR_VALUE = "ADD_TENANT/SET_KEY_PAIR_VALUE";
+// Affinity Tolerations
+export const ADD_TENANT_SET_TOLERATION_VALUE =
+ "ADD_TENANT/SET_TOLERATION_VALUE";
+export const ADD_TENANT_ADD_NEW_TOLERATION = "ADD_TENANT/ADD_NEW_TOLERATION";
+export const ADD_TENANT_REMOVE_TOLERATION_ROW = "ADD_TENANT/REMOVE_TOLERATION_ROW";
+
// Tenant Details
export const TENANT_DETAILS_SET_LOADING = "TENANT_DETAILS/SET_LOADING";
export const TENANT_DETAILS_SET_CURRENT_TENANT =
@@ -130,6 +137,7 @@ export interface IKeysecureConfiguration {
credentials: IGemaltoCredentials;
tls: IGemaltoTLS;
}
+
export interface IGemaltoConfiguration {
keysecure: IKeysecureConfiguration;
}
@@ -155,6 +163,7 @@ export interface ICreateTenant {
fields: IFieldStore;
certificates: ICertificatesItems;
nodeSelectorPairs: LabelKeyPair[];
+ tolerations: ITolerationModel[];
}
export interface ICertificatesItems {
@@ -520,6 +529,21 @@ interface SetTenantTab {
tab: string;
}
+interface SetTolerationValue {
+ type: typeof ADD_TENANT_SET_TOLERATION_VALUE;
+ index: number;
+ toleration: ITolerationModel;
+}
+
+interface AddNewToleration {
+ type: typeof ADD_TENANT_ADD_NEW_TOLERATION;
+}
+
+interface RemoveTolerationRow {
+ type: typeof ADD_TENANT_REMOVE_TOLERATION_ROW;
+ index: number;
+}
+
export type FieldsToHandle = INameTenantFields;
export type TenantsManagementTypes =
@@ -549,4 +573,7 @@ export type TenantsManagementTypes =
| SetLoadingTenant
| SetTenantName
| SetTenantDetails
- | SetTenantTab;
+ | SetTenantTab
+ | SetTolerationValue
+ | AddNewToleration
+ | RemoveTolerationRow;