-
Notifications
You must be signed in to change notification settings - Fork 172
HNC: Update namespace labels when a namespace has a critical condition #660
Comments
This all lgtm. What do you think of all this? |
Oh, except for one thing: if |
Yes. If you set Here is an example command and outputs.
IIUC, current behavior makes sense. When we first set Consider another example: set WDYT? |
Thanks for investigating that. K8s objects should be "stateless" - it shouldn't matter what order a series of changes are made in, they should always result in the same outcome. For example, imagine we restart HNC - the order in which we sync I think we should file a separate bug to ensure that both |
Maybe we should change |
Thanks for the reply. I think that makes sense. Right now it is nondeterministic which namespace will get Changing the name SGTM. This issue is address in a separate bug: #666 |
See kubernetes-retired#660. Even when a namespace has a critical condition, we should still update its tree labels - both because there are things we *can* say about a namespace's ancestry, and also to *remove* labels that are no longer valid (e.g. missing parents, ancestors in cycles). Tested: For cycles, new unit tests plus manual checks. For orphans, I couldn't add a unit test since the test env can't delete namespaces (I had another go at this but failed). But I created an orphan manually and verified that the missing parent's labels were removed from all descendants, but other labels were not.
See kubernetes-retired#660. Even when a namespace has a critical condition, we should still update its tree labels - both because there are things we *can* say about a namespace's ancestry, and also to *remove* labels that are no longer valid (e.g. missing parents, ancestors in cycles). Tested: For cycles, new unit tests plus manual checks. For orphans, I couldn't add a unit test since the test env can't delete namespaces (I had another go at this but failed). But I created an orphan manually and verified that the missing parent's labels were removed from all descendants, but other labels were not.
See kubernetes-retired#660. Even when a namespace has a critical condition, we should still update its tree labels - both because there are things we *can* say about a namespace's ancestry, and also to *remove* labels that are no longer valid (e.g. missing parents, ancestors in cycles). Tested: For cycles, new unit tests plus manual checks. For orphans, I couldn't add a unit test since the test env can't delete namespaces (I had another go at this but failed). But I created an orphan manually and verified that the missing parent's labels were removed from all descendants, but other labels were not.
Currently namespace labels of a namespace are not updated if the namespace has a critical condition (see here).
Ideally, when a namespace has a critical condition, we should update the labels to reflect the namespace hierarchy that we are certain about. We propose the following namespace label updating strategies for each critical condition:
CritParentMissing
means the parent of a namespace is missing (e.g., the parent is deleted). In this case, we propose to view the namespace that has the condition as a root of a namespace tree and it should only containdepth=0
label. Namespace labels of the descendants of the namespace should include the path from a descendant up till the namespace. Following is an example:Suppose we have a tree as below where r is the parent of a; a is the parent of b; b is the parent of c.
r
|
a
|
b
|
c
If we delete r, each namespace will have following conditions and proposed labels:
a: Condition: CritParentMissing; Proposed Label: a/depth=0
b: Condition: CritAncestor; Proposed Labels: b/depth=0; a/depth=1
c: Condition: CritAncestor; Proposed Labels: c/depth=0; b/depth=1; a/depth=2
The hierarchy based on proposed labels becomes:
a
|
b
|
c
CritParentInvalid
means the parent of a namespace is invalid and causes a cycle. In this case, we propose to view a namespace that hasCritParentInvalid
as a root and it should only contain thedepth=0
label. Namespace labels of the descendants of the namespace should include the path from a descendant up till the namespace. Following is an example:Suppose we have a tree as below where r is the parent of a; a is the parent of b and c; b is the parent of d.
r
|
a - b - d
|
c
If we set c to be parent of a, each namespace will have following conditions and proposed labels:
r: Condition: nil; Proposed Label: r/depth=0
a: Condition: CritParentInvalid; Proposed Label: a/depth=0
b: Condition: CritAncestor; Proposed Labels: b/depth=0; a/depth=1
d: Condition: CritAncestor; Proposed Labels: d/depth=0; b/depth=1; a/depth=2
c: Condition: CritAncestor; Proposed Labels: c/depth=0; a/depth=1
The hierarchy based on proposed labels becomes:
r
a - b - d
|
c
CritAncestor
means a critical error (i.e.,CritParentMissing
and/orCritParentInvalid
) exists in an ancestor namespace. In this case, the namespace labels include the path from the current namespace till the root as described above.The text was updated successfully, but these errors were encountered: