Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Broker, Trigger, and Namespace Controllers (#788)
* Initial API outline for Broker. * Metadata is exported * Initial Trigger API. * Remove old comments. * Register the types. * Initial work on the Broker controller. * Initial work on the Trigger controller. * Initial work on the new model and its corresponding broker controller. * Initial work on the Trigger controller. * Add simple mains. * Small fixes, still not working. * Add the Istio injection annotation. * Resolve subscriber in the Trigger controller. * Standardize on 'Any'. * Make Broker and Trigger generational * Happy control path. * TargetPort is 8080 * Watch channels. * Custom service account for filter (needs trigger watch). * Increase logging in the Filter to debug level. * Use the default channel provisioner. * Adding filtering using k8s label selectors * Watch namespaces and create a default Broker. * Updating trigger example with filters * Broker changes cause the namespace watcher to reconcile. * Move the Logging package import and format. * Updating after review comments. Only doing exact header matching. In a follow up PR, I plan to include matching of expressions. It turns our that they are somewhat more involved than expected. * Adding filtering expressions. Currently using LabelSelectors without validations. Using reflection to set some unexposed fields for now. * Changes to compile * moving filter * Moving cmds to broker * updating controller * Moving provider and reconciler to reconciler folder, and merging them into one * Adding verbs to dispatcher * Moving back mains to cmd * Updating config * Moving resources to reconcilers * Moving broker folder back where it belongs * Revert "Merge branch 'broker-new-model' into broker-new" This reverts commit d567412, reversing changes made to bd6a8fa. * Updating headers and headerExpressions to attributes and attributeExpressions * Reconcilers notice when mroe things change. * PR comment. * Remove redundant watch. * Unit test scaffold. * Tests for the namespace reconciler. * Exact matching for filters without using k8s selectors-based syntax. The matching can only be done on source and type for now. * Removing t3 as we don't have set expressions * Updates after code review * Attempt to reconcile broker in trigger controller * Broker controller unit tests. * Deleting and re-creating subscription object as the backing channel spec is immutable. * Adding comment * Rename Trigger.Spec.Filter.ExactMatch to Trigger.Spec.Filter.SourceAndType. Add unit tests for the filter binary. * Adding event messages * Using the broker's namespacedNamed as key to the triggers map. With this we allow to reconcile only the triggers that belong to the particular broker that changed * Adding some tests to trigger * More UTs * More UTs * More UTs * Namespace reconciler automatically creates the Broker Filter's ServiceAccount and RBAC. Sadly this doesn't work well because we have such an old version of controller-runtime that the Filter ends up trying to watch _all_ Triggers, not just those in its namespace. And it only gets permission for the Triggers in its own namespace. * Remove no longer needed label. * Broker and trigger types UTs * WIP early E2E test * Changes after code review. Adding trigger defaults and validation tests * Cleaner trigger validation * Adding dummy tests for broker validation... Should be implemented * Compiling and moving things around * Updating test * More updates * Waiting for potentially multiple contents. Removing check for corev1.Service ready. Removing grant's great design. Just making it simpler for now. * Compiling * Fixing compilation * Fixing compilation errors. Adding AnnotateNamespace function. * Adding ns * Adding logs. Changing to lowercase any otherwise the pod name is invalid * Removing namespace when creating trigger subscriber spec. Adding wait time constant for default broker creation. * Checking if all triggers are ready * Updated logs * Working * Adding logs... Still not receiving the events. * More logs * Adding build constraint * Removing unnecessary stuff * Removing ugly structs * More logs * Removing quotes * More logs * Adding delay * Listing triggers in receiver when we create it, so that we don't miss any message because the client couldn't find the existing trigger. This is a problem in the in-memory-channel as it doesn't do retries. Maybe the right solution is to add that functionality there. * Adding delay to sender pod * Removing withDelay method and just sleep for a while * Improve log... * Updates after code review. * Adding some more logs and trailing dots. * Switch import order. * Updating comments. * Updating comments. * Replace the bad errgroup usage with the runnableServer. * Namespace scoped the Broker Filter's client. * Fix unit tests. * Fix yaml * Setting source to source not type. Updating comment. * Switch from annotating the namespace to labeling it, to match Istio. * General clean up. * Initial docs for the Broker. * Fill some of the usage section. * Add instructions for installing the Broker without using Namespace annotation. * Create example_{brokers,triggers}.yaml to document how they can be used. * Fix MD linter issues. * Fix MD linter issues. * Fix MD linter issues. * Minor clean up. * Clean up some spots the merge didn't catch. * Fix the bad merge by replacing logger.BaseLogger with logger.FormatLogger. * Add extra columns when using kubectl get. * MarkBrokerDoesNotExist * Rename extra columns. * Replace the Trigger reconciler's in-memory map with a simple list, utilizing the fact that Controller Runtime already has the results of the List cached. * Accept v0.1 and v0.2 cloud events. Adding UTs. Updating initClient as well, removing unnecessary paging. * Change to resolve.SubscriberSpec(). * Remove restClient as it wasn't actually used. * Only reconcile the Namespace if the specific resource we care about changes. * lowercase * Mark the Broker's Ingress and Filter status condidionts failed when they have failed. * Do not DeepCopy() in Reconcile(), as controller-runtime already did it for us.
- Loading branch information