-
Notifications
You must be signed in to change notification settings - Fork 45
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
[UI] Display system partitions in node page #3045
[UI] Display system partitions in node page #3045
Conversation
Hello chengyanjin,My role is to assist you with the merge of this Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
1679c59
to
3277a91
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
Good job for introducing react query and enhanced typing !
I've added a few comment about typing which can be a bit improved, also we have to check if we can merge #3002 before this PR in order to benefit from eea1b97 and useTypedSelector
.
I think we may have to review a bit the style implementation because it seems not to be adapted for other screen resolution, eg on my screen :
The tbody height goes beyond my screen height and trigger the visibility of the scrollbar despite that there is no scroll necessity. I think that we should not define the tbody height and instead let the array fills the necessary place according to the number of partitions. Doing so also simplify reuse of the table component as it won't impact the style of the page where it is included.
Branches have divergedThis pull request's source branch To avoid any integration risks, please re-synchronize them using one of the
Note: If you choose to rebase, you may have to ask me to rebuild |
354380f
to
30d99ff
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
30d99ff
to
0662278
Compare
ConflictThere is a conflict between your branch Please resolve the conflict on the feature branch ( $ git fetch
$ git checkout origin/improvement/2932-display-system-partitions-in-node-page
$ git merge origin/development/2.8
$ # <intense conflict resolution>
$ git commit
$ git push origin HEAD:improvement/2932-display-system-partitions-in-node-page |
bbd60c7
to
660558f
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
ccfe468
to
7252781
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change-log entry referring this change seems to be missing
ui/src/services/NodeVolumesUtils.js
Outdated
const len = alerts.length; | ||
// Record the index to be removed. | ||
const removeIndex = []; | ||
for (let i = 0, j = 1; i <= len - 2 && j <= len - 1; ) { | ||
if (j === len - 1) { | ||
i++; | ||
j = i + 1; | ||
} else if ( | ||
// Add more label conditions here when we need to address more alerts. | ||
(alerts[i].labels.device && | ||
alerts[i].labels.alertname === alerts[j].labels.alertname && | ||
alerts[i].labels.device === alerts[j].labels.device && | ||
alerts[i].labels.instance === alerts[j].labels.instance) || | ||
(alerts[i].labels.persistentvolumeclaim && | ||
((alerts[i].labels.persistentvolumeclaim === | ||
alerts[j].labels.persistentvolumeclaim) === | ||
alerts[i].labels.alertname) === | ||
alerts[j].labels.alertname) | ||
) { | ||
if (alerts[i].labels.severity === 'warning') { | ||
removeIndex.push(i); | ||
i++; | ||
j = i + 1; | ||
} else if (alerts[j].labels.severity === 'warning') { | ||
removeIndex.push(j); | ||
i++; | ||
j = i + 1; | ||
} | ||
} else { | ||
j = j + 1; | ||
} | ||
} | ||
|
||
let removedWarningAlerts = alerts; | ||
removeIndex.forEach((index) => removedWarningAlerts.splice(index, 1)); | ||
|
||
return removedWarningAlerts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to make it easier to take new alert rules into account I think it would be preferable to split the function similarly to this approach below :
function getAlertUniqueKey(alert: PrometheusAlert): string | null {
if(alert.labels.alertname.startsWith("NodeFilesystem")) {
return alert.labels.alertname + alert. labels.device + alert.labels.instance;
}
if(alert.labels.alertname.startsWith("PersistentVolume")) {
return alert.labels.alertname + alert.persistentVolumeClaim;
}
return null;
}
export const removeWarningAlerts = (
alerts: Array<PrometheusAlert>,
): Array<PrometheusAlert> => {
const unfilteredAlerts: PrometheusAlert[] = [];
const indexedAlerts: {[key: string]: PrometheusAlert} = {};
alerts.forEach(alert => {
const alertUniqueKey = getAlertUniqueKey(alert);
if (!alertUniqueKey){
unfilteredAlerts.push(alert);
} else if (alertUniqueKey && ((indexedAlerts[alertUniqueKey] && indexedAlerts[alertUniqueKey].labels.severity === 'warning') || !indexedAlerts[alertUniqueKey])) {
indexedAlerts[alertUniqueKey] = alert;
}
})
return [...unfilteredAlerts, ...Object.values(indexedAlerts)];
}
}, | ||
]; | ||
|
||
it('should remove the wanring alerts', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small typo here warning
|
||
it('should remove the wanring alerts', () => { | ||
const result = removeDiskWarningAlerts(alerts); | ||
expect(result.length).toEqual(3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to test if result array is the expecting one using
expect(result).toStrictEqual([
{
annotations: {
description:
'Filesystem on /dev/vdc2 at 192.168.1.6:9100 has only 0.00% available space left.',
runbook_url:
'https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-nodefilesystemalmostoutofspace',
summary: 'Filesystem has less than 3% space left.',
},
endsAt: '2021-01-21T09:32:35.358Z',
fingerprint: '5ef4c93e954ac2c9',
receivers: [
{
name: 'null',
},
],
startsAt: '2021-01-18T16:43:35.358Z',
status: {
inhibitedBy: [],
silencedBy: [],
state: 'active',
},
updatedAt: '2021-01-21T09:28:40.099Z',
generatorURL:
'http://prometheus-operator-prometheus.metalk8s-monitoring:9090/graph?g0.expr=%28node_filesystem_avail_bytes%7Bfstype%21%3D%22%22%2Cjob%3D%22node-exporter%22%7D+%2F+node_filesystem_size_bytes%7Bfstype%21%3D%22%22%2Cjob%3D%22node-exporter%22%7D+%2A+100+%3C+3+and+node_filesystem_readonly%7Bfstype%21%3D%22%22%2Cjob%3D%22node-exporter%22%7D+%3D%3D+0%29&g0.tab=1',
labels: {
alertname: 'NodeFilesystemAlmostOutOfSpace',
container: 'node-exporter',
device: '/dev/vdc2',
endpoint: 'metrics',
fstype: 'ext4',
instance: '192.168.1.6:9100',
job: 'node-exporter',
mountpoint: '/mnt/testpart2',
namespace: 'metalk8s-monitoring',
pod: 'prometheus-operator-prometheus-node-exporter-m9qcj',
prometheus: 'metalk8s-monitoring/prometheus-operator-prometheus',
service: 'prometheus-operator-prometheus-node-exporter',
severity: 'critical',
},
},
{
annotations: {
description:
'Filesystem on /dev/vdc2 at 192.168.1.6:9100 has only 0.00% available space left.',
runbook_url:
'https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-nodefilesystemalmostoutofspace',
summary: 'Filesystem has less than 5% space left.',
},
endsAt: '2021-01-21T09:32:35.358Z',
fingerprint: '6331188d982cdcfc',
receivers: [
{
name: 'null',
},
],
startsAt: '2021-01-18T16:43:35.358Z',
status: {
inhibitedBy: [],
silencedBy: [],
state: 'active',
},
updatedAt: '2021-01-21T09:28:40.092Z',
generatorURL:
'http://prometheus-operator-prometheus.metalk8s-monitoring:9090/graph?g0.expr=%28node_filesystem_avail_bytes%7Bfstype%21%3D%22%22%2Cjob%3D%22node-exporter%22%7D+%2F+node_filesystem_size_bytes%7Bfstype%21%3D%22%22%2Cjob%3D%22node-exporter%22%7D+%2A+100+%3C+5+and+node_filesystem_readonly%7Bfstype%21%3D%22%22%2Cjob%3D%22node-exporter%22%7D+%3D%3D+0%29&g0.tab=1',
labels: {
alertname: 'NodeFilesystemAlmostOutOfSpace',
container: 'node-exporter',
device: '/dev/vdc2',
endpoint: 'metrics',
fstype: 'ext4',
instance: '192.168.1.6:9100',
job: 'node-exporter',
mountpoint: '/mnt/testpart2',
namespace: 'metalk8s-monitoring',
pod: 'prometheus-operator-prometheus-node-exporter-m9qcj',
prometheus: 'metalk8s-monitoring/prometheus-operator-prometheus',
service: 'prometheus-operator-prometheus-node-exporter',
severity: 'warning',
},
},
{
annotations: {
description:
'Filesystem on /dev/vdc1 at 192.168.1.6:9100 has only 3.28% available space left.',
runbook_url:
'https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-nodefilesystemalmostoutofspace',
summary: 'Filesystem has less than 5% space left.',
},
endsAt: '2021-01-21T09:32:35.358Z',
fingerprint: '6c9be09b96993ce4',
receivers: [
{
name: 'null',
},
],
startsAt: '2021-01-18T16:43:35.358Z',
status: {
inhibitedBy: [],
silencedBy: [],
state: 'active',
},
updatedAt: '2021-01-21T09:28:40.092Z',
generatorURL:
'http://prometheus-operator-prometheus.metalk8s-monitoring:9090/graph?g0.expr=%28node_filesystem_avail_bytes%7Bfstype%21%3D%22%22%2Cjob%3D%22node-exporter%22%7D+%2F+node_filesystem_size_bytes%7Bfstype%21%3D%22%22%2Cjob%3D%22node-exporter%22%7D+%2A+100+%3C+5+and+node_filesystem_readonly%7Bfstype%21%3D%22%22%2Cjob%3D%22node-exporter%22%7D+%3D%3D+0%29&g0.tab=1',
labels: {
alertname: 'NodeFilesystemAlmostOutOfSpace',
container: 'node-exporter',
device: '/dev/vdc1',
endpoint: 'metrics',
fstype: 'xfs',
instance: '192.168.1.6:9100',
job: 'node-exporter',
mountpoint: '/mnt/testpart1',
namespace: 'metalk8s-monitoring',
pod: 'prometheus-operator-prometheus-node-exporter-m9qcj',
prometheus: 'metalk8s-monitoring/prometheus-operator-prometheus',
service: 'prometheus-operator-prometheus-node-exporter',
severity: 'warning',
},
},
])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additionally your test seems to lack coverage on persistentvolume
alerts and alerts of other kinds that should not be filtered
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list:
The following reviewers are expecting changes from the author, or must review again: |
ConflictThere is a conflict between your branch Please resolve the conflict on the feature branch ( $ git fetch
$ git checkout origin/improvement/2932-display-system-partitions-in-node-page
$ git merge origin/development/2.8
$ # <intense conflict resolution>
$ git commit
$ git push origin HEAD:improvement/2932-display-system-partitions-in-node-page |
a07aff7
to
8365d01
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list:
The following reviewers are expecting changes from the author, or must review again: |
8365d01
to
f222ca8
Compare
78031a1
to
6dd67ab
Compare
TODO: We should throw error immediately rather than catch the error and return This may change the behavior of the error handling of the APIs. Refs: #2932
To make sure the functions beforeAll, afterEach, afterAll function in the correct place. Refs: #2932
To make the data a little more accurate Refs: #2932
7bba179
to
72f96b6
Compare
72f96b6
to
fa698ca
Compare
2ed5b6f
to
5d779b8
Compare
When installing kubernetes client, the library is being built in the context of the consumer project meaning that it has access to the consumer node_modules. That bring the issue that typescript was trying to build metalk8s types dependency to build kubernetes client leading to a build failure. The issue has been resolved by this commit : scality/kubernetes-client-javascript@579d066 which lists explicitly the types dependency of kubernetes client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats, LGTM !
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
/approve |
In the queueThe changeset has received all authorizations and has been added to the The changeset will be merged in:
The following branches will NOT be impacted:
There is no action required on your side. You will be notified here once IMPORTANT Please do not attempt to modify this pull request.
If you need this pull request to be removed from the queue, please contact a The following options are set: approve |
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
Please check the status of the associated issue None. Goodbye chengyanjin. |
Component: ui, node
Context: We would like to add a tab in the Node page to display the information of system partitions.
Summary:
Update:
Will address hiding the warning alert in the next PR.
Acceptance criteria:
Closes: #2932
Closes: #2173