@@ -61,6 +61,9 @@ class BytewaxMaterializationEngineConfig(FeastConfigBaseModel):
6161 include_security_context_capabilities : bool = True
6262 """ (optional) Include security context capabilities in the init and job container spec """
6363
64+ labels : dict = {}
65+ """ (optional) additional labels to append to kubernetes objects """
66+
6467
6568class BytewaxMaterializationEngine (BatchMaterializationEngine ):
6669 def __init__ (
@@ -82,7 +85,7 @@ def __init__(
8285 self .online_store = online_store
8386
8487 # TODO: Configure k8s here
85- k8s_config .load_kube_config ()
88+ k8s_config .load_config ()
8689
8790 self .k8s_client = client .api_client .ApiClient ()
8891 self .v1 = client .CoreV1Api (self .k8s_client )
@@ -196,14 +199,13 @@ def _create_configuration_map(self, job_id, paths, feature_view, namespace):
196199 {"paths" : paths , "feature_view" : feature_view .name }
197200 )
198201
202+ labels = {"feast-bytewax-materializer" : "configmap" }
199203 configmap_manifest = {
200204 "kind" : "ConfigMap" ,
201205 "apiVersion" : "v1" ,
202206 "metadata" : {
203207 "name" : f"feast-{ job_id } " ,
204- "labels" : {
205- "feast-bytewax-materializer" : "configmap" ,
206- },
208+ "labels" : {** labels , ** self .batch_engine_config .labels },
207209 },
208210 "data" : {
209211 "feature_store.yaml" : feature_store_configuration ,
@@ -260,15 +262,15 @@ def _create_job_definition(self, job_id, namespace, pods, env):
260262 "drop" : ["ALL" ],
261263 }
262264
265+ job_labels = {"feast-bytewax-materializer" : "job" }
266+ pod_labels = {"feast-bytewax-materializer" : "pod" }
263267 job_definition = {
264268 "apiVersion" : "batch/v1" ,
265269 "kind" : "Job" ,
266270 "metadata" : {
267271 "name" : f"dataflow-{ job_id } " ,
268272 "namespace" : namespace ,
269- "labels" : {
270- "feast-bytewax-materializer" : "job" ,
271- },
273+ "labels" : {** job_labels , ** self .batch_engine_config .labels },
272274 },
273275 "spec" : {
274276 "ttlSecondsAfterFinished" : 3600 ,
@@ -278,9 +280,7 @@ def _create_job_definition(self, job_id, namespace, pods, env):
278280 "template" : {
279281 "metadata" : {
280282 "annotations" : self .batch_engine_config .annotations ,
281- "labels" : {
282- "feast-bytewax-materializer" : "pod" ,
283- },
283+ "labels" : {** pod_labels , ** self .batch_engine_config .labels },
284284 },
285285 "spec" : {
286286 "restartPolicy" : "Never" ,
0 commit comments