-
Notifications
You must be signed in to change notification settings - Fork 670
Show 'Type' for PVCs in the Mounted Volumes list #1344
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import * as _ from 'lodash-es'; | ||
| import * as React from 'react'; | ||
| import { VolumeSource } from '../../module/k8s/pods'; | ||
| import { ResourceLink } from './resource-link'; | ||
|
|
||
| export const VolumeType = ({kind, name, namespace}) => { | ||
| const faClasses = _.fromPairs([ | ||
| [VolumeSource.emptyDir.id, 'fa-folder-open-o'], | ||
| [VolumeSource.hostPath.id, 'fa-files-o'], | ||
| ]); | ||
| const faClass = faClasses[kind]; | ||
| const k8sKind = _.get(VolumeSource[kind], 'link'); | ||
|
|
||
| if (faClass) { | ||
| return <span className="co-icon-and-text co-m-volume-icon"> | ||
| {faClass && <i className={`fa ${faClass} co-icon-and-text__icon`} aria-hidden="true" />} | ||
| {_.get(VolumeSource[kind], 'label')} | ||
| </span>; | ||
| } | ||
|
|
||
| if (name) { | ||
| return <ResourceLink kind={k8sKind} name={name} namespace={namespace} />; | ||
| } | ||
|
|
||
| return null; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ export const VolumeSource = { | |
| }, | ||
| secret: { | ||
| id: 'secret', | ||
| link: 'Secret', | ||
|
||
| label: 'Secret', | ||
| description: 'Secret to populate volume.', | ||
| }, | ||
|
|
@@ -76,6 +77,7 @@ export const VolumeSource = { | |
| }, | ||
| configMap: { | ||
| id: 'configMap', | ||
| link: 'ConfigMap', | ||
| label: 'ConfigMap', | ||
| description: 'ConfigMap to be consumed in volume.', | ||
| }, | ||
|
|
@@ -84,6 +86,12 @@ export const VolumeSource = { | |
| label: 'Projected', | ||
| description: 'A projected volume maps several existing volume sources into the same directory.', | ||
| }, | ||
| persistentVolumeClaim: { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's unclear to me why this change is needed. I'm not sure it's right since there are other more specific values for different kinds of PVCs above. |
||
| id: 'persistentVolumeClaim', | ||
| link: 'PersistentVolumeClaim', | ||
| label: 'Persistent Volume Claim', | ||
| description: 'A Persistent Volume Claim is a request for a Persistent Volume', | ||
| }, | ||
| }; | ||
|
|
||
| export const getVolumeType = (volume: Volume) => { | ||
|
|
@@ -101,12 +109,18 @@ const genericFormatter = volInfo => { | |
| if (key === 'readOnly') { | ||
| return ''; | ||
| } | ||
| if (key === 'defaultMode') { | ||
| return ''; | ||
| } | ||
| if (key === 'optional') { | ||
| return ''; | ||
| } | ||
| return volInfo[key]; | ||
| }); | ||
| if (keys.indexOf('readOnly') !== -1) { | ||
| parts.push(volInfo.readOnly ? 'ro' : 'rw'); | ||
| } | ||
| return parts.join(' ') || null; | ||
| return parts.join(' ').trim() || null; | ||
AyushAmbastha marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }; | ||
|
|
||
| export const getVolumeLocation = (volume: Volume) => { | ||
|
|
@@ -121,9 +135,7 @@ export const getVolumeLocation = (volume: Volume) => { | |
| // Override any special formatting cases. | ||
| case VolumeSource.gitRepo.id: | ||
| return `${info.repository}:${info.revision}`; | ||
| case VolumeSource.configMap.id: | ||
| case VolumeSource.emptyDir.id: | ||
| case VolumeSource.secret.id: | ||
| case VolumeSource.projected.id: | ||
| return null; | ||
| // Defaults to space separated sorted keys. | ||
|
|
||
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 want to make sure you're getting the namespace from the original resource, not the pod template. I don't think it's always set here.