Skip to content

Commit

Permalink
Merge pull request #278 from gocardless/rnaveiras-theatre-resources
Browse files Browse the repository at this point in the history
Wait for theatre resources to be ready
  • Loading branch information
rnaveiras committed Jun 13, 2023
2 parents fe64dae + f4443bc commit 4f0964c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmd/acceptance/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bytes"
"context"
"fmt"
stdlog "log"
"os"
Expand Down Expand Up @@ -134,12 +135,19 @@ func main() {
}

logger.Log("msg", "waiting for setup resources to run")
contextTimeout := 3 * time.Minute
ctx, deadline := context.WithTimeout(ctx, contextTimeout)
defer deadline()
waitCmd := exec.CommandContext(ctx, "kubectl", "--context", fmt.Sprintf("kind-%s", *clusterName), "wait", "--all-namespaces", "--for", "condition=Ready", "pods", "--all", "--timeout", "2m")

if err := pipeOutput(waitCmd).Run(); err != nil {
app.Fatalf("not all setup resources are running: %v", err)
}

if ctx.Err() == context.DeadlineExceeded {
app.Fatalf("context deadline: no all setup resources are running: %v", err)
}

logger.Log("msg", "generating theatre manifests")
manifests, err := exec.CommandContext(ctx, "kustomize", "build", "config/acceptance").Output()
if err != nil {
Expand All @@ -154,6 +162,19 @@ func main() {
app.Fatalf("failed to install theatre manifests into cluster: %v", err)
}

logger.Log("msg", "waiting for Theatre resources are running")
ctx, deadline = context.WithTimeout(ctx, contextTimeout)
defer deadline()
waitCmd = exec.CommandContext(ctx, "kubectl", "--context", fmt.Sprintf("kind-%s", *clusterName), "wait", "--all-namespaces", "--for", "condition=Ready", "pods", "--all", "--timeout", "2m")

if err := pipeOutput(waitCmd).Run(); err != nil {
app.Fatalf("not all theatre resources are running: %v", err)
}

if ctx.Err() == context.DeadlineExceeded {
app.Fatalf("context deadline: no all theatre resources are running: %v", err)
}

cfg := mustClusterConfig()

for _, runner := range Runners {
Expand Down
3 changes: 3 additions & 0 deletions config/acceptance/overlays/rbac-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ spec:
args:
- --no-google # disable Google for acceptance tests
- --metrics-address=0.0.0.0
resources:
requests:
cpu: "100m"
3 changes: 3 additions & 0 deletions config/acceptance/overlays/vault-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ spec:
args:
- --theatre-image=$(THEATRE_IMAGE)
- --metrics-address=0.0.0.0
resources:
requests:
cpu: "100m"
3 changes: 3 additions & 0 deletions config/acceptance/overlays/workloads-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ spec:
- name: manager
image: theatre:latest
imagePullPolicy: Never
resources:
requests:
cpu: "100m"

0 comments on commit 4f0964c

Please sign in to comment.