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

Introduce externalMethod=WholeIP for VMs #616

Merged
merged 2 commits into from
Feb 7, 2025
Merged

Introduce externalMethod=WholeIP for VMs #616

merged 2 commits into from
Feb 7, 2025

Conversation

kvaps
Copy link
Member

@kvaps kvaps commented Feb 5, 2025

Signed-off-by: Andrei Kvapil [email protected]

Summary by CodeRabbit

  • New Features

    • Introduced a new configuration option for specifying the method to handle external traffic. Users can now choose between "WholeIP" and "PortList" (default) across virtual machine and instance deployments.
    • Service settings now adjust automatically based on the selected external traffic method.
  • Documentation

    • Updated configuration guides to include details on the new externalMethod parameter and its usage for managing external traffic.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 5, 2025
Copy link
Contributor

coderabbitai bot commented Feb 5, 2025

Walkthrough

This pull request introduces a new property, externalMethod, for virtual machine configurations in both the virtual-machine and vm-instance packages. The property is added to configuration files, including schema definitions, YAML files, and documentation, and is validated via the Makefile. Additionally, the Kubernetes Service templates now conditionally apply an annotation and port mapping based on whether externalMethod is set to "WholeIP". Allowed values for externalMethod are "WholeIP" and "PortList", with a default of "WholeIP".

Changes

File(s) Change Summary
packages/.../virtual-machine/{Makefile, README.md, templates/service.yaml, values.schema.json, values.yaml} Added new externalMethod property with allowed values "WholeIP" and "PortList"; updated the Makefile to modify the schema, enhanced documentation, and added conditional logic in the service template to apply an annotation and fixed port when externalMethod is "WholeIP".
packages/.../vm-instance/{Makefile, README.md, templates/service.yaml, values.schema.json, values.yaml} Introduced the externalMethod parameter in configuration and schema; updated the documentation and service template to handle conditional behavior based on the externalMethod value.
packages/.../versions_map Updated versioning for virtual-machine and vm-instance packages, specifying commit hashes and adding new versions.
packages/.../{Chart.yaml} Updated version and appVersion fields for virtual-machine and vm-instance charts to reflect new versions.

Possibly related PRs

  • Add hooks to update instanceType, instanceProfile, and storage #590: The changes in the main PR and the retrieved PR are related as both introduce modifications to the values.schema.json file, specifically adding or updating the externalMethod property and its enumeration values.
  • Rework VirtualMachine, introduce cloudinit and sshKeys configuration, fix externalPorts #303: The changes in the main PR, specifically the addition of the externalMethod property in the values.schema.json, are related to modifications in the retrieved PR that also involve updates to the values.schema.json, including the addition of the externalPorts property.
  • add keycloak #475: The changes in the main PR, which involve adding an externalMethod property to the values.schema.json file, are related to modifications in the retrieved PR that also update the values.schema.json file to define acceptable values for the same property.

Suggested labels

size:L

Suggested reviewers

  • klinch0

Poem

I’m a rabbit, hopping in delight,
For changes that shine both day and night.
externalMethod now leads the way,
With "WholeIP" or "PortList" in play.
Schema and docs now dance as one—
Celebrating progress, hop, hop, done!
🐰🌟

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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. (Beta)
  • @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 changed the title Introduce externalMethod: wholeIP for VMs Introduce externalMethod=wholeIP for VMs Feb 5, 2025
@dosubot dosubot bot added the enhancement New feature or request label Feb 5, 2025
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: 0

🧹 Nitpick comments (5)
packages/apps/virtual-machine/values.yaml (1)

4-4: Clarify Parameter Documentation for externalMethod

The added documentation comment currently reads:
## @param externalMethod specify method to passthrough the traffic to the virtual machine. Allowed values: \standard` and `wholeIP``
For improved clarity and grammatical accuracy, consider changing “passthrough” to “pass through.”

packages/apps/vm-instance/values.schema.json (1)

10-18: Validate New Schema Property for externalMethod

The new "externalMethod" property is correctly defined with type "string", a default value of "wholeIP", and an enum restricting allowed values to "standard" and "wholeIP". For further clarity, consider revising the description to use “pass through” (with a space) instead of “passthrough.”

packages/apps/virtual-machine/values.schema.json (1)

10-18: Ensure Schema Consistency for externalMethod

This schema update mirrors the one in the vm-instance package. The property’s type, default value, and enumeration are consistent with the intended behavior. A minor improvement would be to update the description to “specify method to pass through the traffic to the virtual machine” for better readability.

packages/apps/vm-instance/README.md (1)

39-44: Documentation Table Update for externalMethod

The parameters table now includes an entry for externalMethod with a clear description and default value. For clarity, please consider changing “passthrough” to “pass through” in the description. Also, ensure the table rows follow the markdown lint guidelines (i.e. use both leading and trailing pipes).

🧰 Tools
🪛 LanguageTool

[grammar] ~42-~42: The word “passthrough” is a noun. The verb is spelled with a white space.
Context: ... externalMethod | specify method to passthrough the traffic to the virtual machine. All...

(NOUN_VERB_CONFUSION)

packages/apps/virtual-machine/README.md (1)

41-44: Update Documentation Table Entry for externalMethod

The added table row correctly documents the new externalMethod parameter. For improved clarity, update the description to read “specify method to pass through the traffic to the virtual machine” instead of using “passthrough.” Additionally, verify that the table formatting complies with markdown lint rules by including trailing pipes for all rows.

🧰 Tools
🪛 LanguageTool

[grammar] ~42-~42: The word “passthrough” is a noun. The verb is spelled with a white space.
Context: ...nalMethod` | specify method to passthrough the traffic to the virtual machine. All...

(NOUN_VERB_CONFUSION)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 835ee11 and fd1e5eb.

📒 Files selected for processing (10)
  • packages/apps/virtual-machine/Makefile (1 hunks)
  • packages/apps/virtual-machine/README.md (1 hunks)
  • packages/apps/virtual-machine/templates/service.yaml (1 hunks)
  • packages/apps/virtual-machine/values.schema.json (1 hunks)
  • packages/apps/virtual-machine/values.yaml (1 hunks)
  • packages/apps/vm-instance/Makefile (1 hunks)
  • packages/apps/vm-instance/README.md (1 hunks)
  • packages/apps/vm-instance/templates/service.yaml (1 hunks)
  • packages/apps/vm-instance/values.schema.json (1 hunks)
  • packages/apps/vm-instance/values.yaml (1 hunks)
🧰 Additional context used
🪛 LanguageTool
packages/apps/vm-instance/README.md

[grammar] ~42-~42: The word “passthrough” is a noun. The verb is spelled with a white space.
Context: ... externalMethod | specify method to passthrough the traffic to the virtual machine. All...

(NOUN_VERB_CONFUSION)


[style] ~50-~50: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ... of SSH public keys for authentication. Can be a single key or a list of keys. ...

(MISSING_IT_THERE)

packages/apps/virtual-machine/README.md

[grammar] ~42-~42: The word “passthrough” is a noun. The verb is spelled with a white space.
Context: ...nalMethod` | specify method to passthrough the traffic to the virtual machine. All...

(NOUN_VERB_CONFUSION)

🪛 markdownlint-cli2 (0.17.2)
packages/apps/vm-instance/README.md

51-51: Table pipe style
Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe

(MD055, table-pipe-style)

🔇 Additional comments (8)
packages/apps/vm-instance/templates/service.yaml (2)

9-12: Conditional Annotation Addition:
The conditional block correctly adds the networking.cozystack.io/wholeIP: "true" annotation within the metadata when .Values.externalMethod is set to "wholeIP". This ensures that the service is tagged appropriately for whole-IP traffic routing. Please confirm that this behavior is in line with the default configuration specified in values.yaml.


20-28: Port Configuration Update:
The conditional structure under the ports section properly assigns a fixed port (65535) when .Values.externalMethod equals "wholeIP", and falls back to iterating over .Values.externalPorts otherwise. This logic is consistent with the PR objective to handle different external methods for VM traffic routing.

packages/apps/virtual-machine/templates/service.yaml (2)

9-12: Conditional Annotation Addition:
The changes mirror those in the vm-instance template. The conditional check adds the networking.cozystack.io/wholeIP: "true" annotation when .Values.externalMethod is "wholeIP", ensuring consistent behavior across the project.


20-28: Port Configuration Update:
The port assignment logic here similarly provides a fixed port of 65535 when the external method is "wholeIP", which aligns with the intended behavior. When the condition is not met, the ports are dynamically generated from .Values.externalPorts. This is a clear and concise implementation of the required feature.

packages/apps/vm-instance/Makefile (1)

11-11: Schema Enum Update:
The newly added command updates the enumeration for externalMethod in values.schema.json to ["standard", "wholeIP"]. This enforces strict validation for the new parameter and is well-aligned with the feature’s intent.

packages/apps/virtual-machine/Makefile (1)

11-11: ExternalMethod Enum Update in Schema:
This command aptly inserts the allowed enumeration for externalMethod into values.schema.json. Defining the acceptable values as ["standard", "wholeIP"] ensures that users can only configure valid options, which is critical for maintaining robust external access configurations.

packages/apps/vm-instance/values.yaml (1)

4-8: New Parameter Addition:
The addition of the externalMethod parameter with a default value of "wholeIP", along with an inline comment that highlights the allowed values (standard and wholeIP), is clear and aligns perfectly with the updated schema and documentation. This ensures that users are aware of the valid configurations for external traffic routing.

packages/apps/virtual-machine/values.yaml (1)

7-7: Default Value for externalMethod

The configuration sets externalMethod to "wholeIP", which is consistent with the defaults specified in the schemas.

## @param externalPorts [array] Specify ports to forward from outside the cluster
external: false
externalMethod: "wholeIP"
Copy link

Choose a reason for hiding this comment

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

Combination of wholeIP and port-list is confusing. Consider making the port-list either optional or empty.

@kvaps kvaps changed the title Introduce externalMethod=wholeIP for VMs Introduce externalMethod=WholeIP for VMs Feb 6, 2025
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: 0

🧹 Nitpick comments (6)
packages/apps/vm-instance/README.md (4)

42-42: Clarify the 'externalMethod' description
The description “specify method to passthrough the traffic to the virtual machine.” can be improved for clarity and grammatical correctness. Consider rephrasing it to: “Specifies the method to pass traffic through to the virtual machine. Allowed values: WholeIP and PortList.”

Proposed diff:

-| externalMethod | specify method to passthrough the traffic to the virtual machine. Allowed values: WholeIP and PortList | WholeIP |
+| externalMethod | Specifies the method to pass traffic through to the virtual machine. Allowed values: WholeIP and PortList | WholeIP |

🧰 Tools
🪛 LanguageTool

[grammar] ~42-~42: The word “passthrough” is a noun. The verb is spelled with a white space.
Context: ... externalMethod | specify method to passthrough the traffic to the virtual machine. All...

(NOUN_VERB_CONFUSION)


46-46: Fix spelling error in 'instanceProfile' description
The term “prefferences” is misspelled. It should be changed to “preferences” for accuracy and clarity.

Proposed diff:

-| instanceProfile | Virtual Machine prefferences profile | ubuntu |
+| instanceProfile | Virtual Machine preferences profile | ubuntu |


50-50: Improve SSH keys description style
The current description “List of SSH public keys for authentication. Can be a single key or a list of keys.” could be revised for smoother readability. For example, changing it to “List of SSH public keys for authentication; can be a single key or a list of keys.” would form a more complete sentence.

Proposed diff:

-| sshKeys | List of SSH public keys for authentication. Can be a single key or a list of keys. | [] |
+| sshKeys | List of SSH public keys for authentication; can be a single key or a list of keys. | [] |

🧰 Tools
🪛 LanguageTool

[style] ~50-~50: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ... of SSH public keys for authentication. Can be a single key or a list of keys. ...

(MISSING_IT_THERE)


51-52: Improve markdown table formatting for 'cloudInit' row
The markdown linter suggests using a trailing pipe for consistency in table formatting. Adjust the cloudInit row to include a trailing pipe.

Proposed diff:

-| cloudInit | cloud-init user data config. See cloud-init documentation for more details. | #cloud-config - |
+| cloudInit | cloud-init user data config. See cloud-init documentation for more details. | #cloud-config |

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

51-51: Table pipe style
Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe

(MD055, table-pipe-style)


52-52: Table pipe style
Expected: leading_and_trailing; Actual: trailing_only; Missing leading pipe

(MD055, table-pipe-style)


52-52: Table column count
Expected: 3; Actual: 1; Too few cells, row will be missing data

(MD056, table-column-count)

packages/apps/virtual-machine/values.yaml (1)

4-4: Clarify Parameter Description Grammar.
The description for the new parameter currently uses “passthrough” as one word. Since “pass through” is the proper verb form, consider updating the text to “specify method to pass through the traffic to the virtual machine” for improved clarity and professionalism.

packages/apps/virtual-machine/README.md (1)

42-42: Revise Parameter Description for Consistency.
Similar to the YAML file, the description here uses “passthrough” as one word. For consistency and grammatical accuracy, consider updating it to “specify method to pass through the traffic to the virtual machine.” This will enhance clarity for the users reading the documentation.

🧰 Tools
🪛 LanguageTool

[grammar] ~42-~42: The word “passthrough” is a noun. The verb is spelled with a white space.
Context: ...nalMethod` | specify method to passthrough the traffic to the virtual machine. All...

(NOUN_VERB_CONFUSION)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fd1e5eb and 6f9b405.

📒 Files selected for processing (13)
  • packages/apps/versions_map (1 hunks)
  • packages/apps/virtual-machine/Chart.yaml (1 hunks)
  • packages/apps/virtual-machine/Makefile (1 hunks)
  • packages/apps/virtual-machine/README.md (1 hunks)
  • packages/apps/virtual-machine/templates/service.yaml (1 hunks)
  • packages/apps/virtual-machine/values.schema.json (1 hunks)
  • packages/apps/virtual-machine/values.yaml (1 hunks)
  • packages/apps/vm-instance/Chart.yaml (1 hunks)
  • packages/apps/vm-instance/Makefile (1 hunks)
  • packages/apps/vm-instance/README.md (1 hunks)
  • packages/apps/vm-instance/templates/service.yaml (1 hunks)
  • packages/apps/vm-instance/values.schema.json (1 hunks)
  • packages/apps/vm-instance/values.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/apps/vm-instance/Chart.yaml
  • packages/apps/virtual-machine/Chart.yaml
🚧 Files skipped from review as they are similar to previous changes (7)
  • packages/apps/vm-instance/values.schema.json
  • packages/apps/vm-instance/Makefile
  • packages/apps/vm-instance/values.yaml
  • packages/apps/vm-instance/templates/service.yaml
  • packages/apps/virtual-machine/values.schema.json
  • packages/apps/virtual-machine/Makefile
  • packages/apps/virtual-machine/templates/service.yaml
🧰 Additional context used
🪛 LanguageTool
packages/apps/virtual-machine/README.md

[grammar] ~42-~42: The word “passthrough” is a noun. The verb is spelled with a white space.
Context: ...nalMethod` | specify method to passthrough the traffic to the virtual machine. All...

(NOUN_VERB_CONFUSION)

packages/apps/vm-instance/README.md

[grammar] ~42-~42: The word “passthrough” is a noun. The verb is spelled with a white space.
Context: ... externalMethod | specify method to passthrough the traffic to the virtual machine. All...

(NOUN_VERB_CONFUSION)


[style] ~50-~50: To form a complete sentence, be sure to include a subject or ‘there’.
Context: ... of SSH public keys for authentication. Can be a single key or a list of keys. ...

(MISSING_IT_THERE)

🪛 markdownlint-cli2 (0.17.2)
packages/apps/vm-instance/README.md

51-51: Table pipe style
Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe

(MD055, table-pipe-style)

🔇 Additional comments (4)
packages/apps/versions_map (3)

112-113: LGTM! Version updates for virtual-machine package follow semantic versioning.

The changes appropriately:

  • Pin version 0.7.1 to commit 05857b9 for stability
  • Introduce version 0.8.0 for the new externalMethod feature

119-120: LGTM! Version updates for vm-instance package follow semantic versioning.

The changes appropriately:

  • Pin version 0.4.1 to commit 05857b9 for stability
  • Introduce version 0.5.0 for the new externalMethod feature

112-113: Verify the commit hash exists and contains the expected changes.

Both packages are pinned to commit 05857b9. Let's verify this commit exists and contains the expected changes.

Also applies to: 119-120

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Verify the commit exists and contains the expected changes

# Check if the commit exists and show its changes
git show 05857b95 --name-only

Length of output: 1639


Commit 05857b9 Verified with Expected Changes
The commit exists as expected. The output confirms that commit 05857b9—introduced on January 23, 2025—includes the changes for the Kamaji package (e.g., Makefile, Dockerfile, chart updates) along with the appropriate commit message ("Fix kamaji make update (#598)"). This aligns with what’s expected for the pinned commit.

packages/apps/virtual-machine/values.yaml (1)

7-7: Verify Default Value and Consistency with Design Intent.
The new parameter is set as externalMethod: WholeIP. Please confirm that this default aligns with the overall schema and expected type (i.e. a string). Additionally, given past feedback that combining a “WholeIP” method with an active port list may be confusing, ensure that either the design documentation explicitly clarifies this choice or that appropriate validation is in place.

@kvaps kvaps merged commit f768dc1 into main Feb 7, 2025
2 checks passed
@kvaps kvaps deleted the wholeip branch February 7, 2025 07:40
@coderabbitai coderabbitai bot mentioned this pull request Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants