-
Notifications
You must be signed in to change notification settings - Fork 1
[feature] app subscriptions can only monitor resources in their namespace #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Stepan Paksashvili <[email protected]>
Signed-off-by: Stepan Paksashvili <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Stepan Paksashvili <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Michail Sinelnikov <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Stepan Paksashvili <[email protected]>
Signed-off-by: Stepan Paksashvili <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces support for application-specific hooks that are automatically scoped to their namespace. It achieves this by creating separate configuration types (ApplicationHookConfig and ApplicationKubernetesConfig) that don't include NamespaceSelector, relying on external components (shell-operator/addon-operator) to inject namespace filtering based on the APPLICATION_NAMESPACE environment variable.
Changes:
- Introduced
ApplicationHookConfigandApplicationKubernetesConfigtypes for application hooks that omit namespace selection capabilities - Refactored hook configuration handling to support both module and application hooks through a common
Configtype constraint interface - Updated
Executor.Config()to returnanyinstead of typed pointer to accommodate both config types - Added conversion functions to translate both module and application configs to shell-operator format
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/hook.go | Adds ApplicationHookConfig and ApplicationKubernetesConfig types with validation; removes kebabCaseRegexp validation and NameSelector/NamespaceSelector validation methods |
| pkg/registry/registry.go | Updates hook registration to handle both module and application hooks with generic type parameters; adds validation and type-switching logic |
| internal/executor/executor.go | Changes Config() method to return any instead of typed pointer; adds documentation |
| internal/executor/module.go | Updates to use generic Hook type with both config and input type parameters |
| internal/executor/application.go | Updates to use generic Hook type for application hooks |
| internal/executor/registry/registry.go | Updates method signatures to use new generic Hook types |
| internal/executor/executor_test.go | Updates test to use new generic Hook type signature |
| internal/controller/controller.go | Adds helper functions for metadata extraction and config conversion; implements separate conversion for application vs module kubernetes configs |
| pkg/registry/registry_test.go | Adds test for application hook registration |
| examples/single-file-app-example/hooks/main.go | Updates example to use ApplicationHookConfig and ApplicationKubernetesConfig |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Signed-off-by: Sinelnikov Michail <[email protected]>
Added support for application hooks so that app subscriptions can monitor Kubernetes resources only in their namespace, and also performed a minor refactoring of configurations/interfaces for this purpose.
Tests:
Command to check triggers:
kubectl run trigger --image=%image-name% --restrat=Never -n %app-ns% --labels=[trigger.io/trigger=trigger](http://trigger.io/trigger=trigger)Before:
Start:
Run trigger of other ns:
Run trigger of app ns:
After:
Start:
Run trigger of other ns:
Run trigger of app ns: