Antipattern in status checks
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 15/100
- Type d'issue
- Fonctionnalité
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- go, kubernetes
- Domaine
- backend, distributed-systems
Piste de recherche
The issue describes reconciliation logic that reads EtcdCluster status and proposes communicating with the etcd cluster to determine its actual state, but it names no source files or tests. Start by locating the controller reconciliation code and tracing how cluster status sets ETCD_INITIAL_CLUSTER_STATE. Done means reconciliation derives that decision from the actual etcd cluster state and the issue’s incorrect-status scenario no longer leaves the cluster unbootstrapped.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
TL;DR
This issue is acknowledged and work is in progress to resolve it:
- - #181
- - #207
- - #252
- - #259
- - #260
- - #265
Please read further to understand the background reasoning.
Summary
The status field of the EtcdCluster is self-referential and is not determined by the status of an actual etcd cluster.
Background
Kubernetes controlelrs are level based. This generally means, that a controller should be able to determine its status from the state of the surrounding environment. It is generally considered a bad idea to read the status of the root object (in this case, the EtcdCluster CR).
Remember, status should be able to be reconstituted from the state of the world, so it’s generally not a good idea to read from the status of the root object. Instead, you should reconstruct it every run.
Kubebuilder book — Implementing a controller
Controllers also do not distinguish between types of events, which trigger reconciliation (was a resource created, updated, deleted, etc). Trying to fight this restriction may cause complications further down the line. For example, implementing statuses, which describe the lifecycle of a resource and then relying on them to select a mode of operation of the controller can lead to new failure modes which need to be handled in different ways, growing the complexity of the codebase.
Issue
In its current state, the controller relies on an EtcdCluster's status field to determine the next steps in the reconciliation logic. If the controller reads an incorrect status without actually validating it, the etcd cluster will fail to launch. A contrived example can produce this issue as follows:
First apply the following yaml
---
apiVersion: etcd.aenix.io/v1alpha1
kind: EtcdCluster
metadata:
name: test
namespace: default
spec:
replicas: 3
podTemplate:
spec:
containers:
- name: etcd
image: "nginx"
args: ["-c", "sleep 3600"]
command: ["/bin/sh"]
livenessProbe:
httpGet:
host: ifconfig.me
path: /
port: 80
scheme: HTTP
readinessProbe:
httpGet:
host: ifconfig.me
path: /
port: 80
scheme: HTTP
startupProbe:
httpGet:
host: ifconfig.me
path: /
port: 80
scheme: HTTP
This object will generate a statefulset which will launch and pass all readiness checks, but will not in fact build a working cluster, instead three containers will simply run sleep 3600. The cluster-state configmap will set the value of ETCD_INITIAL_CLUSTER_STATE to existing.
Next, attempt to fix the problem, by applying a correct manifest
---
apiVersion: etcd.aenix.io/v1alpha1
kind: EtcdCluster
metadata:
name: test
namespace: default
spec:
replicas: 3
The statefulset's podspec will be updated to correct values to launch an etcd cluster, but since the initial cluster state is erroneously set to "existing", a cluster will not be bootstrapped.
Analysis
In my opinion, the root cause of this problem is that no attempt is made to verify the "actual" status of the etcd cluster. Although at the moment the logic of the controller is quite simple and one must craft rather contrived bad inputs to break it, the examples do show that a failed transaction here or there, such as a dropped packet, a crashed node, etc, can leave an EtcdCluster (the custom resource) in an unrecoverable state.
Since implementing communication with the etcd cluster will be necessary in any case, for instance, to implement scaling up and down, I think it is prudent to start work on such a feature now and use it to determine the status of the cluster.
- Langage dominant
- Go
- Étoiles
- 154
- Forks
- 31
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de cozystack/etcd-operator
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
cozystack/etcd-operator#385 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
cozystack/etcd-operator#383 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
cozystack/etcd-operator#381 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
cozystack/etcd-operator#374 · 1 commentaire ·
-
Adoption deletes the legacy cluster-state ConfigMap but leaves Pods referencing it, and neither self-heal path detects the resultPeut-être pris @androndo l’a pris il y a 46 jours. Ouvertebug
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
cozystack/etcd-operator#373 ·
Toutes les issues de cozystack/etcd-operator
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
Correct local module testing instructions for Go sample contributorsPeut-être pris @slievrly l’a pris aujourd’hui. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
-
internal/core: cleanAttachmentName splits a rune at the 255-byte cap and stores invalid UTF-8Peut-être pris @pacwestnobody l’a pris aujourd’hui. Ouvertego good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Podiom/Podiom#427 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
TestLaunchGolden spends about 98 seconds on fake-agent exit delays under -racePeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
factory:subtask
Difficulté 1/5 Moins d'une heure Accessibilité débutants 95/100
Les mainteneurs répondent en général sous 1 jour