Kubernetes RabbitMQ operator https://github.com/tekliner/rabbitmq-operator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
1.1 KiB

  1. package rabbitmq
  2. import (
  3. "github.com/go-logr/logr"
  4. "k8s.io/api/policy/v1beta1"
  5. "reflect"
  6. )
  7. func reconcilePdb(reqLogger logr.Logger, foundPdb v1beta1.PodDisruptionBudget, newPdb v1beta1.PodDisruptionBudget) (bool, v1beta1.PodDisruptionBudget) {
  8. reconcileRequired := false
  9. if !reflect.DeepEqual(foundPdb.Spec.Selector, newPdb.Spec.Selector) {
  10. reqLogger.Info("Selectors not deep equal", "Pdb.Namespace", &newPdb.Namespace, "Pdb.Name", &newPdb.Name)
  11. foundPdb.Spec.Selector = newPdb.Spec.Selector
  12. reconcileRequired = true
  13. }
  14. if !reflect.DeepEqual(foundPdb.Spec.MaxUnavailable, newPdb.Spec.MaxUnavailable) {
  15. reqLogger.Info("MaxUnavailable not deep equal", "Pdb.Namespace", &newPdb.Namespace, "Pdb.Name", &newPdb.Name)
  16. foundPdb.Spec.MaxUnavailable = newPdb.Spec.MaxUnavailable
  17. reconcileRequired = true
  18. }
  19. if !reflect.DeepEqual(foundPdb.Spec.MinAvailable, newPdb.Spec.MinAvailable) {
  20. reqLogger.Info("MinAvailable not deep equal", "Pdb.Namespace", &newPdb.Namespace, "Pdb.Name", &newPdb.Name)
  21. foundPdb.Spec.MinAvailable = newPdb.Spec.MinAvailable
  22. reconcileRequired = true
  23. }
  24. return reconcileRequired, foundPdb
  25. }