Skip to content

WIP [scalardb-cluster] Make Envoy optional #302

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kota2and3kan
Copy link
Collaborator

Description

Provide a brief description about why this PR is necessary. Be sure to provide context.

Related issues and/or PRs

If this PR addresses or references any issues and/or other PRs, list them here.

Changes made

Outline the specific changes made in this pull request. Include relevant details, such as added features, bug fixes, code refactoring, or improvements.

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

Provide any additional information or notes that may be relevant to the reviewers or stakeholders.

Release notes

Provide release note text for this PR based on the guidelines at Guidelines for Writing Release Notes.

For example:

Added validation for the Consensus Commit mutation operation.

@kota2and3kan kota2and3kan self-assigned this Jul 1, 2025
@kota2and3kan kota2and3kan added improvement scalardb cluster PR for ScalarDB Cluster chart minor labels Jul 1, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @kota2and3kan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the capability to deploy ScalarDB Cluster without requiring Envoy as a mandatory component. It achieves this by making the underlying Kubernetes service configurations conditional based on an envoy.enabled flag, allowing the cluster to be exposed via a standard service instead of a headless service when Envoy is not in use. This change provides greater flexibility for users who do not need Envoy's features in their ScalarDB Cluster deployments.

Highlights

  • Conditional Service Deployment: The Kubernetes Service definition for ScalarDB Cluster is now conditional. If .Values.envoy.enabled is true, a headless service (clusterIP: None) is deployed. Otherwise, a standard Kubernetes Service (ClusterIP type, or whatever is specified by .Values.scalardbCluster.service.type) is deployed.
  • Dynamic Endpoint Configuration: The SCALAR_DB_CLUSTER_MEMBERSHIP_KUBERNETES_ENDPOINT_NAME environment variable within the deployment is now dynamically set. It will point to the headless service name when Envoy is enabled, and to the standard service name when Envoy is disabled, ensuring correct cluster membership discovery.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request makes Envoy optional in the scalardb-cluster Helm chart. The service created for a non-Envoy setup is not headless, which is a requirement for Kubernetes-based cluster membership discovery. The deployment.yaml is configured to use this service for cluster membership discovery. ScalarDB's Kubernetes discovery mechanism requires a headless service to get the individual pod IPs. A regular service with a cluster IP will not work for discovery, causing the cluster formation to fail.

Comment on lines +21 to +41
{{- else }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "scalardb-cluster.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "scalardb-cluster.labels" . | nindent 4 }}
annotations:
{{- toYaml .Values.scalardbCluster.service.annotations | nindent 4 }}
spec:
type: {{ .Values.scalardbCluster.service.type }}
ports:
{{- range $key, $value := .Values.scalardbCluster.service.ports }}
- name: {{ $key }}
{{- toYaml $value | nindent 6 }}
{{- end }}
selector:
{{- include "scalardb-cluster.selectorLabels" . | nindent 4 }}
{{- end }}

Choose a reason for hiding this comment

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

critical

When envoy.enabled is false, the service created in the {{- else }} block is not headless (it lacks spec.clusterIP: None). The deployment.yaml is configured to use this service for cluster membership discovery. ScalarDB's Kubernetes discovery mechanism requires a headless service to get the individual pod IPs. A regular service with a cluster IP will not work for discovery, causing the cluster formation to fail.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ScalarDB Cluster's pod discovery feature utilizes the Endpoint resource behind the Service directly. It doesn't depend on the Headless Service. Therefore, it works if we create a Service resource even if whether it's Headless or not.

Comment on lines +58 to +64
{{- if .Values.envoy.enabled }}
- name: SCALAR_DB_CLUSTER_MEMBERSHIP_KUBERNETES_ENDPOINT_NAME
value: {{ include "scalardb-cluster.fullname" . }}-headless
{{- else }}
- name: SCALAR_DB_CLUSTER_MEMBERSHIP_KUBERNETES_ENDPOINT_NAME
value: {{ include "scalardb-cluster.fullname" . }}
{{- end }}

Choose a reason for hiding this comment

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

medium

Consider refactoring this block to be more concise and avoid repeating the name field, which improves maintainability.

          - name: SCALAR_DB_CLUSTER_MEMBERSHIP_KUBERNETES_ENDPOINT_NAME
            value: {{ include "scalardb-cluster.fullname" . }}{{ if .Values.envoy.enabled }}-headless{{ end }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement minor scalardb cluster PR for ScalarDB Cluster chart
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant