diff --git a/client/src/components/hpaPanel.js b/client/src/components/hpaPanel.js new file mode 100644 index 0000000..4cdb63f --- /dev/null +++ b/client/src/components/hpaPanel.js @@ -0,0 +1,19 @@ +import React from 'react'; +import Field from './field'; + +const HpaPanel = ({spec}) => ( + <> + {spec && +
+
Container
+
+ {spec.minReplicas} + {spec.maxReplicas} + {spec.targetCPUUtilizationPercentage} +
+
+ } + +); + +export default HpaPanel; diff --git a/client/src/services/api.js b/client/src/services/api.js index b2c0f6e..7c4f47b 100644 --- a/client/src/services/api.js +++ b/client/src/services/api.js @@ -23,6 +23,7 @@ const daemonSet = apiFactoryWithNamespace('apps', 'v1', 'daemonsets'); const deployment = apiFactoryWithNamespace('apps', 'v1', 'deployments', true); const replicaSet = apiFactoryWithNamespace('apps', 'v1', 'replicasets', true); const statefulSet = apiFactoryWithNamespace('apps', 'v1', 'statefulsets', true); +const hpa = apiFactoryWithNamespace('autoscaling', 'v1', 'horizontalpodautoscalers', true); const cronJob = apiFactoryWithNamespace('batch', 'v1beta1', 'cronjobs'); const job = apiFactoryWithNamespace('batch', 'v1', 'jobs'); @@ -63,6 +64,7 @@ const apis = { serviceAccount, statefulSet, roleBinding, + hpa, }; async function testAuth() { diff --git a/client/src/views/deployment.js b/client/src/views/deployment.js index 537a28d..28c1e64 100644 --- a/client/src/views/deployment.js +++ b/client/src/views/deployment.js @@ -18,6 +18,7 @@ import getMetrics from '../utils/metricsHelpers'; import {defaultSortInfo} from '../components/sorter'; import ReplicasChart from '../components/replicasChart'; import ChartsContainer from '../components/chartsContainer'; +import HpaPanel from '../components/hpaPanel'; const service = api.deployment; @@ -37,6 +38,7 @@ export default class Deployment extends Base { events: api.event.list(namespace, x => this.setState({events: x})), pods: api.pod.list(namespace, x => this.setState({pods: x})), metrics: api.metrics.pods(namespace, x => this.setState({metrics: x})), + hpa: api.hpa.get(namespace, name, x => this.setState({hpa: x})) }); } @@ -48,6 +50,7 @@ export default class Deployment extends Base { replicaSets, pods, metrics, + hpa, replicaSetsSort, podsSort, eventsSort, @@ -95,6 +98,8 @@ export default class Deployment extends Base { + +
Replica Sets
this.setState({pods})), events: api.event.list(namespace, events => this.setState({events})), metrics: api.metrics.pods(namespace, metrics => this.setState({metrics})), + hpa: api.hpa.get(namespace, name, x => this.setState({hpa: x})), }); } render() { const {namespace, name} = this.props; - const {item, pods, metrics, events, podsSort, eventsSort} = this.state; + const {item, pods, metrics, events, podsSort, eventsSort, hpa} = this.state; const filteredPods = filterByOwner(pods, item); const filteredEvents = filterByOwner(events, item); @@ -94,6 +96,8 @@ export default class ReplicaSet extends Base { + +
Pods