Skip to content

Commit

Permalink
[backport v2.8.x] remove v1 monitoring code (rancher#10539)
Browse files Browse the repository at this point in the history
* remove v1 monitoring code

* fix lint issue

* remove monitoring v1 uninstall code + remove v1 uninstall translation strings + simple checks for detail pages in e2e tests to verify integrition of work done

* address pr comments

* fix unit tests

---------

Co-authored-by: Alexandre Alves <aalves@Alexandres-MacBook-Pro.local>
  • Loading branch information
2 people authored and codyrancher committed Apr 20, 2024
1 parent c5feeca commit 1e53520
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 415 deletions.
8 changes: 8 additions & 0 deletions cypress/e2e/po/components/sortable-table.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ export default class SortableTablePo extends ComponentPo {
return this.self().contains('tbody tr', name);
}

rowElementLink(rowIndex: number, columnIndex: number) {
return this.getTableCell(rowIndex, columnIndex).find('a');
}

getTableCell(rowIndex: number, columnIndex: number) {
return this.row(rowIndex).column(columnIndex);
}

row(index: number) {
return new ListRowPo(this.rowElements().eq(index));
}
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/tests/pages/explorer/workloads/pods.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ describe('Cluster Explorer', () => {
createClonePo.nameNsDescription().name().set(clonePodName);
createClonePo.save().wait(10000);

// Simple test to assert we haven't broken Pods detail page
// https://github.com/rancher/dashboard/issues/10490
const clonedPodPage = new WorkLoadsPodDetailsPagePo(clonePodName);

clonedPodPage.goTo().wait(10000);
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/tests/pages/explorer/workloads/workloads.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ describe('Workloads', { tags: ['@explorer', '@adminUser'] }, () => {
// check if Pod is in the Workloads list
const workload = new WorkloadPagePo('local');

// Simple test to assert we haven't broken Workloads detail page
// https://github.com/rancher/dashboard/issues/10490
workload.goTo();
workload.goToDetailsPage(podName);

Expand Down
10 changes: 0 additions & 10 deletions shell/assets/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2352,7 +2352,6 @@ glance:
version: Kubernetes Version
monitoringDashboard: Monitoring Dashboard
installMonitoring: Install Monitoring
v1MonitoringInstalled: V1 Monitoring Installed
clusterInfo: Cluster Information
eventsTable: Full events list

Expand Down Expand Up @@ -3334,15 +3333,6 @@ monitoring:
bearerTokenSecret: Bearer Token Secret
basicAuthUsername: Secret with Basic Auth Username
basicAuthPassword: Secret with Basic Auth Password
installSteps:
uninstallV1:
stepTitle: Uninstall V1
stepSubtext: Uninstall Previous Monitoring
warning1: V1 Monitoring is currently deployed. This needs to be uninstalled before V2 monitoring can be installed.
warning2: <a target="blank" href="{docsBase}/monitoring-alerting/guides/migrating/" target='_blank' rel='noopener nofollow'>Learn more</a> about the migration steps to V2 Monitoring.
promptDescription: <div class="mt-20 mb-20">You are attempting to uninstall V1 Monitoring. Please ensure you have read the migration steps.</div>
success1: V1 monitoring successfully uninstalled.
success2: Press Next to continue
tabs:
alerting: Alerting
general: General
Expand Down
10 changes: 0 additions & 10 deletions shell/assets/translations/zh-hans.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2323,7 +2323,6 @@ glance:
version: Kubernetes 版本
monitoringDashboard: 监控仪表板
installMonitoring: 安装 Monitoring
v1MonitoringInstalled: 已安装 Monitoring V1
clusterInfo: 集群信息
eventsTable: 完整事件列表

Expand Down Expand Up @@ -3302,15 +3301,6 @@ monitoring:
bearerTokenSecret: 持有者令牌密文
basicAuthUsername: 具有基本认证用户名的密文
basicAuthPassword: 具有基本认证密码的密文
installSteps:
uninstallV1:
stepTitle: 卸载 V1
stepSubtext: 卸载旧版 Monitoring
warning1: 已部署 Monitoring V1。你需要先卸载 Monitoring V1 才能安装 Monitoring V2。
warning2: <a target="blank" href="{docsBase}/monitoring-alerting/guides/migrating/" target='_blank' rel='noopener nofollow'>了解迁移到 Monitoring V2 的步骤</a>。
promptDescription: <div class="mt-20 mb-20">你正在尝试卸载 Monitoring V1。请确保你已阅读迁移步骤。</div>
success1: Monitoring V1 已成功卸载。
success2: 点击下一步继续
tabs:
alerting: 告警
general: 通用
Expand Down
135 changes: 0 additions & 135 deletions shell/chart/monitoring/steps/uninstall-v1.vue

This file was deleted.

42 changes: 0 additions & 42 deletions shell/detail/node.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
VALUE
} from '@shell/config/table-headers';
import ResourceTabs from '@shell/components/form/ResourceTabs';
import EmberPage from '@shell/components/EmberPage';
import { METRIC, POD } from '@shell/config/types';
import createEditView from '@shell/mixins/create-edit-view';
import { formatSi, exponentNeeded, UNITS } from '@shell/utils/units';
Expand All @@ -20,7 +19,6 @@ import { mapGetters } from 'vuex';
import { allDashboardsExist } from '@shell/utils/grafana';
import Loading from '@shell/components/Loading';
import metricPoller from '@shell/mixins/metric-poller';
import { haveV1Monitoring } from '@shell/utils/monitoring';
const NODE_METRICS_DETAIL_URL = '/api/v1/namespaces/cattle-monitoring-system/services/http:rancher-monitoring-grafana:80/proxy/d/rancher-node-detail-1/rancher-node-detail?orgId=1';
const NODE_METRICS_SUMMARY_URL = '/api/v1/namespaces/cattle-monitoring-system/services/http:rancher-monitoring-grafana:80/proxy/d/rancher-node-1/rancher-node?orgId=1';
Expand All @@ -36,7 +34,6 @@ export default {
ResourceTabs,
Tab,
ResourceTable,
EmberPage,
},
mixins: [createEditView, metricPoller],
Expand All @@ -51,23 +48,13 @@ export default {
async fetch() {
this.showMetrics = await allDashboardsExist(this.$store, this.currentCluster.id, [NODE_METRICS_DETAIL_URL, NODE_METRICS_SUMMARY_URL]);
if (haveV1Monitoring(this.$store.getters)) {
const v3Nodes = await this.$store.dispatch('rancher/request', {
url: '/v3/nodes',
method: 'get'
});
this.v3Nodes = v3Nodes;
}
return this.$store.dispatch('cluster/findAll', { type: POD });
},
data() {
const podSchema = this.$store.getters['cluster/schemaFor'](POD);
return {
v3Nodes: null,
metrics: { cpu: 0, memory: 0 },
infoTableHeaders: [
{
Expand Down Expand Up @@ -99,22 +86,6 @@ export default {
computed: {
...mapGetters(['currentCluster']),
v1MonitoringUrl() {
if (this.v3Nodes && this.v3Nodes.data) {
const node = this.v3Nodes.data.find((n) => {
return n.nodeName === this.value.metadata?.name;
});
if (node) {
// Custom page just with node metrics graphs
const id = this.currentCluster.id;
return `/k/${ id }/monitoring/${ node.id }/metrics`;
}
}
return null;
},
memoryUnits() {
const exponent = exponentNeeded(this.value.ramReserved, 1024);
Expand Down Expand Up @@ -320,19 +291,6 @@ export default {
:search="false"
/>
</Tab>
<Tab
v-if="v1MonitoringUrl"
name="v1Metrics"
:label="t('node.detail.tab.metrics')"
:weight="0"
>
<div id="ember-anchor">
<EmberPage
inline="ember-anchor"
:src="v1MonitoringUrl"
/>
</div>
</Tab>
</ResourceTabs>
</div>
</template>
Expand Down
Loading

0 comments on commit 1e53520

Please sign in to comment.