9.7. Customize the web console


As a cluster administrator, you can customize the OpenShift Container Platform web console by integrating dynamic plugins. Virtual machine (VM) owners can then use the actions provided by these plugins from different tabs on the Virtualization page.

9.7.1. Enable bulk operations for virtual machines

You can enable virtual machine (VM) owners to perform large-scale management tasks, such as backups and storage migrations, across many virtual machines simultaneously, by creating a dynamic plugin that enables bulk actions in the web console.

This integration reduces manual tasks for multi-VM environments and ensures that custom actions are available as native, selectable bulk actions from within the Virtualization page.

Prerequisites

  • You have created a dynamic plugin.
  • You have cluster administrator permissions.
  • You have access to an OpenShift Container Platform cluster where OpenShift Virtualization is installed.

Procedure

  1. In the configuration file of your plugin, add a console.action/provider extension.

    To enable bulk actions, you must use a contextId field that targets an array of VirtualMachine resources.

    Example console-extensions.json file excerpt:

    {
       type: 'console.action/provider',
       properties: {
         contextId: 'kubevirt.io~v1~VirtualMachine[]',
         provider: {
           $codeRef: 'useSimpleBulkActions',
         },
       },
     }
    • properties.contextId specifies a string for which the KubeVirt plugin declares support.
    • properties.provider specifies the React hook or function in your source code that generates the action items.
  2. In the source file referenced by the extension, implement a hook that handles the array of selected resources.

    Example plugin:

    import {
      type ExtensionHook,
      AccessReviewResourceAttributes,
      Action,
    } from '@openshift-console/dynamic-plugin-sdk';
    import { V1VirtualMachine } from '@kubevirt-ui-ext/kubevirt-api/kubevirt';
    import { VirtualMachineModel } from '@kubevirt-ui-ext/kubevirt-api/console';
    import { useMemo } from 'react';
    
    const useSimpleBulkActions: ExtensionHook<Action[], (V1VirtualMachine & { cluster?: string })[]> = (
      vms,
    ) => {
      const areAllRunning = vms.every((vm) => vm.status?.printableStatus === 'Running');
      const isCrossCluster = new Set(vms.map((vm) => vm.cluster)).size > 1;
      const firstVm = vms[0];
    
      const accessReview: AccessReviewResourceAttributes = useMemo(
        () => ({
          cluster: firstVm?.cluster,
          group: VirtualMachineModel.apiGroup,
          name: firstVm?.metadata?.name,
          namespace: firstVm?.metadata?.namespace,
          resource: VirtualMachineModel.plural,
          verb: 'delete',
        }),
        [firstVm?.cluster, firstVm?.metadata?.name, firstVm?.metadata?.namespace],
      );
    
      const checkAllRunningAction: Action = useMemo(
        () => ({
          id: 'check-all-running',
          cta: () => console.log('All selected VMs are running?', areAllRunning),
          label: 'Check VMs are running',
          disabled: isCrossCluster,
          disabledTooltip: isCrossCluster ? 'VMs from different clusters detected' : '',
          accessReview,
        }),
        [areAllRunning, isCrossCluster, accessReview],
      );
    
      const actions = useMemo(() => [checkAllRunningAction], [checkAllRunningAction]);
      return [actions, true, null];
    };
    
    export default useSimpleBulkActions;

    The plugin shown in the previous example checks if all selected VMs are running and prints a log message to the console.

  3. Deploy the plugin to the cluster.

Verification

  1. Log in to the OpenShift Container Platform web console.
  2. Verify that you can apply bulk actions to VMs.

    1. Go to Virtualization VirtualMachines.
    2. Select the checkboxes for two or more existing VMs.
    3. Click the Actions drop-down menu. Confirm that you can run the custom action you created.
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동