Documentation
¶
Overview ¶
Package controller implements the Kubernetes controllers (reconcilers) for the NGINX Operator CRDs. Each controller watches its respective CRD and reconciles the desired state into the cluster.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NginxRouteReconciler ¶
type NginxRouteReconciler struct {
client.Client
Scheme *runtime.Scheme
ConfigGen *config.Generator
}
NginxRouteReconciler reconciles NginxRoute objects. When an NginxRoute is created, updated, or deleted, this controller triggers a re-reconciliation of the referenced NginxServer to regenerate the full config.
The reconciliation loop:
- Fetches the NginxRoute resource
- Validates the spec
- Ensures the referenced NginxServer exists
- Triggers NginxServer reconciliation by updating its annotation
- Updates NginxRoute status
func (*NginxRouteReconciler) Reconcile ¶
func (r *NginxRouteReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile handles NginxRoute create/update/delete events. It validates the route configuration and triggers the parent NginxServer to regenerate its NGINX configuration.
func (*NginxRouteReconciler) SetupWithManager ¶
func (r *NginxRouteReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the NginxRoute controller with the Manager. It watches NginxRoute resources and triggers NginxServer reconciliation when routes change.
type NginxServerReconciler ¶
type NginxServerReconciler struct {
client.Client
Scheme *runtime.Scheme
ConfigGen *config.Generator
ResourceMgr *nginx.ResourceManager
ReloaderTag string
}
NginxServerReconciler reconciles NginxServer objects. It creates and manages Deployments, Services, and ConfigMaps for NGINX instances.
The reconciliation loop:
- Fetches the NginxServer resource
- Handles finalizer for cleanup
- Collects associated NginxRoute and NginxUpstream resources
- Generates NGINX configuration
- Creates/updates ConfigMap, Deployment, and Service
- Updates status with current state
func (*NginxServerReconciler) Reconcile ¶
func (r *NginxServerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile is the main reconciliation loop for NginxServer resources. It ensures the actual cluster state matches the desired state defined in the CRD.
func (*NginxServerReconciler) SetupWithManager ¶
func (r *NginxServerReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager. It watches NginxServer resources and also watches owned Deployments, Services, and ConfigMaps.
type NginxUpstreamReconciler ¶
type NginxUpstreamReconciler struct {
client.Client
Scheme *runtime.Scheme
ConfigGen *config.Generator
}
NginxUpstreamReconciler reconciles NginxUpstream objects. When an NginxUpstream is created, updated, or deleted, this controller triggers a re-reconciliation of the referenced NginxServer.
The reconciliation loop:
- Fetches the NginxUpstream resource
- Validates the spec
- Ensures the referenced NginxServer exists
- Handles service discovery if enabled
- Triggers NginxServer reconciliation
- Updates status
func (*NginxUpstreamReconciler) Reconcile ¶
func (r *NginxUpstreamReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile handles NginxUpstream create/update/delete events.
func (*NginxUpstreamReconciler) SetupWithManager ¶
func (r *NginxUpstreamReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the NginxUpstream controller with the Manager.