Skip to content

Commit 9ac596d

Browse files
committed
Merge branch '3.6' into 3.6-main
2 parents 3a99a4d + dfde44a commit 9ac596d

File tree

16 files changed

+524
-229
lines changed

16 files changed

+524
-229
lines changed

.github/workflows/docs-sphinx-python-dependency-build-checks.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
# succeed.
1212
name: Check and document build requirements for Sphinx venv
1313
on:
14-
- push
15-
- pull_request
16-
- workflow_dispatch
14+
schedule:
15+
- cron: "0 2 * * 1,5" # Runs at 02:00 AM on every Monday and Friday.
16+
workflow_dispatch:
17+
1718

1819
concurrency:
1920
group: ${{ github.workflow }}-${{ github.ref }}
@@ -22,7 +23,7 @@ concurrency:
2223
jobs:
2324
build:
2425
name: build
25-
runs-on: ubuntu-latest
26+
runs-on: [linux, self-hosted, x64, large, jammy]
2627
steps:
2728
- name: Checkout code
2829
uses: actions/checkout@v4

cmd/containeragent/unit/manifolds.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import (
5757
"github.com/juju/juju/internal/worker/uniter"
5858
"github.com/juju/juju/internal/worker/units3caller"
5959
"github.com/juju/juju/internal/worker/upgradestepsmachine"
60+
"github.com/juju/juju/worker/caasprobebinder"
6061
)
6162

6263
// manifoldsConfig allows specialisation of the result of Manifolds.
@@ -333,15 +334,17 @@ func Manifolds(config manifoldsConfig) dependency.Manifolds {
333334

334335
// Kubernetes probe handler responsible for reporting status for
335336
// Kubernetes probes
336-
caasProberName: ifNotDead(caasprober.Manifold(caasprober.ManifoldConfig{
337+
caasProberName: caasprober.Manifold(caasprober.ManifoldConfig{
337338
MuxName: probeHTTPServerName,
338-
Providers: []string{
339-
uniterName,
340-
},
339+
}),
340+
341+
caasUniterProberBinderName: ifNotDead(caasprobebinder.Manifold(caasprobebinder.ManifoldConfig{
342+
ProberName: caasProberName,
343+
ProbeProviderNames: []string{uniterName},
341344
})),
342345

343-
caasZombieProberName: ifDead(caasprober.Manifold(caasprober.ManifoldConfig{
344-
MuxName: probeHTTPServerName,
346+
caasZombieProberBinderName: ifDead(caasprobebinder.Manifold(caasprobebinder.ManifoldConfig{
347+
ProberName: caasProberName,
345348
DefaultProviders: map[string]probe.ProbeProvider{
346349
"zombie-readiness": probe.ReadinessProvider(probe.Failure),
347350
},
@@ -479,9 +482,10 @@ const (
479482
migrationInactiveFlagName = "migration-inactive-flag"
480483
migrationMinionName = "migration-minion"
481484

482-
caasProberName = "caas-prober"
483-
caasZombieProberName = "caas-zombie-prober"
484-
probeHTTPServerName = "probe-http-server"
485+
caasProberName = "caas-prober"
486+
caasZombieProberBinderName = "caas-zombie-prober-binder"
487+
caasUniterProberBinderName = "caas-unit-prober-binder"
488+
probeHTTPServerName = "probe-http-server"
485489

486490
proxyConfigUpdaterName = "proxy-config-updater"
487491
loggingConfigUpdaterName = "logging-config-updater"

cmd/containeragent/unit/manifolds_test.go

Lines changed: 55 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,36 @@ func (s *ManifoldsSuite) TestManifoldNames(c *gc.C) {
3636
manifolds := unit.Manifolds(config)
3737
expectedKeys := []string{
3838
"agent",
39-
"api-config-watcher",
39+
"api-address-updater",
4040
"api-caller",
41-
"s3-caller",
42-
"uniter",
43-
"log-sender",
44-
41+
"api-config-watcher",
42+
"caas-prober",
43+
"caas-unit-termination-worker",
44+
"caas-unit-prober-binder",
45+
"caas-units-manager",
46+
"caas-zombie-prober-binder",
4547
"charm-dir",
46-
"leadership-tracker",
48+
"dead-flag",
4749
"hook-retry-strategy",
48-
50+
"leadership-tracker",
51+
"log-sender",
52+
"logging-config-updater",
4953
"migration-fortress",
5054
"migration-inactive-flag",
5155
"migration-minion",
52-
53-
"proxy-config-updater",
54-
"logging-config-updater",
55-
"api-address-updater",
56-
57-
"caas-prober",
56+
"not-dead-flag",
5857
"probe-http-server",
59-
60-
"upgrader",
61-
"upgrade-steps-runner",
62-
"upgrade-steps-gate",
63-
"upgrade-steps-flag",
64-
65-
"caas-unit-termination-worker",
66-
"caas-units-manager",
58+
"proxy-config-updater",
59+
"s3-caller",
6760
"secret-drain-worker",
68-
69-
"caas-zombie-prober",
70-
71-
"dead-flag",
72-
"not-dead-flag",
73-
7461
"signal-handler",
7562

7663
"trace",
64+
"uniter",
65+
"upgrade-steps-flag",
66+
"upgrade-steps-gate",
67+
"upgrade-steps-runner",
68+
"upgrader",
7769
}
7870
keys := make([]string, 0, len(manifolds))
7971
for k := range manifolds {
@@ -89,41 +81,35 @@ func (s *ManifoldsSuite) TestManifoldNamesColocatedController(c *gc.C) {
8981
manifolds := unit.Manifolds(config)
9082
expectedKeys := []string{
9183
"agent",
92-
"api-config-watcher",
9384
"api-caller",
94-
"s3-caller",
85+
"api-config-watcher",
9586
"caas-prober",
96-
"probe-http-server",
97-
"uniter",
98-
"log-sender",
99-
87+
"caas-unit-prober-binder",
88+
"caas-unit-termination-worker",
89+
"caas-units-manager",
90+
"caas-zombie-prober-binder",
10091
"charm-dir",
101-
"leadership-tracker",
92+
"dead-flag",
10293
"hook-retry-strategy",
103-
94+
"leadership-tracker",
95+
"log-sender",
96+
"logging-config-updater",
10497
"migration-fortress",
10598
"migration-inactive-flag",
10699
"migration-minion",
107-
100+
"not-dead-flag",
101+
"probe-http-server",
108102
"proxy-config-updater",
109-
"logging-config-updater",
110-
111-
"upgrader",
112-
"upgrade-steps-runner",
113-
"upgrade-steps-gate",
114-
"upgrade-steps-flag",
115-
116-
"caas-unit-termination-worker",
117-
"caas-units-manager",
103+
"s3-caller",
118104
"secret-drain-worker",
119-
"caas-zombie-prober",
120-
121-
"dead-flag",
122-
"not-dead-flag",
123-
124105
"signal-handler",
125106

126107
"trace",
108+
"uniter",
109+
"upgrade-steps-flag",
110+
"upgrade-steps-gate",
111+
"upgrade-steps-runner",
112+
"upgrader",
127113
}
128114
keys := make([]string, 0, len(manifolds))
129115
for k := range manifolds {
@@ -140,6 +126,7 @@ func (*ManifoldsSuite) TestMigrationGuards(c *gc.C) {
140126
"s3-caller",
141127
"caas-prober",
142128
"probe-http-server",
129+
"caas-unit-prober-binder",
143130
"log-sender",
144131

145132
"migration-fortress",
@@ -157,6 +144,7 @@ func (*ManifoldsSuite) TestMigrationGuards(c *gc.C) {
157144
"not-dead-flag",
158145
"signal-handler",
159146
"caas-zombie-prober",
147+
"caas-zombie-prober-binder",
160148

161149
"trace",
162150
)
@@ -289,14 +277,6 @@ var expectedUnitManifoldsWithDependencies = map[string][]string{
289277
},
290278
"probe-http-server": {},
291279
"caas-prober": {
292-
"agent",
293-
"api-caller",
294-
"api-config-watcher",
295-
"charm-dir",
296-
"hook-retry-strategy",
297-
"leadership-tracker",
298-
"migration-fortress",
299-
"migration-inactive-flag",
300280
"probe-http-server",
301281
"s3-caller",
302282
"uniter",
@@ -342,10 +322,26 @@ var expectedUnitManifoldsWithDependencies = map[string][]string{
342322
"api-config-watcher",
343323
"not-dead-flag",
344324
},
345-
"caas-zombie-prober": {
325+
"caas-unit-prober-binder": {
326+
"agent",
327+
"api-caller",
328+
"api-config-watcher",
329+
"caas-prober",
330+
"charm-dir",
331+
"hook-retry-strategy",
332+
"leadership-tracker",
333+
"migration-fortress",
334+
"migration-inactive-flag",
335+
"not-dead-flag",
336+
"probe-http-server",
337+
"s3-caller",
338+
"uniter",
339+
},
340+
"caas-zombie-prober-binder": {
346341
"agent",
347342
"api-caller",
348343
"api-config-watcher",
344+
"caas-prober",
349345
"dead-flag",
350346
"probe-http-server",
351347
},

internal/observability/probe/aggregate.go

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
package probe
55

66
import (
7+
"sync"
8+
79
"github.com/juju/errors"
810
)
911

@@ -12,9 +14,11 @@ import (
1214
// the probes fail.
1315
// Convenience NewAggregate() exists to initialise the map.
1416
type Aggregate struct {
15-
// Probes is a map of probes to run as part of this aggregate with the key
17+
mut sync.RWMutex
18+
19+
// probes is a map of probes to run as part of this aggregate with the key
1620
// corresponding to well known name for the probe.
17-
Probes map[string]Prober
21+
probes map[string]Prober
1822
}
1923

2024
// ProbeResultCallBack is a function signature for receiving the result of a
@@ -23,12 +27,27 @@ type ProbeResultCallback func(probeKey string, val bool, err error)
2327

2428
func NewAggregate() *Aggregate {
2529
return &Aggregate{
26-
Probes: make(map[string]Prober),
30+
probes: make(map[string]Prober),
31+
}
32+
}
33+
34+
func (a *Aggregate) AddProber(id string, p Prober) {
35+
a.mut.Lock()
36+
defer a.mut.Unlock()
37+
if a.probes == nil {
38+
a.probes = make(map[string]Prober)
2739
}
40+
a.probes[id] = p
41+
}
42+
43+
func (a *Aggregate) RemoveProber(id string) {
44+
a.mut.Lock()
45+
defer a.mut.Unlock()
46+
delete(a.probes, id)
2847
}
2948

3049
// Probe implements Prober Probe
31-
func (a *Aggregate) Probe() (bool, error) {
50+
func (a *Aggregate) Probe() (bool, int, error) {
3251
return a.ProbeWithResultCallback(ProbeResultCallback(func(_ string, _ bool, _ error) {}))
3352
}
3453

@@ -38,11 +57,14 @@ func (a *Aggregate) Probe() (bool, error) {
3857
// succeeding.
3958
func (a *Aggregate) ProbeWithResultCallback(
4059
cb ProbeResultCallback,
41-
) (bool, error) {
60+
) (bool, int, error) {
61+
a.mut.RLock()
62+
defer a.mut.RUnlock()
63+
4264
rval := true
4365
var errVal error
4466

45-
for name, p := range a.Probes {
67+
for name, p := range a.probes {
4668
val, err := p.Probe()
4769
cb(name, val, err)
4870
if err != nil && errVal == nil {
@@ -56,5 +78,5 @@ func (a *Aggregate) ProbeWithResultCallback(
5678
rval = rval && val
5779
}
5880

59-
return rval, errVal
81+
return rval, len(a.probes), errVal
6082
}

0 commit comments

Comments
 (0)