Skip to content

Commit 3a7da72

Browse files
authored
Fix NodeSelector Screen (#732)
This makes it so the node selector logic is different from podAffinity Signed-off-by: Daniel Valdivia <[email protected]>
1 parent 4f0752c commit 3a7da72

File tree

14 files changed

+127
-82
lines changed

14 files changed

+127
-82
lines changed

portal-ui/build/asset-manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"files": {
33
"main.css": "/static/css/main.a19f3d53.chunk.css",
4-
"main.js": "/static/js/main.d6310664.chunk.js",
5-
"main.js.map": "/static/js/main.d6310664.chunk.js.map",
4+
"main.js": "/static/js/main.b74c83f1.chunk.js",
5+
"main.js.map": "/static/js/main.b74c83f1.chunk.js.map",
66
"runtime-main.js": "/static/js/runtime-main.f48e99e5.js",
77
"runtime-main.js.map": "/static/js/runtime-main.f48e99e5.js.map",
88
"static/css/2.f324abd6.chunk.css": "/static/css/2.f324abd6.chunk.css",
@@ -20,6 +20,6 @@
2020
"static/css/2.f324abd6.chunk.css",
2121
"static/js/2.26f9f812.chunk.js",
2222
"static/css/main.a19f3d53.chunk.css",
23-
"static/js/main.d6310664.chunk.js"
23+
"static/js/main.b74c83f1.chunk.js"
2424
]
2525
}

portal-ui/build/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MinIO Console"/><link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;500;700;900&display=swap" rel="stylesheet"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="manifest" href="/manifest.json"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#3a4e54"/><title>MinIO Console</title><link href="/static/css/2.f324abd6.chunk.css" rel="stylesheet"><link href="/static/css/main.a19f3d53.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,l,i=r[0],a=r[1],p=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var a=t[i];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonpportal-ui"]=this["webpackJsonpportal-ui"]||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var p=0;p<i.length;p++)r(i[p]);var f=a;t()}([])</script><script src="/static/js/2.26f9f812.chunk.js"></script><script src="/static/js/main.d6310664.chunk.js"></script></body></html>
1+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MinIO Console"/><link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;500;700;900&display=swap" rel="stylesheet"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="manifest" href="/manifest.json"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#3a4e54"/><title>MinIO Console</title><link href="/static/css/2.f324abd6.chunk.css" rel="stylesheet"><link href="/static/css/main.a19f3d53.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,l,i=r[0],a=r[1],p=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var a=t[i];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonpportal-ui"]=this["webpackJsonpportal-ui"]||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var p=0;p<i.length;p++)r(i[p]);var f=a;t()}([])</script><script src="/static/js/2.26f9f812.chunk.js"></script><script src="/static/js/main.b74c83f1.chunk.js"></script></body></html>

portal-ui/build/static/js/main.b74c83f1.chunk.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

portal-ui/build/static/js/main.b74c83f1.chunk.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

portal-ui/build/static/js/main.d6310664.chunk.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

portal-ui/build/static/js/main.d6310664.chunk.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

portal-ui/src/common/types.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export interface ITenantUsage {
9999

100100
export interface IAffinityModel {
101101
podAntiAffinity?: IPodAntiAffinityModel;
102-
podAffinity?: IPodAffinityModel;
102+
nodeAffinity?: INodeAffinityModel;
103103
}
104104

105105
export interface IPodAntiAffinityModel {
@@ -115,17 +115,16 @@ export interface IPodAffinityTermLabelSelector {
115115
matchExpressions: IMatchExpressionItem[];
116116
}
117117

118-
export interface IPodAffinityModel {
119-
requiredDuringSchedulingIgnoredDuringExecution: IPodAffinityTerms[];
118+
export interface INodeAffinityModel {
119+
requiredDuringSchedulingIgnoredDuringExecution: INodeAffinityTerms;
120120
}
121121

122-
export interface IPodAffinityTerms {
123-
labelSelector: IPodAffinityLabelsSelector;
124-
topologyKey: string;
122+
export interface INodeAffinityTerms {
123+
nodeSelectorTerms: INodeAffinityLabelsSelector[];
125124
}
126125

127-
export interface IPodAffinityLabelsSelector {
128-
matchLabels: object;
126+
export interface INodeAffinityLabelsSelector {
127+
matchExpressions: object[];
129128
}
130129

131130
export interface IMatchExpressionItem {
@@ -377,4 +376,5 @@ export interface PrometheusConfiguration {
377376
export interface AffinityConfiguration {
378377
affinityType: "default" | "nodeSelector" | "none";
379378
nodeSelectorLabels?: ILabelKeyPair[];
379+
withPodAntiAffinity?: boolean;
380380
}

portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ const AddTenant = ({
168168
fields.configure.prometheusSelectedStorageClass;
169169
const prometheusVolumeSize = fields.configure.prometheusVolumeSize;
170170
const affinityType = fields.affinity.podAffinity;
171-
const affinityLabels = fields.affinity.affinityLabels;
171+
const nodeSelectorLabels = fields.affinity.nodeSelectorLabels;
172+
const withPodAntiAffinity = fields.affinity.withPodAntiAffinity;
172173

173174
if (addSending) {
174175
const poolName = generatePoolName([]);
@@ -182,7 +183,14 @@ const AddTenant = ({
182183
};
183184
break;
184185
case "nodeSelector":
185-
affinityObject = { affinity: getNodeSelector(affinityLabels) };
186+
affinityObject = {
187+
affinity: getNodeSelector(
188+
nodeSelectorLabels,
189+
withPodAntiAffinity,
190+
tenantName,
191+
poolName
192+
),
193+
};
186194
break;
187195
}
188196

portal-ui/src/screens/Console/Tenants/AddTenant/Steps/Affinity.tsx

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ import {
3131
} from "../../../../../utils/validationFunctions";
3232
import RadioGroupSelector from "../../../Common/FormComponents/RadioGroupSelector/RadioGroupSelector";
3333
import QueryMultiSelector from "../../../Common/FormComponents/QueryMultiSelector/QueryMultiSelector";
34+
import FormSwitchWrapper from "../../../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper";
3435

3536
interface IAffinityProps {
3637
classes: any;
3738
podAffinity: string;
38-
affinityLabels: string;
39+
nodeSelectorLabels: string;
40+
withPodAntiAffinity: boolean;
3941
setModalErrorSnackMessage: typeof setModalErrorSnackMessage;
4042
updateAddField: typeof updateAddField;
4143
isPageValid: typeof isPageValid;
@@ -53,7 +55,8 @@ const styles = (theme: Theme) =>
5355
const Affinity = ({
5456
classes,
5557
podAffinity,
56-
affinityLabels,
58+
nodeSelectorLabels,
59+
withPodAntiAffinity,
5760
setModalErrorSnackMessage,
5861
updateAddField,
5962
isPageValid,
@@ -75,7 +78,7 @@ const Affinity = ({
7578
if (podAffinity === "nodeSelector") {
7679
let valid = true;
7780

78-
const splittedLabels = affinityLabels.split("&");
81+
const splittedLabels = nodeSelectorLabels.split("&");
7982

8083
if (splittedLabels.length === 1 && splittedLabels[0] === "") {
8184
valid = false;
@@ -100,7 +103,7 @@ const Affinity = ({
100103
{
101104
fieldKey: "labels",
102105
required: true,
103-
value: affinityLabels,
106+
value: nodeSelectorLabels,
104107
customValidation: !valid,
105108
customValidationMessage:
106109
"You need to add at least one label key-pair",
@@ -113,7 +116,7 @@ const Affinity = ({
113116
isPageValid("affinity", Object.keys(commonVal).length === 0);
114117

115118
setValidationErrors(commonVal);
116-
}, [isPageValid, podAffinity, affinityLabels]);
119+
}, [isPageValid, podAffinity, nodeSelectorLabels]);
117120

118121
return (
119122
<Fragment>
@@ -143,13 +146,28 @@ const Affinity = ({
143146
{podAffinity === "nodeSelector" && (
144147
<Fragment>
145148
<br />
149+
<Grid item xs={12}>
150+
<FormSwitchWrapper
151+
value="with_pod_anti_affinity"
152+
id="with_pod_anti_affinity"
153+
name="with_pod_anti_affinity"
154+
checked={withPodAntiAffinity}
155+
onChange={(e) => {
156+
const targetD = e.target;
157+
const checked = targetD.checked;
158+
159+
updateField("withPodAntiAffinity", checked);
160+
}}
161+
label={"With Pod Anti-Affinity"}
162+
/>
163+
</Grid>
146164
<Grid item xs={12}>
147165
<QueryMultiSelector
148166
name="labels"
149167
label="Labels"
150-
elements={affinityLabels}
168+
elements={nodeSelectorLabels}
151169
onChange={(vl: string) => {
152-
updateField("affinityLabels", vl);
170+
updateField("nodeSelectorLabels", vl);
153171
}}
154172
keyPlaceholder="Label Key"
155173
valuePlaceholder="Label Value"
@@ -166,7 +184,10 @@ const Affinity = ({
166184

167185
const mapState = (state: AppState) => ({
168186
podAffinity: state.tenants.createTenant.fields.affinity.podAffinity,
169-
affinityLabels: state.tenants.createTenant.fields.affinity.affinityLabels,
187+
nodeSelectorLabels:
188+
state.tenants.createTenant.fields.affinity.nodeSelectorLabels,
189+
withPodAntiAffinity:
190+
state.tenants.createTenant.fields.affinity.withPodAntiAffinity,
170191
});
171192

172193
const connector = connect(mapState, {

portal-ui/src/screens/Console/Tenants/TenantDetails/TenantYAML.tsx

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -115,44 +115,46 @@ const TenantYAML = ({
115115
title={`YAML`}
116116
>
117117
{loading && <LinearProgress />}
118-
<form
119-
noValidate
120-
autoComplete="off"
121-
onSubmit={(e: React.FormEvent<HTMLFormElement>) => {
122-
updateTenant(e);
123-
}}
124-
>
125-
<Grid container>
126-
<Grid item xs={12} className={classes.formScrollable}>
127-
<Grid item xs={12}>
128-
<br />
118+
{!loading && (
119+
<form
120+
noValidate
121+
autoComplete="off"
122+
onSubmit={(e: React.FormEvent<HTMLFormElement>) => {
123+
updateTenant(e);
124+
}}
125+
>
126+
<Grid container>
127+
<Grid item xs={12} className={classes.formScrollable}>
128+
<Grid item xs={12}>
129+
<br />
130+
</Grid>
131+
<CodeMirrorWrapper
132+
label={`Tenant Specification`}
133+
value={tenantYaml}
134+
mode={"yaml"}
135+
onBeforeChange={(editor, data, value) => {
136+
setTenantYaml(value);
137+
}}
138+
/>
129139
</Grid>
130-
<CodeMirrorWrapper
131-
label={`Tenant Specification`}
132-
value={tenantYaml}
133-
mode={"yaml"}
134-
onBeforeChange={(editor, data, value) => {
135-
setTenantYaml(value);
136-
}}
137-
/>
138-
</Grid>
139-
<Grid item xs={12} className={classes.buttonContainer}>
140-
<Button
141-
type="submit"
142-
variant="contained"
143-
color="primary"
144-
disabled={addLoading || !validSave}
145-
>
146-
Save
147-
</Button>
148-
</Grid>
149-
{addLoading && (
150-
<Grid item xs={12}>
151-
<LinearProgress />
140+
<Grid item xs={12} className={classes.buttonContainer}>
141+
<Button
142+
type="submit"
143+
variant="contained"
144+
color="primary"
145+
disabled={addLoading || !validSave}
146+
>
147+
Save
148+
</Button>
152149
</Grid>
153-
)}
154-
</Grid>
155-
</form>
150+
{addLoading && (
151+
<Grid item xs={12}>
152+
<LinearProgress />
153+
</Grid>
154+
)}
155+
</Grid>
156+
</form>
157+
)}
156158
</ModalWrapper>
157159
);
158160
};

0 commit comments

Comments
 (0)