Skip to content

Commit a8e04e9

Browse files
committed
[backplane] preload + default to the latest envoy image
1 parent 40cfa08 commit a8e04e9

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

ci/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,15 @@ func (m *ApoxyCli) BuildBackplane(
287287
WithFile("/bin/backplane", builder.File(bpOut)).
288288
WithFile("/bin/dial-stdio", builder.File(dsOut)).
289289
WithFile("/bin/edge-runtime", runtimeCtr.File("/usr/local/bin/edge-runtime")).
290+
WithExec([]string{
291+
"/bin/backplane",
292+
"--project_id=apoxy",
293+
"--proxy=apoxy",
294+
"--replica=apoxy",
295+
"--apiserver_addr=localhost:8443",
296+
"--use_envoy_contrib=true",
297+
"--download_envoy_only=true",
298+
}).
290299
WithEntrypoint([]string{"/bin/backplane"})
291300
}
292301

cmd/backplane/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ var (
6060
proxyName = flag.String("proxy", "", "Name of the Proxy to manage. Must not be used with --proxy_path.")
6161
replicaName = flag.String("replica", os.Getenv("HOSTNAME"), "Name of the replica to manage.")
6262
envoyReleaseURL = flag.String("envoy_release_url", "", "URL to the Envoy release tarball.")
63+
downloadEnvoy = flag.Bool("download_envoy_only", false, "Whether to just download Envoy from the release URL and exit.")
6364

6465
devMode = flag.Bool("dev", false, "Enable development mode.")
6566

@@ -290,6 +291,12 @@ func main() {
290291
apiServerHost,
291292
proxyOpts...,
292293
)
294+
if *downloadEnvoy {
295+
if err := pctrl.DownloadEnvoy(ctx); err != nil {
296+
log.Fatalf("Failed to download Envoy: %v", err)
297+
}
298+
os.Exit(0)
299+
}
293300
if err := pctrl.SetupWithManager(ctx, mgr); err != nil {
294301
log.Fatalf("failed to set up Backplane controller: %v", err)
295302
}

pkg/backplane/controllers/proxy.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,29 @@ func (r *ProxyReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager
491491
Complete(r)
492492
}
493493

494+
func (r *ProxyReconciler) DownloadEnvoy(ctx context.Context) error {
495+
opts := []envoy.Option{
496+
envoy.WithGoPluginDir(r.options.goPluginDir),
497+
}
498+
if r.options.releaseURL != "" {
499+
opts = append(opts, envoy.WithRelease(&envoy.URLRelease{
500+
URL: r.options.releaseURL,
501+
}))
502+
} else {
503+
opts = append(opts, envoy.WithRelease(&envoy.GitHubRelease{
504+
Contrib: r.options.useEnvoyContrib,
505+
}))
506+
}
507+
508+
if err := r.Runtime.Start(ctx, opts...); err != nil {
509+
return fmt.Errorf("failed to start Envoy runtime: %w", err)
510+
}
511+
if err := r.Runtime.Shutdown(ctx); err != nil {
512+
return fmt.Errorf("failed to shutdown Envoy runtime: %w", err)
513+
}
514+
return nil
515+
}
516+
494517
func (r *ProxyReconciler) Shutdown(ctx context.Context, reason string) {
495518
var wg sync.WaitGroup
496519
wg.Add(2)

pkg/backplane/drivers/docker.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
"github.com/apoxy-dev/apoxy-cli/build"
1414
"github.com/apoxy-dev/apoxy-cli/pkg/log"
15-
"github.com/apoxy-dev/apoxy-cli/pkg/utils"
1615
dockerutils "github.com/apoxy-dev/apoxy-cli/pkg/utils/docker"
1716
)
1817

@@ -133,7 +132,6 @@ func (d *dockerDriver) Start(
133132
"--proxy=" + proxyName,
134133
"--replica=" + proxyName,
135134
"--apiserver_addr=" + net.JoinHostPort(apiServerHost, "8443"),
136-
"--envoy_release_url=https://apoxy-envoy-releases.s3.us-west-2.amazonaws.com/envoy-contrib-dev-cfedcdbc0bf1e687d0fc2ad243e7277ed004673d-" + utils.HostArch(),
137135
"--use_envoy_contrib=true",
138136
}...)
139137
cmd.Args = append(cmd.Args, setOpts.Args...)

0 commit comments

Comments
 (0)