-
Notifications
You must be signed in to change notification settings - Fork 10
Add kubernetes events #348
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ use k8s_openapi::api::core::v1::{Secret, SecretVolumeSource, Volume, VolumeMount | |
| use k8s_openapi::apimachinery::pkg::apis::meta::v1::{Condition, Time}; | ||
| use k8s_openapi::jiff::Timestamp; | ||
| use kube::Resource; | ||
| use kube::runtime::events::{Recorder, Reporter}; | ||
| use kube::runtime::reflector::{self, Store}; | ||
| use kube::runtime::watcher::watcher; | ||
| use kube::{Api, Client, runtime::controller::Action}; | ||
|
|
@@ -43,6 +44,19 @@ pub async fn controller_info<T: Debug, E: Debug>(res: Result<T, E>) { | |
| } | ||
| } | ||
|
|
||
| pub fn new_recorder(client: Client, controller_name: &str) -> Recorder { | ||
| let reporter = Reporter { | ||
| controller: controller_name.into(), | ||
| instance: std::env::var("CONTROLLER_POD_NAME").ok(), | ||
| }; | ||
| Recorder::new(client, reporter) | ||
| } | ||
|
|
||
| pub struct ControllerContext { | ||
| pub client: Client, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use cache(aka AkContextData) here insted of client?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NB this would change a bit with #330
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AkContextData is Holds 4 reflector Stores, these are not needed where ControllerContext is used,
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| pub recorder: Recorder, | ||
| } | ||
|
|
||
| #[macro_export] | ||
| macro_rules! create_or_info_if_exists { | ||
| ($client:expr, $type:ident, $resource:ident) => { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.