mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-20 12:31:08 +02:00
Support inherited annotations for all major objects (#1236)
* add comments where inherited annotations could be added * add inheritedAnnotations feature * return nil if no annotations are set * minor changes * first downscaler then inherited annotations * add unit test for inherited annotations * add pvc to test + minor changes * missing comma * fix nil map assignment * set annotations in the same order it is done in other places * replace acidClientSet with acid getters in K8s client * more fixes on clientSet vs getters * minor changes * remove endpoints from annotation test * refine unit test - but deployment and sts are still empty * fix checkinng sts and deployment * make annotations setter one liners * no need for len check anymore Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de>
This commit is contained in:
co-authored by
Rafia Sabih
parent
549f71bb49
commit
6a97316a69
@@ -271,6 +271,33 @@ func (c *Cluster) getTeamMembers(teamID string) ([]string, error) {
|
||||
return members, nil
|
||||
}
|
||||
|
||||
// Returns annotations to be passed to child objects
|
||||
func (c *Cluster) annotationsSet(annotations map[string]string) map[string]string {
|
||||
|
||||
if annotations == nil {
|
||||
annotations = make(map[string]string)
|
||||
}
|
||||
|
||||
pgCRDAnnotations := c.ObjectMeta.Annotations
|
||||
|
||||
// allow to inherit certain labels from the 'postgres' object
|
||||
if pgCRDAnnotations != nil {
|
||||
for k, v := range pgCRDAnnotations {
|
||||
for _, match := range c.OpConfig.InheritedAnnotations {
|
||||
if k == match {
|
||||
annotations[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(annotations) > 0 {
|
||||
return annotations
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) waitForPodLabel(podEvents chan PodEvent, stopChan chan struct{}, role *PostgresRole) (*v1.Pod, error) {
|
||||
timeout := time.After(c.OpConfig.PodLabelWaitTimeout)
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user