Misleading logs from the controller using opt-in propagation
Closed this issue · 0 comments
Submitted a fix here #337
There are misleading logs coming from the controller when using opt-in propagation.
To reproduce:
- Create parent namespace
- Create child namespace
- Make child namespace a child of parent using hierarchyconfiguration
- Update HNCConfiguration to enable configmap propagation in AllowPropagate mode
- Create following configmap in parent namespace (the one to be propagated)
apiVersion: v1
kind: ConfigMap
metadata:
name: configmap1
namespace: parent
annotations:
propagate.hnc.x-k8s.io/all: "true"
data:
propagate: "Yes"
After Step 5, following log appears, which is also the behaviour and it is correct.
{"level":"info","ts":1697129502.1277547,"logger":"ConfigMap.reconcile","msg":"Propagating object","rid":69,"trigger":"child/configmap1"}
- Create following configmap in parent namespace (the one not to be propagated)
apiVersion: v1
kind: ConfigMap
metadata:
name: configmap2
namespace: parent
data:
propagate: "No"
After Step 6 following log appears, which is wrong. There is no propagated configmap2 in child namespace to delete at all, niether is that the intention of Step 6.
{"level":"info","ts":1697129547.7034624,"logger":"ConfigMap.reconcile","msg":"Deleted propagated object","rid":72,"trigger":"child/configmap2"}
-
Check configmaps in both parent and child namespaces. They are correctly propagated. Parent has 2 configmaps. Child has 1.
-
Delete configmap2 from the parent namespace
After Step 8, following log appears, which is wrong. There is no propagated configmap2 in child namespace to delete at all.
{"level":"info","ts":1697129632.8285985,"logger":"ConfigMap.reconcile","msg":"Deleted propagated object","rid":74,"trigger":"child/configmap2"}
- Delete configmap1 from the child namespace
After Step 9, following logs appears, which is correct, but it is repeated twice which is incorrect.
{"level":"info","ts":1697129706.868495,"logger":"ConfigMap.reconcile","msg":"Deleted propagated object","rid":76,"trigger":"child/configmap1"}
{"level":"info","ts":1697129706.877126,"logger":"ConfigMap.reconcile","msg":"Deleted propagated object","rid":77,"trigger":"child/configmap1"}
As far as I can tell, the actual behaviour of HNC is correct, i.e. correct objects are getting propgated and/or deleted as per opt-in functionality, but logs are just misleading. This is a problem when trying to debug issues and a large number of objects (think 10s of configmaps when only 1 needs to be propagated) of the resource set to AllowPropagate mode exist in parent namespaces. The logs get flooded with events that supposedly never happend.