Skip to content
Draft
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
2 changes: 0 additions & 2 deletions controller/controlplane/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to create manager config: %w", err)
}
mgrCfg.DisableRunningDiagnosticsServer = true
if err := r.scheduleInstance(ctx, logger, mgrID, mgrCfg); err != nil {
return r.handleScheduleInstanceOutcome(ctx, logger, cp, err)
}
Expand All @@ -403,7 +402,6 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to create manager config: %w", err)
}
mgrCfg.DisableRunningDiagnosticsServer = true
hashFromSpec, errSpec := managercfg.Hash(mgrCfg)
if errSpec != nil {
return ctrl.Result{}, fmt.Errorf("failed to hash ControlPlane config options: %w", errSpec)
Expand Down
20 changes: 0 additions & 20 deletions ingress-controller/internal/manager/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ type Manager struct {
cfg managercfg.Config
m manager.Manager
synchronizer *dataplane.Synchronizer
diagnosticsServer mo.Option[diagnostics.Server]
diagnosticsCollector mo.Option[*diagnostics.Collector]
diagnosticsHandler mo.Option[*diagnostics.HTTPHandler]
admissionServer mo.Option[*admission.Server]
Expand Down Expand Up @@ -477,22 +476,12 @@ func (m *Manager) setupDiagnostics(
return mo.None[diagnostics.Client]()
}

var serverOpts []diagnostics.ServerOption
// If config dumps are enabled, we need to create a diagnostics collector, setup an HTTP handler exposing its
// diagnostics, and pass it to the server options so it's plugged in.
if c.EnableConfigDumps {
diagnosticsCollector := diagnostics.NewCollector(logger, c)
m.diagnosticsCollector = mo.Some(diagnosticsCollector)
m.diagnosticsHandler = mo.Some(diagnostics.NewConfigDiagnosticsHTTPHandler(diagnosticsCollector, c.DumpSensitiveConfig))
serverOpts = append(serverOpts, diagnostics.WithConfigDiagnostics(m.diagnosticsHandler.MustGet()))
}

if !c.DisableRunningDiagnosticsServer {
m.diagnosticsServer = mo.Some(diagnostics.NewServer(logger, diagnostics.ServerConfig{
ProfilingEnabled: c.EnableProfiling,
DumpSensitiveConfig: c.DumpSensitiveConfig,
ListenerPort: c.DiagnosticServerPort,
}, serverOpts...))
}

// If diagnosticsCollector is set, it means that config dumps are enabled and we should return a diagnostics.Client.
Expand All @@ -509,15 +498,6 @@ func (m *Manager) Run(ctx context.Context) error {
logger := ctrl.LoggerFrom(ctx)
logger.Info("Starting manager")

if ds, ok := m.diagnosticsServer.Get(); ok {
go func() {
logger.Info("Starting diagnostics server")
if err := ds.Listen(ctx); err != nil {
logger.Error(err, "Diagnostics server exited")
}
}()
}

if dc, ok := m.diagnosticsCollector.Get(); ok {
go func() {
logger.Info("Starting diagnostics collector")
Expand Down
3 changes: 0 additions & 3 deletions ingress-controller/pkg/manager/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ type Config struct {
EnableConfigDumps bool
DumpSensitiveConfig bool
DiagnosticServerPort int
// TODO: https://github.com/Kong/kubernetes-ingress-controller/issues/7285
// instead of this toggle, move the server out of the internal.Manager
DisableRunningDiagnosticsServer bool

// EnableDrainSupport controls whether to include terminating endpoints in Kong upstreams
// with weight=0 for graceful connection draining
Expand Down
1 change: 0 additions & 1 deletion ingress-controller/test/envtest/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ func WithDiagnosticsServer(port int) func(cfg *managercfg.Config) {
func WithDiagnosticsWithoutServer() func(cfg *managercfg.Config) {
return func(cfg *managercfg.Config) {
cfg.EnableConfigDumps = true
cfg.DisableRunningDiagnosticsServer = true
}
}

Expand Down
Loading