Skip to content

Conversation

@irosenzw
Copy link
Contributor

  • Add an Environment tab for virtual machines
  • The user can now add configmaps, secrets and service accounts
    to VMs as disks but has to mount them manually.
    (not all images support CloudInit)

Signed-off-by: Ido Rosenzwig irosenzw@redhat.com

@openshift-ci-robot openshift-ci-robot added component/core Related to console core functionality component/kubevirt Related to kubevirt-plugin labels Mar 23, 2020
@irosenzw irosenzw force-pushed the add-configmap-secret-to-vm branch 2 times, most recently from 297a156 to fbd87f6 Compare March 23, 2020 12:20
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not getRandomChars(16) ? what am I missing ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the limit is 10.
if you give it 16 you will get 10 eventually.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubevirt-create-nic-modal__buttons ?

@irosenzw irosenzw force-pushed the add-configmap-secret-to-vm branch 2 times, most recently from 44c356a to 39033e8 Compare March 23, 2020 14:39
@irosenzw irosenzw force-pushed the add-configmap-secret-to-vm branch 2 times, most recently from 99fa6cb to c660810 Compare March 24, 2020 17:20
@openshift-ci-robot openshift-ci-robot added component/dev-console Related to dev-console component/shared Related to console-shared labels Mar 24, 2020
@irosenzw irosenzw force-pushed the add-configmap-secret-to-vm branch 6 times, most recently from 830449b to 2f3f105 Compare March 29, 2020 13:57
@irosenzw
Copy link
Contributor Author

/retest

@irosenzw irosenzw force-pushed the add-configmap-secret-to-vm branch 3 times, most recently from 815fc8f to 5bb0ed6 Compare March 30, 2020 07:03
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can further simplify and merge types ConfigMapListKind, SecretListKind and ServiceAccountListKind using generics

export type ListKind<R extends K8sResourceCommon> = K8sResourceCommon & {
  items: R[];
}

and the usage for example here https://github.com/openshift/console/blob/5bb0ed6137a5d661ab98118cee25e1da444cb8f1/frontend/packages/kubevirt-plugin/src/components/vms/vm-environment/selectors.ts#L63 would be

): ListKind<ConfigMapKind | SecretKind | ServiceAccountKind> => {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shoud define new type - something like

type EnvDisk = [string, EnvVarSource, number];
Suggested change
export const getSerial = (ed): string => ed[0];
export const getSerial = (ed: EnvDisk): string => ed[0];

and use it everywhere. Makes the code a lot more readable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const getSource = (ed): EnvVarSource => ed[1];
export const getSource = (ed: EnvDisk): EnvVarSource => ed[1];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const getSourceKind = (envDisk: (string | object | number)[]): string => {
export const getSourceKind = (envDisk: EnvDisk): string => {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
envDisk1: (string | object | number)[],
envDisk1: EnvDisk,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const updateEnvDisks = (newEnvDisks) => {
const updateEnvDisks = (newEnvDisks: NameValuePairs) => {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const setNewSourceDisk = (diskName: string, serial: string, diskBus: string) => {
export const setNewSourceDisk = (diskName: string, serial: string, diskBus: string): V1Disk => {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to specify V1Volume as setNewSourceVolume has correct signature

Suggested change
const newVolume: V1Volume = setNewSourceVolume(
const newVolume = setNewSourceVolume(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let newSourcesDisks = [];
let newSourcesDisks: V1Disk[] = [];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let newSourcesVolumes = [];
let newSourcesVolumes: V1Volume[] = [];

- Add an Environment tab for virtual machines
- The user can now add configmaps, secrets and service accounts
  to VMs as disks but has to mount them manually.
  (not all images support CloudInit)

Signed-off-by: Ido Rosenzwig <irosenzw@redhat.com>
@irosenzw irosenzw force-pushed the add-configmap-secret-to-vm branch from 5bb0ed6 to 734f8fc Compare March 31, 2020 09:04
@rawagner
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 31, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: irosenzw, rawagner

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 31, 2020
@openshift-merge-robot openshift-merge-robot merged commit e2cee7d into openshift:master Mar 31, 2020
@spadgett spadgett added this to the v4.5 milestone Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/dev-console Related to dev-console component/kubevirt Related to kubevirt-plugin component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants