8000 [kubevirt] Enable VMExport feature by kvaps · Pull Request #808 · cozystack/cozystack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[kubevirt] Enable VMExport feature #808

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

Merged
merged 1 commit into from
Apr 22, 2025
Merged

[kubevirt] Enable VMExport feature #808

merged 1 commit into from
Apr 22, 2025

Conversation

kvaps
Copy link
Member
@kvaps kvaps commented Apr 14, 2025

Summary by CodeRabbit

  • New Features
    • Introduced a new configuration option to control the virtual export proxy service (default disabled).
    • Deployed a dedicated ingress configuration to support flexible routing for the virtual export proxy.
    • Enabled a feature toggle for VM export capabilities in KubeVirt deployments.
  • Documentation
    • Updated user documentation to include details about the new virtual export proxy parameter.
  • Chores
    • Upgraded the associated ingress component from version 1.4.0 to 1.5.0.

@kvaps kvaps requested a review from lllamnyp as a code owner April 14, 2025 09:31
Copy link
Contributor
coderabbitai bot commented Apr 14, 2025

Warning

Rate limit exceeded

@kvaps has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 26 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5259b59 and 0ddaff9.

📒 Files selected for processing (7)
  • packages/extra/ingress/Chart.yaml (1 hunks)
  • packages/extra/ingress/README.md (1 hunks)
  • packages/extra/ingress/values.schema.json (1 hunks)
  • packages/extra/ingress/values.yaml (1 hunks)
  • packages/extra/ingress/vm-exportproxy.yaml (1 hunks)
  • packages/extra/versions_map (1 hunks)
  • packages/system/kubevirt/templates/kubevirt-cr.yaml (1 hunks)

"""

Walkthrough

The changes update the NGINX Ingress Controller version from 1.4.0 to 1.5.0. A new parameter, virtExportProxy, is introduced across multiple configuration files to control whether the ingress should serve the KubeVirt export proxy. Additionally, a new YAML file defining an Ingress resource for the virtual export proxy is added. The versions map now includes a fixed commit for version 1.4.0 and a new entry for 1.5.0, and a new feature gate, VMExport, is appended to the KubeVirt configuration.

Changes

File(s) Change Summary
packages/extra/ingress/Chart.yaml Updated version from 1.4.0 to 1.5.0.
packages/extra/ingress/README.md,
packages/extra/ingress/values.schema.json,
packages/extra/ingress/values.yaml
Added new parameter virtExportProxy (default: false) for controlling the KubeVirt export proxy; README formatting adjustments applied.
packages/extra/ingress/vm-exportproxy.yaml Added new Ingress resource definition for the virtual export proxy with dynamic configuration based on deployment context, including conditional annotations and TLS settings.
packages/extra/versions_map Updated ingress 1.4.0 entry to a specific commit hash (fd240701) and added a new entry for ingress 1.5.0 set to HEAD.
packages/system/kubevirt/templates/kubevirt-cr.yaml Added new feature gate VMExport to the developerConfiguration.featureGates list.
hack/gen_versions_map.sh Removed error redirection from git show commands to allow error output on standard error; no logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant Helm
    participant Kubernetes
    participant IngressController
    participant virtExportProxyService

    Helm->>Kubernetes: Process values.yaml with virtExportProxy parameter
    Kubernetes->>Kubernetes: Render and apply vm-exportproxy.yaml
    Kubernetes->>IngressController: Create Ingress resource for virt export proxy
    IngressController->>virtExportProxyService: Route traffic based on Ingress rules
Loading
sequenceDiagram
    participant User
    participant KubeVirtAPI
    participant VMExportModule

    User->>KubeVirtAPI: Send VM export request
    KubeVirtAPI->>VMExportModule: Check VMExport feature (feature gate enabled)
    VMExportModule-->>User: Process and return export output
Loading

Possibly related PRs

Suggested reviewers

  • lllamnyp

Poem

I'm a bunny hopping through lines of code,
With new flags and ingress neatly bestowed.
VirtExport springs to life in YAML so fine,
And VMExport joins the configuration line!
Leaping through changes with a joyful glow—
Happy code days from your rabbit, on the go!
"""


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kvaps kvaps force-pushed the release-tag-matching branch from 22be951 to 1cc4185 Compare April 14, 2025 09:31
@kvaps kvaps marked this pull request as draft April 14, 2025 09:32
@kvaps kvaps changed the title release tag matching [kubevirt] Enable VMExport feature Apr 14, 2025
@kvaps kvaps marked this pull request as ready for review April 14, 2025 15:05
Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/extra/ingress/README.md (1)

7-15: Addition of the virtExportProxy Parameter
The new table row introducing the virtExportProxy parameter (defaulting to false) is clearly documented and correctly formatted. Ensure that downstream configuration and documentation are updated accordingly so that users understand this option’s purpose and default behavior.

packages/extra/ingress/vm-exportproxy.yaml (1)

1-7: Helm Templating and Conditional Block Initialization
Lines 1–7 correctly initialize variables using Helm’s templating (e.g., fetching the ConfigMap and Namespace details) and use the conditional block to ensure that this Ingress resource is generated only when .Values.virtExportProxy is enabled.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d8f3f2d and 1cc4185.

📒 Files selected for processing (7)
  • packages/extra/ingress/Chart.yaml (1 hunks)
  • packages/extra/ingress/README.md (1 hunks)
  • packages/extra/ingress/values.schema.json (1 hunks)
  • packages/extra/ingress/values.yaml (1 hunks)
  • packages/extra/ingress/vm-exportproxy.yaml (1 hunks)
  • packages/extra/versions_map (1 hunks)
  • packages/system/kubevirt/templates/kubevirt-cr.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
packages/extra/ingress/vm-exportproxy.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build and Test
🔇 Additional comments (7)
packages/extra/ingress/Chart.yaml (1)

6-6: Version bump to 1.5.0 aligns with versions_map update

The version update from 1.4.0 to 1.5.0 is consistent with the changes made in the versions_map file and reflects the addition of the new VM export proxy functionality.

packages/system/kubevirt/templates/kubevirt-cr.yaml (1)

20-20: VMExport feature gate enables the VM export functionality

The addition of the VMExport feature gate is crucial for enabling the VM export functionality that will be utilized by the new ingress configuration. This change aligns perfectly with the PR title.

packages/extra/ingress/values.yaml (1)

34-35: New virtExportProxy parameter for KubeVirt export proxy

The new parameter is properly documented with a comment following the same pattern as the existing cdiUploadProxy parameter. Setting the default to false maintains backward compatibility for existing deployments.

packages/extra/ingress/values.schema.json (1)

38-42: Schema updated with virtExportProxy property

The schema has been correctly updated to include the new virtExportProxy property with appropriate type, description, and default value, ensuring schema validation for the new parameter.

packages/extra/versions_map (1)

19-20: Version map updated for ingress 1.4.0 and 1.5.0

The version map has been properly updated to pin ingress 1.4.0 to a specific commit and add the new 1.5.0 version pointing to HEAD. This is a good practice for version management.

According to the AI summary, there should also be a new file vm-exportproxy.yaml that defines an Ingress resource for the virtual export proxy. I don't see this file in the review set, but it would be important to ensure it's included with proper conditional creation based on the virtExportProxy parameter.

packages/extra/ingress/vm-exportproxy.yaml (2)

8-17: Ingress Metadata and Conditional Annotations
The Ingress metadata is well defined, with annotations for HTTPS backend protocol and cert-manager integration. However, within the conditional branch starting at line 14, if the issuer type is "cloudflare", no annotation is emitted. Please verify whether this “empty” branch is intentional, or if it should output an alternative annotation specific to Cloudflare certificate management.


18-32: Ingress Spec and Routing Rules Configuration
The Ingress spec (lines 18–32) – including setting the ingressClassName, defining the host rule for routing HTTP traffic to the virt-exportproxy service on port 443, and specifying the path configuration – follows standard practices. Confirm that using the release namespace as the ingress class is the desired behavior in your cluster.

Comment on lines +33 to +37
tls:
- hosts:
virt-exportproxy.{{ $host }}
secretName: virt-exportproxy-{{ .Release.Namespace }}-tls
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

TLS Block Formatting and YAML List Structure
The TLS configuration block is intended to declare the host for TLS and the corresponding secret name. However, the hosts field appears to be missing the YAML list marker for its entry. To meet the standard Ingress YAML spec, the hosts value should be a list. Consider updating it as follows:

-  - hosts:
-    virt-exportproxy.{{ $host }}
+  - hosts:
+      - virt-exportproxy.{{ $host }}

Also, note that the static analysis hint from YAMLlint regarding a syntax error on line 1 is likely a false positive caused by the Helm templating syntax. You might consider configuring YAMLlint to ignore these Helm template directives.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
tls:
- hosts:
virt-exportproxy.{{ $host }}
secretName: virt-exportproxy-{{ .Release.Namespace }}-tls
{{- end }}
tls:
- hosts:
- virt-exportproxy.{{ $host }}
secretName: virt-exportproxy-{{ .Release.Namespace }}-tls
{{- end }}

@kvaps kvaps force-pushed the release-tag-matching branch from 1cc4185 to f357209 Compare April 22, 2025 15:44
@kvaps kvaps requested a review from klinch0 as a code owner April 22, 2025 15:44
@kvaps kvaps force-pushed the release-tag-matching branch 2 times, most recently from ef63b86 to 5259b59 Compare April 22, 2025 16:21
Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/extra/ingress/vm-exportproxy.yaml (1)

33-37: TLS Block Formatting and YAML List Structure
The hosts field under tls must be a list, but the current indentation is missing the list marker for the host entry.

-  tls:
-  - hosts:
-    virt-exportproxy.{{ $host }}
-    secretName: virt-exportproxy-{{ .Release.Namespace }}-tls
+  tls:
+  - hosts:
+      - virt-exportproxy.{{ $host }}
+    secretName: virt-exportproxy-{{ .Release.Namespace }}-tls
🧹 Nitpick comments (2)
hack/gen_versions_map.sh (2)

33-41: Expose Git errors for invalid commit checks
Removing the 2>/dev/null redirection makes underlying git show errors (e.g., nonexistent commits or missing Chart.yaml) visible, which improves debuggability. However, with set -e active, a failing git show will abort the script immediately—potentially before your custom “not valid” message is printed.
Consider explicitly capturing and handling the exit status of git show to provide a clearer, contextual error, for example:

-    if [ "$(git show "${commit}:./${chart}/Chart.yaml" | awk '$1 == "version:" {print $2}')" != "${version}" ]; then
+    # Fetch Chart.yaml contents or error out with a clear message
+    chart_data=$(git show "${commit}:./${chart}/Chart.yaml" 2>&1) || {
+      echo "Failed to retrieve Chart.yaml for $chart at commit $commit" >&2
+      exit 1
+    }
+    fetched_version=$(printf '%s' "$chart_data" | awk '$1 == "version:" {print $2}')
+    if [ "$fetched_version" != "${version}" ]; then
         echo "Commit $commit for $chart $version is not valid" >&2
         exit 1
     fi

46-51: Consolidate version‐extraction logic for tag lookup
You’ve also removed 2>/dev/null in the tag loop to surface lookup errors. To avoid code duplication and ensure uniform error handling, consider refactoring the version retrieval into a small helper function. For example:

get_chart_version_at_ref() {
  ref=$1; chart=$2
  git show "${ref}:./${chart}/Chart.yaml" 2>&1 \
    | awk '$1 == "version:" {print $2}'
}
…
for tag in $search_commits; do
  tag_version=$(get_chart_version_at_ref "$tag" "$chart")
  if [ "$tag_version" = "$version" ]; then
    found_tag=$(git rev-parse --short "$tag")
    break
  fi
done

This will centralize error visibility and make future adjustments simpler.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1cc4185 and 5259b59.

📒 Files selected for processing (8)
  • hack/gen_versions_map.sh (2 hunks)
  • packages/extra/ingress/Chart.yaml (1 hunks)
  • packages/extra/ingress/README.md (1 hunks)
  • packages/extra/ingress/values.schema.json (1 hunks)
  • packages/extra/ingress/values.yaml (1 hunks)
  • packages/extra/ingress/vm-exportproxy.yaml (1 hunks)
  • packages/extra/versions_map (1 hunks)
  • packages/system/kubevirt/templates/kubevirt-cr.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/extra/ingress/values.schema.json
  • packages/extra/versions_map
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/system/kubevirt/templates/kubevirt-cr.yaml
  • packages/extra/ingress/Chart.yaml
  • packages/extra/ingress/values.yaml
  • packages/extra/ingress/README.md
🧰 Additional context used
🪛 YAMLlint (1.35.1)
packages/extra/ingress/vm-exportproxy.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build and Test
🔇 Additional comments (1)
packages/extra/ingress/vm-exportproxy.yaml (1)

26-30:

❓ Verification inconclusive

Verify backend service availability and port configuration.
The Ingress directs traffic to the virt-exportproxy service on port 443 over HTTPS. Please confirm that this service is deployed in the cozy-kubevirt namespace and exposes TLS on port 443, otherwise the Ingress will be unable to route traffic.

Run:

and verify .spec.ports[] includes port 443 with the correct targetPort.


🏁 Script executed:

kubectl get svc virt-exportproxy -n cozy-kubevirt -o yaml

Length of output: 157


🏁 Script executed:

#!/bin/bash
# Search for the virt-exportproxy service definition and its ports in the repository
rg -n "virt-exportproxy" -t yaml -A5

Length of output: 1916


Action Required: Confirm virt-exportproxy Service Definition and HTTPS Port
The Ingress in packages/extra/ingress/vm-exportproxy.yaml (lines 26–30):

      - backend:
          service:
            name: virt-exportproxy
            port:
              number: 443

routes traffic to a virt-exportproxy Service on port 443. No Service manifest for virt-exportproxy was found in this repository, so please verify in the cozy-kubevirt namespace that:

  • A virt-exportproxy Service exists
  • Its .spec.ports[] includes port: 443 (and the correct targetPort)
  • TLS is properly exposed on port 443

Run:

kubectl get svc virt-exportproxy -n cozy-kubevirt -o yaml

and confirm the configuration.

Comment on lines +1 to +2
{{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
{{- $issuerType := (index $cozyConfig.data "clusterissuer") | default "http01" }}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Ensure ConfigMap presence and safe default for clusterissuer.
The template uses lookup to fetch the cozystack ConfigMap and then indexes into .data.clusterissuer. If the ConfigMap is missing or the key isn’t defined, the chart will render with an error. Use Helm’s required to enforce the ConfigMap exists and apply default directly on the indexed value for clarity.

- {{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
- {{- $issuerType := (index $cozyConfig.data "clusterissuer") | default "http01" }}
+ {{- $cozyConfig := required "ConfigMap 'cozystack' not found in namespace 'cozy-system'" (lookup "v1" "ConfigMap" "cozy-system" "cozystack") }}
+ {{- $issuerType := default "http01" (index $cozyConfig.data "clusterissuer") }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- $cozyConfig := lookup "v1" "ConfigMap" "cozy-system" "cozystack" }}
{{- $issuerType := (index $cozyConfig.data "clusterissuer") | default "http01" }}
{{- $cozyConfig := required "ConfigMap 'cozystack' not found in namespace 'cozy-system'" (lookup "v1" "ConfigMap" "cozy-system" "cozystack") }}
{{- $issuerType := default "http01" (index $cozyConfig.data "clusterissuer") }}
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

@kvaps kvaps force-pushed the release-tag-matching branch 2 times, most recently from bfa22e4 to 6edffc0 Compare April 22, 2025 16:36
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps kvaps force-pushed the release-tag-matching branch from 6edffc0 to 0ddaff9 Compare April 22, 2025 16:40
@kvaps kvaps merged commit fc2c5a0 into main Apr 22, 2025
6 checks passed
@kvaps kvaps deleted the release-tag-matching branch April 22, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0