This PR fixes the bug where the cluster roles and cluster role bindings were
getting deleted and recreated on every reconciliation from OpenEBS version
2.0.0-ee-RC1 onwards.
What happened?
The CSI components related cluster roles and cluster role bindings were getting deleted and recreated on every reconciliation from OpenEBS version 2.0.0-ee-RC1 onwards due to which one of the containers of openebs-csi-controller was restarting again and again.
Solution/Fix:
This was happening since we had started making use of apiVersion: rbac.authorization.k8s.io/v1 for the cluster roles and cluster role bindings of CSI, we have been making use of apiVersion: rbac.authorization.k8s.io/v1beta1 in the previous versions for these roles and bindings.
Due to the above change, in order to maintain backward compatibility, we were mentioning both the apiVersion in the metac config YAML. The expectation from this was that we would be getting the ones in apiVersion: rbac.authorization.k8s.io/v1 in only this category of attachments and the ones in apiVersion: rbac.authorization.k8s.io/v1beta1 in this category but what started happening is that these roles and role bindings started to come twice as attachments in both the category.
Since these were coming as observed resources in both categories but we were sending them in desired resources only once, metac was deleting it and recreating it.
In order to avoid this scenario, we are only making use of apiVersion: rbac.authorization.k8s.io/v1beta1 as of now for all the cluster roles and cluster role bindings.
This PR fixes the bug where the cluster roles and cluster role bindings were getting deleted and recreated on every reconciliation from OpenEBS version 2.0.0-ee-RC1 onwards.
What happened? The CSI components related cluster roles and cluster role bindings were getting deleted and recreated on every reconciliation from OpenEBS version 2.0.0-ee-RC1 onwards due to which one of the containers of openebs-csi-controller was restarting again and again.
Solution/Fix: This was happening since we had started making use of apiVersion: rbac.authorization.k8s.io/v1 for the cluster roles and cluster role bindings of CSI, we have been making use of apiVersion: rbac.authorization.k8s.io/v1beta1 in the previous versions for these roles and bindings. Due to the above change, in order to maintain backward compatibility, we were mentioning both the apiVersion in the metac config YAML. The expectation from this was that we would be getting the ones in apiVersion: rbac.authorization.k8s.io/v1 in only this category of attachments and the ones in apiVersion: rbac.authorization.k8s.io/v1beta1 in this category but what started happening is that these roles and role bindings started to come twice as attachments in both the category. Since these were coming as observed resources in both categories but we were sending them in desired resources only once, metac was deleting it and recreating it.
In order to avoid this scenario, we are only making use of apiVersion: rbac.authorization.k8s.io/v1beta1 as of now for all the cluster roles and cluster role bindings.
Issue link: https://github.com/mayadata-io/oep/issues/285
Signed-off-by: sagarkrsd sagar.kumar@mayadata.io