Skip to content

Improve TLS handling in etcd helm chart #620

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 2 commits into from
Feb 25, 2025
Merged

Conversation

lllamnyp
Copy link
Member

@lllamnyp lllamnyp commented Feb 7, 2025

  1. Add a commonName to every certificate.
  2. Move 127.0.0.1 from DNS names to IP Addresses in the certificate
    spec.
  3. Add client auth usage to the etcd-server certificate (yes,
    that's necessary), because etcd queries itself using its
    server cert as a client cert.
  4. Default all CA certificates' durations to 10 years.
  5. Set subject org to release namespace and OU to name so that subjects
    are unique.

Summary by CodeRabbit

  • New Features

    • Enhanced certificate configurations for improved flexibility with dynamic duration, subject formatting, and common name identification, along with predefined IP addresses for better component recognition.
    • Application version bumped to 2.6.0 with updated package version mappings.
  • Chores

    • Minor formatting adjustment in the JSON schema for cleaner file structure.

@lllamnyp lllamnyp requested a review from kvaps as a code owner February 7, 2025 06:39
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 7, 2025
Copy link
Contributor

coderabbitai bot commented Feb 7, 2025

Walkthrough

This pull request updates the etcd chart template and related configuration files. The etcd-cluster.yaml template has been modified to enhance certificate specifications, including the addition of duration, commonName, and ipAddresses fields, along with dynamic references for subject. The version in Chart.yaml has been updated from 2.5.0 to 2.6.0, and the version mapping in versions_map has been adjusted accordingly. A minor formatting change was made to the JSON schema file by adding a newline at the end.

Changes

File(s) Change Summary
packages/extra/etcd/templates/etcd-cluster.yaml Updated certificate specifications for etcd-peer-ca, etcd-ca, etcd-server, etcd-peer, and etcd-client (added duration, commonName, subject, and ipAddresses fields).
packages/extra/etcd/values.schema.json Added a newline at the end of the file.
packages/extra/etcd/Chart.yaml
packages/extra/versions_map
Updated version from 2.5.0 to 2.6.0 in Chart.yaml; in versions_map, updated etcd 2.5.0 from HEAD to commit hash 861e6c46 and added a new entry etcd 2.6.0 HEAD.

Suggested labels

lgtm

Suggested reviewers

  • kvaps

Poem

I am a rabbit, hopping with cheer,
New changes bloom, fresh and clear.
Templates and versions now dance in tune,
A configuration fest under the moon.
Hop along with code, smooth as a rune!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0f87c73 and 6ff8b52.

📒 Files selected for processing (1)
  • packages/extra/versions_map (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/extra/versions_map

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.

@dosubot dosubot bot added the enhancement New feature or request label Feb 7, 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 (1)
packages/extra/etcd/values.schema.json (1)

19-40: Accurate JSON Schema Enhancements for TLS Configurability
The schema now includes "caDuration" and a "subject" object with detailed sub-properties, which aligns well with the new templatable certificate configuration. As a potential refinement, consider specifying the array item types (e.g., adding "items": {"type": "string"} for properties like "organizations" and "countries") to enforce that only string values are provided. This refinement isn’t critical but could further improve schema validation.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1a88883 and df97bf5.

📒 Files selected for processing (3)
  • packages/extra/etcd/templates/etcd-cluster.yaml (7 hunks)
  • packages/extra/etcd/values.schema.json (1 hunks)
  • packages/extra/etcd/values.yaml (1 hunks)
🔇 Additional comments (7)
packages/extra/etcd/values.yaml (2)

10-30: Thorough Documentation for the New X509 Subject Parameters
The added block documents the new "subject" object very clearly with separate entries for organizations, organizational units, countries, localities, provinces, postal codes, street addresses, and serial number. The inline comments (and the use of commented-out fields) appropriately guide users on how they may customize these values if needed.


31-32: Clear CA Certificate Duration Setting
Defining "caDuration" as 87600h (representing a 10-year period) is consistent with the PR objectives. This provides a good default while still leaving room for user customization if necessary.

packages/extra/etcd/templates/etcd-cluster.yaml (5)

75-77: Dynamic Configuration in etcd-peer-ca Certificate
The changes for the etcd-peer-ca certificate now include a dynamic "duration" field (using .Values.caDuration) and a templated "subject" (via .Values.subject | toYaml | nindent 4). This meets the PR objectives by removing hardcoded values and enhancing flexibility.


97-99: Enhanced etcd-ca Certificate Settings
Similar to the etcd-peer-ca, the etcd-ca certificate now dynamically incorporates the "duration" and "subject" fields. This consistent approach simplifies configuration management for CA certificates.


130-147: Comprehensive Updates to the etcd-server Certificate
The etcd-server certificate now specifies a "commonName", a dynamic "subject", and moves the "127.0.0.1" into its own "ipAddresses" field. Additionally, including "client auth" in its usages directly addresses the self-querying behavior described in the PR objectives. Please verify the indentation produced by "toYaml | nindent 4" to ensure it renders correctly in the final manifest.


160-177: Consistent TLS Customization for the etcd-peer Certificate
The etcd-peer certificate now has a set "commonName", a dynamic "subject" field, and defines "ipAddresses" appropriately. This ensures that peer certificates leverage the new templating features and enhanced identification setup.


190-192: Updated etcd-client Certificate with Templated Subject
Adding the dynamic "subject" field to the etcd-client certificate extends the flexible TLS configuration to the client side. This change helps maintain consistency across all TLS certificates defined in this chart.

@lllamnyp lllamnyp force-pushed the chore/improve-etcd-tls branch from df97bf5 to 14d93d2 Compare February 11, 2025 19:33
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 11, 2025
1. Add a `commonName` to every certificate.
2. Move 127.0.0.1 from DNS names to IP Addresses in the certificate
   spec.
3. Add **client** auth usage to the etcd-**server** certificate (yes,
   that's necessary), because etcd queries itself using its
   [server cert as a client cert](etcd-io/etcd#9785 (comment)).
4. Default all CA certificates' durations to 10 years.
5. Set subject org to release namespace and OU to name so that subjects
   are unique
@lllamnyp lllamnyp force-pushed the chore/improve-etcd-tls branch from 14d93d2 to 0f87c73 Compare February 25, 2025 10:37
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Feb 25, 2025
Copy link
Member

@kvaps kvaps left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 25, 2025
@lllamnyp lllamnyp merged commit 46f0bb2 into main Feb 25, 2025
2 checks passed
@lllamnyp lllamnyp deleted the chore/improve-etcd-tls branch February 25, 2025 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants