Skip to content
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

kubevirt addon: use KubeVirt CR instead of deprecated ConfigMap #12921

Merged
merged 2 commits into from
Nov 12, 2021

Conversation

zcahana
Copy link
Contributor

@zcahana zcahana commented Nov 10, 2021

Modify the kubevirt addon (#8275) to configure KubeVirt via its operator's custom resource (KubeVirt), instead of via the deprecated (and soon sometime to be removed) kubevirt-config ConfigMap.

Also slight changes to the saved manifest file names (avoid confusing renames).

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 10, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @zcahana. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 10, 2021
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@zcahana
Copy link
Contributor Author

zcahana commented Nov 10, 2021

/cc @medyagh since you reviewed #8275, maybe you can take a look at this too? thanks! 😄

@medyagh
Copy link
Member

medyagh commented Nov 10, 2021

@zcahana do u mind sharing Before and After this PR with an example and output ?

@zcahana
Copy link
Contributor Author

zcahana commented Nov 10, 2021

Well, the usage and the output of the addon enablement command hasn't changed:

zvic@ZVICAHANA-D2LK:~/Workspace/minikube (kubevirt_configmap)$ ./out/minikube addons enable kubevirt
    ▪ Using image bitnami/kubectl:1.17
🌟  The 'kubevirt' addon is enabled

Semantically, both before and after, we have a functional kubevirt installation.

Internally, there are some differences (which also affect users who wish to tinker with KubeVirt configuration):

  • Before, there's been both a KubeVirt CR as well as a kubevirt-config ConfigMap, whereas the ConfigMap takes precedence over anything specified in the KubeVirt.spec.configuration field.
  • After, there's no kubevirt-config ConfigMap created at all, and the KubeVirt.spec.configuration.developerConfiguration.useEmulation field is set to true. All other configuration should go into KubeVirt.spec.configuration as well.

curl -sL "https://github.com/kubevirt/kubevirt/releases/download/${KUBEVIRT_VERSION}/kubevirt-cr.yaml" -o /manifests/kubevirt.yaml

kubectl create -f /manifests/kubevirt.yaml
kubectl patch kubevirt kubevirt -n kubevirt --type merge --patch '{"spec": {"configuration": {"developerConfiguration": {"useEmulation": true}}}}'
Copy link

@rmohr rmohr Nov 11, 2021

Choose a reason for hiding this comment

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

This definitely works, but in general our kubevirt-cr.yaml does not set any non-default option and for declarative kubevirt installs with kubevirt you can just apply such a cr:

apiVersion: kubevirt.io/v1
kind: KubeVirt
metadata:
  name: kubevirt
  namespace: kubevirt
spec: {}

Or in your case:

apiVersion: kubevirt.io/v1
kind: KubeVirt
metadata:
  name: kubevirt
  namespace: kubevirt
spec:
  developerConfiguration:
    useEmulation: true

So in stead of

curl -sL "https://github.com/kubevirt/kubevirt/releases/download/${KUBEVIRT_VERSION}/kubevirt-cr.yaml" -o /manifests/kubevirt-cr.yaml

just directly write the above content and you don't need to deal with patches or anything (and that is a feature and not a works-by-accident flow :) ).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated accordingly.

Note that I too prefer the cat << EOF | kubectl apply -f - syntax, but this doesn't work in this context since the above pod.yaml.tmpl template is rendered using the html/template pkg, which doesn't like the <<.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 11, 2021
Copy link

@rmohr rmohr left a comment

Choose a reason for hiding this comment

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

Looks great, at least for me.

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

Thank you

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: medyagh, rmohr, zcahana

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 12, 2021
@medyagh medyagh merged commit 6d2cebd into kubernetes:master Nov 12, 2021
@zcahana zcahana deleted the kubevirt_configmap branch November 13, 2021 17:46
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants