Customize components

Customize KubeVirt Components

Customize components using patches

⚠ If the patch created is invalid KubeVirt will not be able to update or deploy the system. This is intended for special use cases and should not be used unless you know what you are doing.

Valid resource types are: Deployment, DaemonSet, Service, ValidatingWebhookConfiguraton, MutatingWebhookConfiguration, APIService, and CertificateSecret. More information can be found in the API spec.

Example customization patch:

  1. ---
  2. apiVersion: kubevirt.io/v1
  3. kind: KubeVirt
  4. metadata:
  5. name: kubevirt
  6. namespace: kubevirt
  7. spec:
  8. certificateRotateStrategy: {}
  9. configuration: {}
  10. customizeComponents:
  11. patches:
  12. - resourceType: Deployment
  13. resourceName: virt-controller
  14. patch: '[{"op": "remove", "path": "/spec/template/spec/containers/0/livenessProbe"}]'
  15. type: json
  16. - resourceType: Deployment
  17. resourceName: virt-controller
  18. patch: '{"metadata":{"annotations":{"patch": "true"}}}'
  19. type: strategic

The above example will update the virt-controller deployment to have an annotation in it’s metadata that says patch: true and will remove the livenessProbe from the container definition.

Customize Flags

⚠ If the flags are invalid or become invalid on update the component will not be able to run

By using the customize flag option, whichever component the flags are to be applied to, all default flags will be removed and only the flags specified will be used. The available resources to change the flags on are api, controller and handler. You can find our more details about the API in the API spec.

  1. apiVersion: kubevirt.io/v1
  2. kind: KubeVirt
  3. metadata:
  4. name: kubevirt
  5. namespace: kubevirt
  6. spec:
  7. certificateRotateStrategy: {}
  8. configuration: {}
  9. customizeComponents:
  10. flags:
  11. api:
  12. v: "5"
  13. port: "8443"
  14. console-server-port: "8186"
  15. subresources-only: "true"

The above example would produce a virt-api pod with the following command

  1. ...
  2. spec:
  3. ....
  4. container:
  5. - name: virt-api
  6. command:
  7. - virt-api
  8. - --v
  9. - "5"
  10. - --console-server-port
  11. - "8186"
  12. - --port
  13. - "8443"
  14. - --subresources-only
  15. - "true"
  16. ...