Added possibility to add custom annotations to LoadBalancer service. (#461)

* Added possibility to add custom annotations to LoadBalancer service.
This commit is contained in:
Armin Nesiren
2019-01-25 11:35:27 +01:00
committed by Sergey Dudoladov
parent 9c7558816c
commit 6f6a599c90
8 changed files with 23 additions and 3 deletions
+7
View File
@@ -1093,6 +1093,13 @@ func (c *Cluster) generateService(role PostgresRole, spec *acidv1.PostgresSpec)
constants.ZalandoDNSNameAnnotation: dnsName,
constants.ElbTimeoutAnnotationName: constants.ElbTimeoutAnnotationValue,
}
if len(c.OpConfig.CustomServiceAnnotations) != 0 {
c.logger.Debugf("There are custom annotations defined, creating them.")
for customAnnotationKey, customAnnotationValue := range c.OpConfig.CustomServiceAnnotations {
annotations[customAnnotationKey] = customAnnotationValue
}
}
} else if role == Replica {
// before PR #258, the replica service was only created if allocated a LB
// now we always create the service but warn if the LB is absent