-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for streams-bootstrap producer jobs (#276)
- Loading branch information
Showing
12 changed files
with
210 additions
and
37 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
backend/streams_explorer/core/extractor/default/streams_bootstrap_producer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from kubernetes_asyncio.client import V1beta1CronJob, V1Job | ||
|
||
import streams_explorer.core.k8s_app as k8s | ||
from streams_explorer.core.extractor.extractor import ProducerAppExtractor | ||
|
||
if TYPE_CHECKING: | ||
from streams_explorer.core.k8s_app import K8sAppCronJob, K8sAppJob | ||
|
||
|
||
class StreamsBootstrapProducer(ProducerAppExtractor): | ||
def on_job_parsing(self, job: V1Job) -> K8sAppJob | None: | ||
producer = k8s.K8sAppJob(job) | ||
|
||
# filter out Jobs created by CronJobs | ||
if producer.metadata.owner_references: | ||
for owner_reference in producer.metadata.owner_references: | ||
if owner_reference.kind == "CronJob": | ||
return None | ||
|
||
if producer.is_streams_app: | ||
return producer | ||
|
||
def on_cron_job_parsing(self, cron_job: V1beta1CronJob) -> K8sAppCronJob | None: | ||
producer = k8s.K8sAppCronJob(cron_job) | ||
if producer.is_streams_app: | ||
return producer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.