Guess etcd replicas number function

未关闭
#239 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
30/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
go, kubernetes
领域
backend, databases

调研方向

Read the proposal in this issue and the linked design reference in pull request #181, then locate the operator code that handles StatefulSets, cluster state ConfigMaps, etcd membership, endpoints, PVCs, and pods. Map how those sources determine the replica count and where scaling or recovery consumes it. Done means a function returns the highest discovered replica index plus one across the listed sources.

由索引模型根据 Issue 内容生成。

描述

According to the latest meeting 2024-06-18 MINUTES we decided that we need a function that guesses the needed amount of etcd replicas.

It can be used for recovering non-exising STS object and also for scaling from 0
Design ref: https://github.com/aenix-io/etcd-operator/pull/181

Proposal:

  • Create variable guessed=0
  • Check cluster-state configmap
    • if configmap exists and initial-cluster-members defined
      • if there are any hostnames defined in initial-cluster-members
        • take the hostname of pod with highest number and +1
          • save value into guessed variable
  • Check endpoins for etcd-headless service
    • if there are any endpoints
      • connect to the cluster using endpoint and collect information from member list
        • if there are any members in output from etcd
          • take the hostname with highest number and +1
            • if value is greater then value in guessed, save value into guessed variable
      • read endpoints from kubernetes object:
        • take the hostname of the pod for endpoint with highest number and +1
          • if value is greater then value in guessed, save value into guessed variable
  • read persistent volume claims that falls under StatefulSet label selector
    • if there are any pvcs
      • take the name of the pvc with highest number and +1
        • if value is greater then value in guessed, save value into guessed variable
  • read pods pods that falls under StatefulSet label selector
    • if there are any pods
      • take the pod name with highest number and +1
        • if value is greater then value in guessed, save value into guessed variable
  • return guessed
主要语言
Go
星标
154
派生
31
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cozystack/etcd-operator 的其他 Issue

查看 cozystack/etcd-operator 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。