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

fix(kuma-cp) Kuma CP restart may cause stale Envoy configs on Universal #1749

Merged
merged 4 commits into from
Apr 8, 2021
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
5 changes: 0 additions & 5 deletions api/go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403 h1:cqQfy1jclcSy/FwLjemeg3SR1yaINm74aQyupQ0Bl8M=
Expand All @@ -14,9 +13,7 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/envoyproxy/protoc-gen-validate v0.5.0 h1:+ltcA/hEtDde/2Z+9EvwamSsAzPNE6z17oSOChokJzU=
github.com/envoyproxy/protoc-gen-validate v0.5.0/go.mod h1:xL5IroIBOR+aTp0IZk48epGwBV3+LcuaosPL0pr0hE0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
Expand Down Expand Up @@ -147,10 +144,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
61 changes: 0 additions & 61 deletions go.sum

Large diffs are not rendered by default.

89 changes: 45 additions & 44 deletions pkg/core/runtime/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,28 @@ var _ BuilderContext = &Builder{}

// Builder represents a multi-step initialization process.
type Builder struct {
cfg kuma_cp.Config
cm component.Manager
rs core_store.ResourceStore
ss store.SecretStore
cs core_store.ResourceStore
rm core_manager.ResourceManager
rom core_manager.ReadOnlyResourceManager
cam core_ca.Managers
dsl datasource.Loader
ext context.Context
dns resolver.DNSResolver
configm config_manager.ConfigManager
leadInfo component.LeaderInfo
lif lookup.LookupIPFunc
eac admin.EnvoyAdminClient
metrics metrics.Metrics
erf events.ListenerFactory
apim api_server.APIManager
xdsh *xds_hooks.Hooks
dps *dp_server.DpServer
kdsctx *kds_context.Context
closeCh <-chan struct{}
cfg kuma_cp.Config
cm component.Manager
rs core_store.ResourceStore
ss store.SecretStore
cs core_store.ResourceStore
rm core_manager.ResourceManager
rom core_manager.ReadOnlyResourceManager
cam core_ca.Managers
dsl datasource.Loader
ext context.Context
dns resolver.DNSResolver
configm config_manager.ConfigManager
leadInfo component.LeaderInfo
lif lookup.LookupIPFunc
eac admin.EnvoyAdminClient
metrics metrics.Metrics
erf events.ListenerFactory
apim api_server.APIManager
xdsh *xds_hooks.Hooks
dps *dp_server.DpServer
kdsctx *kds_context.Context
shutdownCh <-chan struct{}
*runtimeInfo
}

Expand All @@ -94,7 +94,7 @@ func BuilderFor(cfg kuma_cp.Config, closeCh <-chan struct{}) (*Builder, error) {
runtimeInfo: &runtimeInfo{
instanceId: fmt.Sprintf("%s-%s", hostname, suffix),
},
closeCh: closeCh,
shutdownCh: closeCh,
}, nil
}

Expand Down Expand Up @@ -260,25 +260,26 @@ func (b *Builder) Build() (Runtime, error) {
return &runtime{
RuntimeInfo: b.runtimeInfo,
RuntimeContext: &runtimeContext{
cfg: b.cfg,
rm: b.rm,
rom: b.rom,
rs: b.rs,
ss: b.ss,
cam: b.cam,
dsl: b.dsl,
ext: b.ext,
dns: b.dns,
configm: b.configm,
leadInfo: b.leadInfo,
lif: b.lif,
eac: b.eac,
metrics: b.metrics,
erf: b.erf,
apim: b.apim,
xdsh: b.xdsh,
dps: b.dps,
kdsctx: b.kdsctx,
cfg: b.cfg,
rm: b.rm,
rom: b.rom,
rs: b.rs,
ss: b.ss,
cam: b.cam,
dsl: b.dsl,
ext: b.ext,
dns: b.dns,
configm: b.configm,
leadInfo: b.leadInfo,
lif: b.lif,
eac: b.eac,
metrics: b.metrics,
erf: b.erf,
apim: b.apim,
xdsh: b.xdsh,
dps: b.dps,
kdsctx: b.kdsctx,
shutdownCh: b.shutdownCh,
},
Manager: b.cm,
}, nil
Expand Down Expand Up @@ -344,6 +345,6 @@ func (b *Builder) DpServer() *dp_server.DpServer {
func (b *Builder) KDSContext() *kds_context.Context {
return b.kdsctx
}
func (b *Builder) CloseCh() <-chan struct{} {
return b.closeCh
func (b *Builder) ShutdownCh() <-chan struct{} {
return b.shutdownCh
}
46 changes: 26 additions & 20 deletions pkg/core/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type RuntimeContext interface {
XDSHooks() *xds_hooks.Hooks
DpServer() *dp_server.DpServer
KDSContext() *kds_context.Context
ShutdownCh() <-chan struct{}
}

var _ Runtime = &runtime{}
Expand Down Expand Up @@ -100,26 +101,27 @@ func (i *runtimeInfo) GetClusterId() string {
var _ RuntimeContext = &runtimeContext{}

type runtimeContext struct {
cfg kuma_cp.Config
rm core_manager.ResourceManager
rs core_store.ResourceStore
ss store.SecretStore
cs core_store.ResourceStore
rom core_manager.ReadOnlyResourceManager
cam ca.Managers
dsl datasource.Loader
ext context.Context
dns resolver.DNSResolver
configm config_manager.ConfigManager
leadInfo component.LeaderInfo
lif lookup.LookupIPFunc
eac admin.EnvoyAdminClient
metrics metrics.Metrics
erf events.ListenerFactory
apim api_server.APIInstaller
xdsh *xds_hooks.Hooks
dps *dp_server.DpServer
kdsctx *kds_context.Context
cfg kuma_cp.Config
rm core_manager.ResourceManager
rs core_store.ResourceStore
ss store.SecretStore
cs core_store.ResourceStore
rom core_manager.ReadOnlyResourceManager
cam ca.Managers
dsl datasource.Loader
ext context.Context
dns resolver.DNSResolver
configm config_manager.ConfigManager
leadInfo component.LeaderInfo
lif lookup.LookupIPFunc
eac admin.EnvoyAdminClient
metrics metrics.Metrics
erf events.ListenerFactory
apim api_server.APIInstaller
xdsh *xds_hooks.Hooks
dps *dp_server.DpServer
kdsctx *kds_context.Context
shutdownCh <-chan struct{}
}

func (rc *runtimeContext) Metrics() metrics.Metrics {
Expand Down Expand Up @@ -200,3 +202,7 @@ func (rc *runtimeContext) XDSHooks() *xds_hooks.Hooks {
func (rc *runtimeContext) KDSContext() *kds_context.Context {
return rc.kdsctx
}

func (rc *runtimeContext) ShutdownCh() <-chan struct{} {
return rc.shutdownCh
}
2 changes: 1 addition & 1 deletion pkg/plugins/bootstrap/k8s/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (p *plugin) BeforeBootstrap(b *core_runtime.Builder, _ core_plugins.PluginC
return err
}

secretClient, err := secretClient(b.Config().Store.Kubernetes.SystemNamespace, config, scheme, mgr.GetRESTMapper(), b.CloseCh())
secretClient, err := secretClient(b.Config().Store.Kubernetes.SystemNamespace, config, scheme, mgr.GetRESTMapper(), b.ShutdownCh())
if err != nil {
return err
}
Expand Down
Loading