Controller defines the controller for agentgateway. The controller reads a variety of resources (Gateway types, as well as adjacent types like Namespace and Service). Most resources are fully "self-contained" with krt, but there are a few usages breaking out of `krt` for status reporting; these are
| 76 | // The status on all Gateway types is also tracked. Each collection emits downstream objects, but also status about the |
| 77 | // input type. If the status changes, it is queued to asynchronously update the status of the object in Kubernetes. |
| 78 | type Controller struct { |
| 79 | // client for accessing Kubernetes |
| 80 | client kube.Client |
| 81 | |
| 82 | // the cluster where the agentgateway controller runs |
| 83 | cluster cluster.ID |
| 84 | // revision the controller is running under |
| 85 | revision string |
| 86 | |
| 87 | istioNamespace string |
| 88 | |
| 89 | // status controls the status writing queue. Status will only be written if statusEnabled is true, which |
| 90 | // is only the case when we are the leader. |
| 91 | status *status.StatusCollections |
| 92 | |
| 93 | waitForCRD func(class schema.GroupVersionResource, stop <-chan struct{}) bool |
| 94 | |
| 95 | // gatewayContext exposes us to the internal Istio service registry. This is outside krt knowledge (currently), so, |
| 96 | // so we wrap it in a RecomputeProtected. |
| 97 | // Most usages in the API are directly referenced typed objects (Service, ServiceEntry, etc) so this is not needed typically. |
| 98 | gatewayContext krt.RecomputeProtected[*atomic.Pointer[gatewaycommon.GatewayContext]] |
| 99 | // tagWatcher allows us to check which tags are ours. Unlike most Istio codepaths, we read istio.io/rev=<tag> and not just |
| 100 | // revisions for Gateways. This is because a Gateway is sort of a mix of a Deployment and Config. |
| 101 | // Since the TagWatcher is not yet krt-aware, we wrap this in RecomputeProtected. |
| 102 | tagWatcher krt.RecomputeProtected[revisions.TagWatcher] |
| 103 | |
| 104 | stop chan struct{} |
| 105 | |
| 106 | // TODO(jaellio): Verify we don't need handlers for syncing. In the gateway controller we register handlers for the outputs |
| 107 | outputs OutputCollections |
| 108 | |
| 109 | inputs *AgwInputs |
| 110 | |
| 111 | domainSuffix string // the domain suffix to use for generated resources |
| 112 | |
| 113 | // features |
| 114 | Registrations []xds.Registration |
| 115 | } |
| 116 | |
| 117 | type OutputCollections struct { |
| 118 | Resources krt.Collection[AgwResource] |
nothing calls this directly
no outgoing calls
no test coverage detected