Skip to content
Permalink
Browse files

Merge pull request #1221 from spadgett/no-volumes

Fix runtime error when pod has no volumes
  • Loading branch information
openshift-merge-robot committed Feb 25, 2019
2 parents f5ece42 + 4119b14 commit a0b75bcc5799c700b44e753b222dab73e56a36b2
Showing with 35 additions and 13 deletions.
  1. +34 −12 frontend/public/components/pod.jsx
  2. +1 −1 frontend/public/module/k8s/pods.ts
@@ -6,7 +6,25 @@ import { getVolumeType, getVolumeLocation, getVolumeMountPermissions, getVolumeM
import { getContainerState, getContainerStatus } from '../module/k8s/docker';
import { ResourceEventStream } from './events';
import { ColHead, DetailsPage, List, ListHeader, ListPage, ResourceRow } from './factory';
import { SectionHeading, Kebab, LabelList, navFactory, NodeLink, ResourceKebab, ResourceIcon, ResourceLink, ResourceSummary, ScrollToTopOnMount, Selector, Timestamp, VolumeIcon, units, AsyncComponent, StatusIcon } from './utils';
import {
AsyncComponent,
EmptyBox,
Kebab,
LabelList,
NodeLink,
ResourceIcon,
ResourceKebab,
ResourceLink,
ResourceSummary,
ScrollToTopOnMount,
SectionHeading,
Selector,
StatusIcon,
Timestamp,
VolumeIcon,
navFactory,
units,
} from './utils';
import { PodLogs } from './pod-logs';
import { Line, requirePrometheus } from './graphs';
import { breadcrumbsForOwnerRefs } from './utils/breadcrumbs';
@@ -180,17 +198,21 @@ export const PodResourceSummary = ({pod}) => (
export const PodVolumeTable = ({heading, pod}) => (
<React.Fragment>
{heading && <SectionHeading text={heading} />}
<div className="co-m-table-grid co-m-table-grid--bordered">
<div className="row co-m-table-grid__head">
<div className="col-sm-3 col-xs-4">Name</div>
<div className="col-sm-3 col-xs-4">Type</div>
<div className="col-sm-3 hidden-xs">Permissions</div>
<div className="col-sm-3 col-xs-4">Utilized By</div>
</div>
<div className="co-m-table-grid__body">
{getVolumeMountsByPermissions(pod).map((v, i) => <Volume key={i} pod={pod} volume={v} />)}
</div>
</div>
{_.isEmpty(pod.spec.volumes)
? <EmptyBox label="Volumes" />
: (
<div className="co-m-table-grid co-m-table-grid--bordered">
<div className="row co-m-table-grid__head">
<div className="col-sm-3 col-xs-4">Name</div>
<div className="col-sm-3 col-xs-4">Type</div>
<div className="col-sm-3 hidden-xs">Permissions</div>
<div className="col-sm-3 col-xs-4">Utilized By</div>
</div>
<div className="co-m-table-grid__body">
{getVolumeMountsByPermissions(pod).map((v, i) => <Volume key={i} pod={pod} volume={v} />)}
</div>
</div>
)}
</React.Fragment>
);

@@ -151,7 +151,7 @@ export const getVolumeMountsByPermissions = pod => {
return [];
}

const volumes = pod.spec.volumes.reduce((p, v) => {
const volumes = (pod.spec.volumes || []).reduce((p, v) => {
p[v.name] = v;
return p;
}, {});

0 comments on commit a0b75bc

Please sign in to comment.
You can’t perform that action at this time.