Skip to content

Commit

Permalink
Metrics service only target the default shard
Browse files Browse the repository at this point in the history
  • Loading branch information
manno committed Apr 23, 2024
1 parent dceb784 commit 436a81d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
3 changes: 3 additions & 0 deletions charts/fleet/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ spec:
labels:
app: fleet-controller
shard: "{{ . }}"
{{- if empty . }}
shard-default: "true"
{{- end }}
spec:
containers:
- env:
Expand Down
1 change: 1 addition & 0 deletions e2e/assets/metrics/fleetcontroller_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
spec:
selector:
app: fleet-controller
shard-default: "true"
ports:
- protocol: TCP
port: {{ .Port }}
Expand Down
30 changes: 15 additions & 15 deletions e2e/metrics/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ var (
)

func setupLoadBalancer() {
rs := rand.NewSource(time.Now().UnixNano())
port := rs.Int63()%1000 + 30000
loadBalancerName = testenv.AddRandomSuffix("fleetcontroller", rs)

ks := k.Namespace("cattle-fleet-system")
err := testenv.ApplyTemplate(
ks,
testenv.AssetPath("metrics/fleetcontroller_service.yaml"),
map[string]interface{}{
"Name": loadBalancerName,
"Port": port,
},
)
Expect(err).ToNot(HaveOccurred())

if os.Getenv("METRICS_URL") != "" {
metricsURL = os.Getenv("METRICS_URL")
} else {
rs := rand.NewSource(time.Now().UnixNano())
port := rs.Int63()%1000 + 30000
loadBalancerName = testenv.AddRandomSuffix("fleetcontroller", rs)

ks := k.Namespace("cattle-fleet-system")
err := testenv.ApplyTemplate(
ks,
testenv.AssetPath("metrics/fleetcontroller_service.yaml"),
map[string]interface{}{
"Name": loadBalancerName,
"Port": port,
},
)
Expect(err).ToNot(HaveOccurred())

Eventually(func() (string, error) {
ip, err := ks.Get(
"service", loadBalancerName,
Expand Down

0 comments on commit 436a81d

Please sign in to comment.