Commit 299f40c
authored
feat: Add privileged_client support to VirtualMachineInstance (#2648)
* feat: Add privileged_client support to VirtualMachineInstance
Introduce explicit privileged_client parameter across VirtualMachineInstance
methods to support proper RBAC-aware client usage.
New public methods replacing deprecated properties:
- get_virt_launcher_pod, get_virt_handler_pod, get_node, get_xml_dict
Modified methods with privileged_client parameter:
- pause, unpause, reset, get_xml, execute_virsh_command
- get_dommemstat, get_domstate, wait_until_running, api_request
New private helpers:
- _get_pod_user_uid, _is_pod_root
- _get_hypervisor_connection_uri, _build_virsh_cmd
- _resolve_privileged_client, _get_subresource_api_url
Warning strategy:
- FutureWarning when privileged_client is omitted
- DeprecationWarning on old property-based access
* fix: Address CodeRabbit review comments for privileged_client support
- Pass original privileged_client (not resolved _client) to api_request in pause/unpause/reset
- Handle unset runAsUser in _get_pod_user_uid (return int | None) and _is_pod_root (explicit uid == 0 check)
- Use self.logger.exception() for error-path diagnostics in wait_until_running
* refactor: Simplify privileged_client implementation
- Remove _resolve_privileged_client helper and FutureWarning mechanism
- Use simple 'privileged_client or self.client' fallback pattern
- Deprecated properties emit DeprecationWarning only
- Fix _is_pod_root to treat unset runAsUser as root (Kubernetes default)
* udpate clients
* remvoe used once
* update virsh_cmd
* restore ocp_resources/resource.py - not chnage needed1 parent 5bf39e1 commit 299f40c
1 file changed
Lines changed: 217 additions & 65 deletions
0 commit comments