Merge branch 'master' into dev

This commit is contained in:
Eric Herbrandson
2020-08-05 21:49:10 -05:00
4 changed files with 31 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
import React from 'react';
import Field from './field';
const HpaPanel = ({spec}) => (
<>
{spec &&
<div>
<div className='contentPanel_header'>Container</div>
<div key="hpa" className='contentPanel'>
<Field name='Min Replicas'>{spec.minReplicas}</Field>
<Field name='Max Replicas'>{spec.maxReplicas}</Field>
<Field name='CPU Utilization %'>{spec.targetCPUUtilizationPercentage}</Field>
</div>
</div>
}
</>
);
export default HpaPanel;

View File

@@ -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() {

View File

@@ -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 {
<ContainersPanel spec={item && item.spec.template.spec} />
<HpaPanel spec={hpa && hpa.spec}/>
<div className='contentPanel_header'>Replica Sets</div>
<ReplicaSetsPanel
items={filteredReplicaSets}

View File

@@ -19,6 +19,7 @@ import {defaultSortInfo} from '../components/sorter';
import getMetrics from '../utils/metricsHelpers';
import {filterByOwner} from '../utils/filterHelper';
import ChartsContainer from '../components/chartsContainer';
import HpaPanel from '../components/hpaPanel';
const service = api.replicaSet;
@@ -36,12 +37,13 @@ export default class ReplicaSet extends Base {
pods: api.pod.list(namespace, pods => 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 {
<ContainersPanel spec={item && item.spec.template.spec} />
<HpaPanel spec={hpa && hpa.spec}/>
<div className='contentPanel_header'>Pods</div>
<PodsPanel
items={filteredPods}