Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[installer] Run the toxic-config component as a sidecar in the Toxiproxy pod #14488

Merged
merged 3 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions install/installer/cmd/testdata/render/aws-setup/output.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions install/installer/cmd/testdata/render/gcp-setup/output.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions install/installer/cmd/testdata/render/minimal/output.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions install/installer/cmd/testdata/render/shortname/output.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions install/installer/cmd/testdata/render/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ components:
version: test
serviceWaiter:
version: test
toxic-config:
version: test
usage:
version: test
workspace:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion install/installer/pkg/components/toxiproxy/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
)

const (
proxyName = "mysql"
configFilename = "toxiproxy.json"
)

Expand All @@ -29,7 +30,7 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {

txcfg := []ToxiproxyConfig{
{
Name: "mysql",
Name: proxyName,
Listen: fmt.Sprintf("[::]:%d", dbPort),
Upstream: fmt.Sprintf("%s:%d", dbHost, dbPort),
Enabled: true,
Expand Down
1 change: 1 addition & 0 deletions install/installer/pkg/components/toxiproxy/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package toxiproxy

const (
Component = "toxiproxy"
ConfigComponent = "toxic-config"
HttpPortName = "http"
HttpContainerPort = 8474
HttpServicePort = 8474
Expand Down
10 changes: 10 additions & 0 deletions install/installer/pkg/components/toxiproxy/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package toxiproxy

import (
"fmt"
"path/filepath"

"github.com/gitpod-io/gitpod/installer/pkg/cluster"
Expand Down Expand Up @@ -102,6 +103,15 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
},
Env: common.CustomizeEnvvar(ctx, Component, common.MergeEnv(common.DefaultEnv(&ctx.Config))),
VolumeMounts: volumeMounts,
}, {
Name: "toxic-config",
Image: ctx.ImageName(ctx.Config.Repository, ConfigComponent, ctx.VersionManifest.Components.ToxicConfig.Version),
Args: []string{
fmt.Sprintf("--proxy=%s", proxyName),
"--latency=1000",
"--jitter=250",
"--wait=true",
},
},
*common.KubeRBACProxyContainerWithConfig(ctx),
},
Expand Down
5 changes: 4 additions & 1 deletion install/installer/pkg/components/toxiproxy/objects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ func renderContextWithSlowDatabaseEnabled(t *testing.T) *common.RenderContext {
SlowDatabase: true,
},
},
}, versions.Manifest{}, "test-namespace")
}, versions.Manifest{
Version: "test",
Components: versions.Components{ToxicConfig: versions.Versioned{Version: "test"}},
}, "test-namespace")
require.NoError(t, err)

return ctx
Expand Down
1 change: 1 addition & 0 deletions install/installer/pkg/config/versions/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type Components struct {
RegistryFacade Versioned `json:"registryFacade"`
Server Versioned `json:"server"`
ServiceWaiter Versioned `json:"serviceWaiter"`
ToxicConfig Versioned `json:"toxic-config"`
Usage Versioned `json:"usage"`
Workspace struct {
CodeImage Versioned `json:"codeImage"`
Expand Down