Skip to content
Closed
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
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ admission policy installation; once an Installation exists it is the authority o
UseV3CRDs: v3CRDs,
APIDiscovery: apiDiscovery,
Extensions: extensionRegistry,
Controllers: enterprise.Controllers(variant),
}

err = controller.AddToManager(mgr, options)
Expand Down
1 change: 1 addition & 0 deletions docs/principles.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ API design principles and the Go/kubebuilder coding conventions for `api/v1` CRD
## Variants

- **Core code is variant-blind.** Controllers and render packages outside `pkg/enterprise` must not name a variant, in code or in comments. Behavior a single variant needs registers through `pkg/extensions`.
- **A controller only one variant runs lives in `pkg/enterprise/controller`, and its render code in `pkg/enterprise/render`.** Both mirror the core tree they came from. The controller is contributed through the controller list on `ControllerOptions` rather than named by `AddToManager`, so it carries no variant check of its own.

## Security

Expand Down
42 changes: 0 additions & 42 deletions internal/controller/applicationlayer_controller.go

This file was deleted.

41 changes: 0 additions & 41 deletions internal/controller/authentication_controller.go

This file was deleted.

81 changes: 4 additions & 77 deletions internal/controller/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,90 +52,27 @@ func AddToManager(mgr ctrl.Manager, options options.ControllerOptions) error {
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "LogStorage", err)
}
if err := (&IntrusionDetectionReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("IntrusionDetection"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "IntrusionDetection", err)
}
if err := (&LogCollectorReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("LogCollector"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "LogCollector", err)
}
if err := (&IstioReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Istio"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller Istio: %v", err)
}
if err := (&ApplicationLayerReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("ApplicationLayer"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "ApplicationLayer", err)
}
if err := (&MonitorReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Monitor"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "Monitor", err)
}
if err := (&ManagerReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Manager"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "Manager", err)
}
if err := (&ManagementClusterConnectionReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("ManagementClusterConnection"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "ManagementClusterConnection", err)
}
if err := (&NonClusterHostReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("NonClusterHost"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "NonClusterHost", err)
}
if err := (&AuthenticationReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Authentication"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "Authentication", err)
}
if err := (&TiersReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Tiers"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "Tiers", err)
}
if err := (&PolicyRecommendationReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("PolicyRecommendation"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "PolicyRecommendation", err)
}
if err := (&EgressGatewayReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("EgressGateway"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "EgressGateway", err)
}
if err := (&SecretsReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Secrets"),
Expand All @@ -157,13 +94,6 @@ func AddToManager(mgr ctrl.Manager, options options.ControllerOptions) error {
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "CSR", err)
}
if err := (&PacketCaptureReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("PacketCapture"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "PacketCapture", err)
}
if err := (&GatewayAPIReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Expand Down Expand Up @@ -195,12 +125,9 @@ func AddToManager(mgr ctrl.Manager, options options.ControllerOptions) error {
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "PodIPRecovery", err)
}
if err := (&OpenTelemetryCollectorReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr, options); err != nil {
return fmt.Errorf("failed to create controller %s: %v", "OpenTelemetry", err)
}
// +kubebuilder:scaffold:builder
return nil

// The controllers only the running variant supplies, added last so that a variant
// can watch resources the core controllers own.
return options.AddControllers(mgr)
}
40 changes: 0 additions & 40 deletions internal/controller/egressgateway_controller.go

This file was deleted.

41 changes: 0 additions & 41 deletions internal/controller/intrusiondetection_controller.go

This file was deleted.

41 changes: 0 additions & 41 deletions internal/controller/logcollector_controller.go

This file was deleted.

41 changes: 0 additions & 41 deletions internal/controller/manager_controller.go

This file was deleted.

Loading