Added runtime class name selector (#2626)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
@@ -170,6 +170,12 @@ const Configure = ({ classes }: IConfigureProps) => {
|
||||
(state: AppState) =>
|
||||
state.createTenant.fields.configure.tenantSecurityContext
|
||||
);
|
||||
const customRuntime = useSelector(
|
||||
(state: AppState) => state.createTenant.fields.configure.customRuntime
|
||||
);
|
||||
const runtimeClassName = useSelector(
|
||||
(state: AppState) => state.createTenant.fields.configure.runtimeClassName
|
||||
);
|
||||
|
||||
const [validationErrors, setValidationErrors] = useState<any>({});
|
||||
|
||||
@@ -561,6 +567,47 @@ const Configure = ({ classes }: IConfigureProps) => {
|
||||
</fieldset>
|
||||
</Grid>
|
||||
)}
|
||||
<Grid item xs={12} className={classes.configSectionItem}>
|
||||
<FormSwitchWrapper
|
||||
value="customRuntime"
|
||||
id="tenant_custom_runtime"
|
||||
name="tenant_custom_runtime"
|
||||
checked={customRuntime}
|
||||
onChange={(e) => {
|
||||
const targetD = e.target;
|
||||
const checked = targetD.checked;
|
||||
|
||||
updateField("customRuntime", checked);
|
||||
}}
|
||||
label={"Custom Runtime Configurations"}
|
||||
/>
|
||||
</Grid>
|
||||
{customRuntime && (
|
||||
<Grid item xs={12} className={classes.tenantCustomizationFields}>
|
||||
<fieldset className={classes.fieldGroup}>
|
||||
<legend className={classes.descriptionText}>
|
||||
Custom Runtime Configurations
|
||||
</legend>
|
||||
<Grid item xs={12} className={`${classes.configSectionItem}`}>
|
||||
<div className={classes.containerItem}>
|
||||
<InputBoxWrapper
|
||||
id="tenant_runtime_runtimeClassName"
|
||||
name="tenant_runtime_runtimeClassName"
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
updateField("runtimeClassName", e.target.value);
|
||||
cleanValidation("tenant_runtime_runtimeClassName");
|
||||
}}
|
||||
label="Runtime Class Name"
|
||||
value={runtimeClassName}
|
||||
error={
|
||||
validationErrors["tenant_runtime_runtimeClassName"] || ""
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</Grid>
|
||||
</fieldset>
|
||||
</Grid>
|
||||
)}
|
||||
<Divider />
|
||||
|
||||
<div className={classes.headerElement}>
|
||||
|
||||
@@ -124,7 +124,7 @@ const NameTenantMain = ({ classes, formToRender }: INameTenantMainScreen) => {
|
||||
return (
|
||||
<Fragment>
|
||||
<Grid container>
|
||||
<Grid item sx={{ width: "calc(100% - 300px)" }}>
|
||||
<Grid item sx={{ width: "calc(100% - 320px)" }}>
|
||||
<Paper className={classes.paperWrapper} sx={{ minHeight: 550 }}>
|
||||
<Grid container>
|
||||
<Grid item xs={12}>
|
||||
|
||||
@@ -103,6 +103,8 @@ const initialState: ICreateTenant = {
|
||||
exposeMinIO: true,
|
||||
exposeConsole: true,
|
||||
tenantCustom: false,
|
||||
customRuntime: false,
|
||||
runtimeClassName: "",
|
||||
envVars: [{ key: "", value: "" }],
|
||||
logSearchEnabled: false,
|
||||
prometheusEnabled: false,
|
||||
|
||||
@@ -139,6 +139,8 @@ export const createTenantAsync = createAsyncThunk(
|
||||
const minioDomains = fields.configure.minioDomains;
|
||||
const consoleDomain = fields.configure.consoleDomain;
|
||||
const environmentVariables = fields.configure.envVars;
|
||||
const customRuntime = fields.configure.customRuntime;
|
||||
const runtimeClassName = fields.configure.runtimeClassName;
|
||||
|
||||
let tolerations = state.createTenant.tolerations;
|
||||
let namespace = state.createTenant.fields.nameTenant.namespace;
|
||||
@@ -171,6 +173,14 @@ export const createTenantAsync = createAsyncThunk(
|
||||
|
||||
const erasureCode = ecParity.split(":")[1];
|
||||
|
||||
let runtimeClass = {};
|
||||
|
||||
if (customRuntime) {
|
||||
runtimeClass = {
|
||||
runtimeClassName,
|
||||
};
|
||||
}
|
||||
|
||||
let dataSend: ITenantCreator = {
|
||||
name: tenantName,
|
||||
namespace: namespace,
|
||||
@@ -195,8 +205,9 @@ export const createTenantAsync = createAsyncThunk(
|
||||
storage_class_name: selectedStorageClass,
|
||||
},
|
||||
securityContext: tenantCustom ? tenantSecurityContext : null,
|
||||
...affinityObject,
|
||||
tolerations: tolerationValues,
|
||||
...affinityObject,
|
||||
...runtimeClass,
|
||||
},
|
||||
],
|
||||
erasureCodingParity: parseInt(erasureCode, 10),
|
||||
|
||||
@@ -53,6 +53,7 @@ export interface IPool {
|
||||
affinity?: IAffinityModel;
|
||||
tolerations?: ITolerationModel[];
|
||||
securityContext?: ISecurityContext | null;
|
||||
runtimeClassName: string;
|
||||
}
|
||||
|
||||
export interface IPodListElement {
|
||||
|
||||
@@ -86,6 +86,12 @@ const PoolConfiguration = ({ classes }: IConfigureProps) => {
|
||||
const securityContext = useSelector(
|
||||
(state: AppState) => state.addPool.configuration.securityContext
|
||||
);
|
||||
const customRuntime = useSelector(
|
||||
(state: AppState) => state.addPool.configuration.customRuntime
|
||||
);
|
||||
const runtimeClassName = useSelector(
|
||||
(state: AppState) => state.addPool.configuration.runtimeClassName
|
||||
);
|
||||
|
||||
const [validationErrors, setValidationErrors] = useState<any>({});
|
||||
|
||||
@@ -276,6 +282,52 @@ const PoolConfiguration = ({ classes }: IConfigureProps) => {
|
||||
</fieldset>
|
||||
</Grid>
|
||||
)}
|
||||
<Grid
|
||||
item
|
||||
xs={12}
|
||||
className={classes.configSectionItem}
|
||||
sx={{ marginTop: "10px" }}
|
||||
>
|
||||
<FormSwitchWrapper
|
||||
value="customRuntime"
|
||||
id="tenant_custom_runtime"
|
||||
name="tenant_custom_runtime"
|
||||
checked={customRuntime}
|
||||
onChange={(e) => {
|
||||
const targetD = e.target;
|
||||
const checked = targetD.checked;
|
||||
|
||||
updateField("customRuntime", checked);
|
||||
}}
|
||||
label={"Custom Runtime Configurations"}
|
||||
/>
|
||||
</Grid>
|
||||
{customRuntime && (
|
||||
<Grid item xs={12} className={classes.tenantCustomizationFields}>
|
||||
<fieldset className={classes.fieldGroup}>
|
||||
<legend className={classes.descriptionText}>
|
||||
Custom Runtime Configurations
|
||||
</legend>
|
||||
<Grid item xs={12} className={`${classes.configSectionItem}`}>
|
||||
<div className={classes.containerItem}>
|
||||
<InputBoxWrapper
|
||||
id="tenant_runtime_runtimeClassName"
|
||||
name="tenant_runtime_runtimeClassName"
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
updateField("runtimeClassName", e.target.value);
|
||||
cleanValidation("tenant_runtime_runtimeClassName");
|
||||
}}
|
||||
label="Runtime Class Name"
|
||||
value={runtimeClassName}
|
||||
error={
|
||||
validationErrors["tenant_runtime_runtimeClassName"] || ""
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</Grid>
|
||||
</fieldset>
|
||||
</Grid>
|
||||
)}
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -71,6 +71,8 @@ const initialState: IAddPool = {
|
||||
fsGroupChangePolicy: "Always",
|
||||
runAsNonRoot: true,
|
||||
},
|
||||
customRuntime: false,
|
||||
runtimeClassName: "",
|
||||
},
|
||||
nodeSelectorPairs: [{ key: "", value: "" }],
|
||||
tolerations: [
|
||||
|
||||
@@ -42,6 +42,9 @@ export const addPoolAsync = createAsyncThunk(
|
||||
const securityContextEnabled =
|
||||
state.addPool.configuration.securityContextEnabled;
|
||||
const securityContext = state.addPool.configuration.securityContext;
|
||||
const customRuntime = state.addPool.configuration.customRuntime;
|
||||
const runtimeClassName = state.addPool.configuration.runtimeClassName;
|
||||
|
||||
if (tenant === null) {
|
||||
return;
|
||||
}
|
||||
@@ -72,6 +75,14 @@ export const addPoolAsync = createAsyncThunk(
|
||||
(toleration) => toleration.key.trim() !== ""
|
||||
);
|
||||
|
||||
let runtimeClass = {};
|
||||
|
||||
if (customRuntime) {
|
||||
runtimeClass = {
|
||||
runtimeClassName,
|
||||
};
|
||||
}
|
||||
|
||||
const data: IAddPoolRequest = {
|
||||
name: poolName,
|
||||
servers: numberOfNodes,
|
||||
@@ -84,6 +95,7 @@ export const addPoolAsync = createAsyncThunk(
|
||||
tolerations: tolerationValues,
|
||||
securityContext: securityContextEnabled ? securityContext : null,
|
||||
...affinityObject,
|
||||
...runtimeClass,
|
||||
};
|
||||
const poolsURL = `/namespaces/${tenant?.namespace || ""}/tenants/${
|
||||
tenant?.name || ""
|
||||
|
||||
@@ -79,6 +79,8 @@ const PoolDetails = () => {
|
||||
);
|
||||
};
|
||||
|
||||
console.log(poolInformation);
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<Grid item xs={12} sx={{ ...stylingLayout }}>
|
||||
@@ -108,6 +110,10 @@ const PoolDetails = () => {
|
||||
value={poolInformation.volumes_per_server}
|
||||
/>
|
||||
<LabelValuePair label={"Capacity"} value={poolInformation.capacity} />
|
||||
<LabelValuePair
|
||||
label={"Runtime Class Name"}
|
||||
value={poolInformation.runtimeClassName}
|
||||
/>
|
||||
</Box>
|
||||
<HeaderSection title={"Resources"} />
|
||||
<Box sx={{ ...twoColCssGridLayoutConfig }}>
|
||||
|
||||
@@ -88,6 +88,12 @@ const PoolConfiguration = ({ classes }: IConfigureProps) => {
|
||||
const securityContext = useSelector(
|
||||
(state: AppState) => state.editPool.fields.configuration.securityContext
|
||||
);
|
||||
const customRuntime = useSelector(
|
||||
(state: AppState) => state.editPool.fields.configuration.customRuntime
|
||||
);
|
||||
const runtimeClassName = useSelector(
|
||||
(state: AppState) => state.editPool.fields.configuration.runtimeClassName
|
||||
);
|
||||
|
||||
const [validationErrors, setValidationErrors] = useState<any>({});
|
||||
|
||||
@@ -275,6 +281,52 @@ const PoolConfiguration = ({ classes }: IConfigureProps) => {
|
||||
</fieldset>
|
||||
</Grid>
|
||||
)}
|
||||
<Grid
|
||||
item
|
||||
xs={12}
|
||||
className={classes.configSectionItem}
|
||||
sx={{ marginTop: "10px" }}
|
||||
>
|
||||
<FormSwitchWrapper
|
||||
value="customRuntime"
|
||||
id="tenant_custom_runtime"
|
||||
name="tenant_custom_runtime"
|
||||
checked={customRuntime}
|
||||
onChange={(e) => {
|
||||
const targetD = e.target;
|
||||
const checked = targetD.checked;
|
||||
|
||||
updateField("customRuntime", checked);
|
||||
}}
|
||||
label={"Custom Runtime Configurations"}
|
||||
/>
|
||||
</Grid>
|
||||
{customRuntime && (
|
||||
<Grid item xs={12} className={classes.tenantCustomizationFields}>
|
||||
<fieldset className={classes.fieldGroup}>
|
||||
<legend className={classes.descriptionText}>
|
||||
Custom Runtime Configurations
|
||||
</legend>
|
||||
<Grid item xs={12} className={`${classes.configSectionItem}`}>
|
||||
<div className={classes.containerItem}>
|
||||
<InputBoxWrapper
|
||||
id="tenant_runtime_runtimeClassName"
|
||||
name="tenant_runtime_runtimeClassName"
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
updateField("runtimeClassName", e.target.value);
|
||||
cleanValidation("tenant_runtime_runtimeClassName");
|
||||
}}
|
||||
label="Runtime Class Name"
|
||||
value={runtimeClassName}
|
||||
error={
|
||||
validationErrors["tenant_runtime_runtimeClassName"] || ""
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</Grid>
|
||||
</fieldset>
|
||||
</Grid>
|
||||
)}
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -53,6 +53,8 @@ const initialState: IEditPool = {
|
||||
fsGroupChangePolicy: "Always",
|
||||
runAsNonRoot: true,
|
||||
},
|
||||
customRuntime: false,
|
||||
runtimeClassName: "",
|
||||
},
|
||||
nodeSelectorPairs: [{ key: "", value: "" }],
|
||||
tolerations: [
|
||||
@@ -156,6 +158,8 @@ export const editPoolSlice = createSlice({
|
||||
action.payload.securityContext?.fsGroupChangePolicy || "Always",
|
||||
runAsNonRoot: !!action.payload.securityContext?.runAsNonRoot,
|
||||
},
|
||||
customRuntime: !!action.payload.runtimeClassName,
|
||||
runtimeClassName: action.payload.runtimeClassName,
|
||||
},
|
||||
affinity: {
|
||||
podAffinity,
|
||||
|
||||
@@ -45,6 +45,10 @@ export const editPoolAsync = createAsyncThunk(
|
||||
const securityContextEnabled =
|
||||
state.editPool.fields.configuration.securityContextEnabled;
|
||||
const securityContext = state.editPool.fields.configuration.securityContext;
|
||||
const customRuntime = state.editPool.fields.configuration.customRuntime;
|
||||
const runtimeClassName =
|
||||
state.editPool.fields.configuration.runtimeClassName;
|
||||
|
||||
if (!tenant) {
|
||||
return;
|
||||
}
|
||||
@@ -98,6 +102,14 @@ export const editPoolAsync = createAsyncThunk(
|
||||
return request;
|
||||
});
|
||||
|
||||
let runtimeClass = {};
|
||||
|
||||
if (customRuntime) {
|
||||
runtimeClass = {
|
||||
runtimeClassName,
|
||||
};
|
||||
}
|
||||
|
||||
const data: IEditPoolRequest = {
|
||||
pools: [
|
||||
...cleanPools,
|
||||
@@ -113,6 +125,7 @@ export const editPoolAsync = createAsyncThunk(
|
||||
tolerations: tolerationValues,
|
||||
securityContext: securityContextEnabled ? securityContext : null,
|
||||
...affinityObject,
|
||||
...runtimeClass,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -155,6 +155,8 @@ export interface IConfigureFields {
|
||||
exposeConsole: boolean;
|
||||
prometheusEnabled: boolean;
|
||||
tenantCustom: boolean;
|
||||
customRuntime: boolean;
|
||||
runtimeClassName: string;
|
||||
envVars: LabelKeyPair[];
|
||||
logSearchEnabled: boolean;
|
||||
logSearchVolumeSize: string;
|
||||
@@ -324,6 +326,8 @@ export interface IAddPoolSetup {
|
||||
export interface IPoolConfiguration {
|
||||
securityContextEnabled: boolean;
|
||||
securityContext: ISecurityContext;
|
||||
customRuntime: boolean;
|
||||
runtimeClassName: string;
|
||||
}
|
||||
|
||||
export interface ITenantIdentityProviderResponse {
|
||||
|
||||
Reference in New Issue
Block a user