• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zalando / postgres-operator / 15137696373

20 May 2025 12:36PM UTC coverage: 45.498%. Remained the same
15137696373

Pull #2915

github

web-flow
Merge ad9c4b987 into 68c4b4963
Pull Request #2915: [UI] Remove deprecated WAL-E library and enable WAL-G backup support in UI backend

7024 of 15438 relevant lines covered (45.5%)

29.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pkg/controller/pod.go
1
package controller
2

3
import (
4
        "context"
5

6
        v1 "k8s.io/api/core/v1"
7
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8
        "k8s.io/apimachinery/pkg/runtime"
9
        "k8s.io/apimachinery/pkg/watch"
10

11
        "github.com/zalando/postgres-operator/pkg/cluster"
12
        "github.com/zalando/postgres-operator/pkg/spec"
13
        "github.com/zalando/postgres-operator/pkg/util"
14
        "k8s.io/apimachinery/pkg/types"
15
)
16

17
func (c *Controller) podListFunc(options metav1.ListOptions) (runtime.Object, error) {
×
18
        opts := metav1.ListOptions{
×
19
                Watch:           options.Watch,
×
20
                ResourceVersion: options.ResourceVersion,
×
21
                TimeoutSeconds:  options.TimeoutSeconds,
×
22
        }
×
23

×
24
        return c.KubeClient.Pods(c.opConfig.WatchedNamespace).List(context.TODO(), opts)
×
25
}
×
26

27
func (c *Controller) podWatchFunc(options metav1.ListOptions) (watch.Interface, error) {
×
28
        opts := metav1.ListOptions{
×
29
                Watch:           options.Watch,
×
30
                ResourceVersion: options.ResourceVersion,
×
31
                TimeoutSeconds:  options.TimeoutSeconds,
×
32
        }
×
33

×
34
        return c.KubeClient.Pods(c.opConfig.WatchedNamespace).Watch(context.TODO(), opts)
×
35
}
×
36

37
func (c *Controller) dispatchPodEvent(clusterName spec.NamespacedName, event cluster.PodEvent) {
×
38
        c.clustersMu.RLock()
×
39
        cluster, ok := c.clusters[clusterName]
×
40
        c.clustersMu.RUnlock()
×
41
        if ok {
×
42
                cluster.ReceivePodEvent(event)
×
43
        }
×
44
}
45

46
func (c *Controller) podAdd(obj interface{}) {
×
47
        if pod, ok := obj.(*v1.Pod); ok {
×
48
                c.preparePodEventForDispatch(pod, nil, cluster.PodEventAdd)
×
49
        }
×
50
}
51

52
func (c *Controller) podUpdate(prev, cur interface{}) {
×
53
        prevPod, ok := prev.(*v1.Pod)
×
54
        if !ok {
×
55
                return
×
56
        }
×
57

58
        curPod, ok := cur.(*v1.Pod)
×
59
        if !ok {
×
60
                return
×
61
        }
×
62

63
        c.preparePodEventForDispatch(curPod, prevPod, cluster.PodEventUpdate)
×
64
}
65

66
func (c *Controller) podDelete(obj interface{}) {
×
67

×
68
        if pod, ok := obj.(*v1.Pod); ok {
×
69
                c.preparePodEventForDispatch(pod, nil, cluster.PodEventDelete)
×
70
        }
×
71
}
72

73
func (c *Controller) preparePodEventForDispatch(curPod, prevPod *v1.Pod, event cluster.PodEventType) {
×
74
        podEvent := cluster.PodEvent{
×
75
                PodName:         types.NamespacedName(util.NameFromMeta(curPod.ObjectMeta)),
×
76
                CurPod:          curPod,
×
77
                PrevPod:         prevPod,
×
78
                EventType:       event,
×
79
                ResourceVersion: curPod.ResourceVersion,
×
80
        }
×
81

×
82
        c.dispatchPodEvent(c.podClusterName(curPod), podEvent)
×
83
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc