postgres-operator keeps removing service controller managed fields on services or fields that are automatically added with default values by Kubernetes. For example, it keeps removing the following:
spec.healthCheckNodePort
spec.clusterIP
spec.clusterIPs
spec.ports[].protocol
spec.ports[].nodePort
spec.ipFamilies
spec.ipFamilyPolicy
spec.allocateLoadBalancerNodePorts
spec.internalTrafficPolicy
spec.sessionAffinity
Some of these fields are very important for services of type LoadBalancer. In my use case, I use OpenStack to manage my load balancers and my service has a Local externalTrafficPolicy which requires the use of health monitors. The health monitor is based on the healthCheckNodePort field which keeps getting removed by the operator. The OpenStack cloud controller manager detects the removal of the field, which then removes the monitor_port in the load balancer making it unable to work. The field healthCheckNodePort is then automatically added back but the OpenStack cloud controller manager sometimes does not update the LB which is now stuck offline. This very situation is probably an issue on their side or on my deployment but I don't think the field should be removed at all from the beginning.
The following is an example of the operator detecting the changes and removing fields.
After reading through the code I realized I'm probably being misled by the diff in the logs but the operator does not actually delete any field since it's doing merge patches on service spec.
Hello,
postgres-operator keeps removing service controller managed fields on services or fields that are automatically added with default values by Kubernetes. For example, it keeps removing the following:
spec.healthCheckNodePort
spec.clusterIP
spec.clusterIPs
spec.ports[].protocol
spec.ports[].nodePort
spec.ipFamilies
spec.ipFamilyPolicy
spec.allocateLoadBalancerNodePorts
spec.internalTrafficPolicy
spec.sessionAffinity
Some of these fields are very important for services of type LoadBalancer. In my use case, I use OpenStack to manage my load balancers and my service has a Local externalTrafficPolicy which requires the use of health monitors. The health monitor is based on the
healthCheckNodePort
field which keeps getting removed by the operator. The OpenStack cloud controller manager detects the removal of the field, which then removes the monitor_port in the load balancer making it unable to work. The fieldhealthCheckNodePort
is then automatically added back but the OpenStack cloud controller manager sometimes does not update the LB which is now stuck offline. This very situation is probably an issue on their side or on my deployment but I don't think the field should be removed at all from the beginning.The following is an example of the operator detecting the changes and removing fields.