Visitar URL original
feat: Support podAnnotations on Deployment pod template · feast-dev/feast@1b3cdc1 · GitHub
Skip to content

Commit 1b3cdc1

Browse files
committed
feat: Support podAnnotations on Deployment pod template
Signed-off-by: ntkathole <nikhilkathole2683@gmail.com>
1 parent d4eb87c commit 1b3cdc1

9 files changed

Lines changed: 116 additions & 6 deletions

File tree

‎.secrets.baseline‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎infra/feast-operator/api/v1/featurestore_types.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ type FeatureStoreServices struct {
308308
UI *ServerConfigs `json:"ui,omitempty"`
309309
DeploymentStrategy *appsv1.DeploymentStrategy `json:"deploymentStrategy,omitempty"`
310310
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
311+
// PodAnnotations are annotations to be applied to the Deployment's PodTemplate metadata.
312+
// This enables annotation-driven integrations like OpenTelemetry auto-instrumentation,
313+
// Istio sidecar injection, Vault agent injection, etc.
314+
// +optional
315+
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
311316
// Disable the 'feast repo initialization' initContainer
312317
DisableInitContainers bool `json:"disableInitContainers,omitempty"`
313318
// Runs feast apply on pod start to populate the registry. Defaults to true. Ignored when DisableInitContainers is true.

‎infra/feast-operator/api/v1/zz_generated.deepcopy.go‎

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎infra/feast-operator/bundle/manifests/feast.dev_featurestores.yaml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,12 @@ spec:
25082508
type: object
25092509
type: object
25102510
type: object
2511+
podAnnotations:
2512+
additionalProperties:
2513+
type: string
2514+
description: PodAnnotations are annotations to be applied to the
2515+
Deployment's PodTemplate metadata.
2516+
type: object
25112517
podDisruptionBudgets:
25122518
description: PodDisruptionBudgets configures a PodDisruptionBudget
25132519
for the FeatureStore deployment.
@@ -8232,6 +8238,12 @@ spec:
82328238
type: object
82338239
type: object
82348240
type: object
8241+
podAnnotations:
8242+
additionalProperties:
8243+
type: string
8244+
description: PodAnnotations are annotations to be applied
8245+
to the Deployment's PodTemplate metadata.
8246+
type: object
82358247
podDisruptionBudgets:
82368248
description: PodDisruptionBudgets configures a PodDisruptionBudget
82378249
for the FeatureStore deployment.

‎infra/feast-operator/config/crd/bases/feast.dev_featurestores.yaml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,12 @@ spec:
25082508
type: object
25092509
type: object
25102510
type: object
2511+
podAnnotations:
2512+
additionalProperties:
2513+
type: string
2514+
description: PodAnnotations are annotations to be applied to the
2515+
Deployment's PodTemplate metadata.
2516+
type: object
25112517
podDisruptionBudgets:
25122518
description: PodDisruptionBudgets configures a PodDisruptionBudget
25132519
for the FeatureStore deployment.
@@ -8235,6 +8241,12 @@ spec:
82358241
type: object
82368242
type: object
82378243
type: object
8244+
podAnnotations:
8245+
additionalProperties:
8246+
type: string
8247+
description: PodAnnotations are annotations to be applied
8248+
to the Deployment's PodTemplate metadata.
8249+
type: object
82388250
podDisruptionBudgets:
82398251
description: PodDisruptionBudgets configures a PodDisruptionBudget
82408252
for the FeatureStore deployment.

‎infra/feast-operator/dist/install.yaml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,6 +2516,12 @@ spec:
25162516
type: object
25172517
type: object
25182518
type: object
2519+
podAnnotations:
2520+
additionalProperties:
2521+
type: string
2522+
description: PodAnnotations are annotations to be applied to the
2523+
Deployment's PodTemplate metadata.
2524+
type: object
25192525
podDisruptionBudgets:
25202526
description: PodDisruptionBudgets configures a PodDisruptionBudget
25212527
for the FeatureStore deployment.
@@ -8243,6 +8249,12 @@ spec:
82438249
type: object
82448250
type: object
82458251
type: object
8252+
podAnnotations:
8253+
additionalProperties:
8254+
type: string
8255+
description: PodAnnotations are annotations to be applied
8256+
to the Deployment's PodTemplate metadata.
8257+
type: object
82468258
podDisruptionBudgets:
82478259
description: PodDisruptionBudgets configures a PodDisruptionBudget
82488260
for the FeatureStore deployment.

‎infra/feast-operator/docs/api/markdown/ref.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ _Appears in:_
239239
| `ui` _[ServerConfigs](#serverconfigs)_ | Creates a UI server container |
240240
| `deploymentStrategy` _[DeploymentStrategy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentstrategy-v1-apps)_ | |
241241
| `securityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#podsecuritycontext-v1-core)_ | |
242+
| `podAnnotations` _object (keys:string, values:string)_ | PodAnnotations are annotations to be applied to the Deployment's PodTemplate metadata.
243+
This enables annotation-driven integrations like OpenTelemetry auto-instrumentation,
244+
Istio sidecar injection, Vault agent injection, etc. |
242245
| `disableInitContainers` _boolean_ | Disable the 'feast repo initialization' initContainer |
243246
| `runFeastApplyOnInit` _boolean_ | Runs feast apply on pod start to populate the registry. Defaults to true. Ignored when DisableInitContainers is true. |
244247
| `volumes` _[Volume](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volume-v1-core) array_ | Volumes specifies the volumes to mount in the FeatureStore deployment. A corresponding `VolumeMount` should be added to whichever feast service(s) require access to said volume(s). |

‎infra/feast-operator/internal/controller/services/services.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@ func (feast *FeastServices) setDeployment(deploy *appsv1.Deployment) error {
414414
Strategy: feast.getDeploymentStrategy(),
415415
Template: corev1.PodTemplateSpec{
416416
ObjectMeta: metav1.ObjectMeta{
417-
Labels: deploy.GetLabels(),
417+
Labels: deploy.GetLabels(),
418+
Annotations: cr.Status.Applied.Services.PodAnnotations,
418419
},
419420
Spec: corev1.PodSpec{
420421
ServiceAccountName: feast.initFeastSA().Name,

‎infra/feast-operator/internal/controller/services/services_test.go‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,64 @@ var _ = Describe("Registry Service", func() {
202202
})
203203
})
204204

205+
Describe("PodAnnotations Configuration", func() {
206+
It("should apply podAnnotations to deployment pod template", func() {
207+
featureStore.Spec.Services.PodAnnotations = map[string]string{
208+
"instrumentation.opentelemetry.io/inject-python": "true",
209+
"sidecar.istio.io/inject": "true",
210+
}
211+
Expect(k8sClient.Update(ctx, featureStore)).To(Succeed())
212+
Expect(feast.ApplyDefaults()).To(Succeed())
213+
applySpecToStatus(featureStore)
214+
feast.refreshFeatureStore(ctx, typeNamespacedName)
215+
216+
deployment := feast.initFeastDeploy()
217+
Expect(deployment).NotTo(BeNil())
218+
Expect(feast.setDeployment(deployment)).To(Succeed())
219+
220+
Expect(deployment.Spec.Template.Annotations).To(Equal(map[string]string{
221+
"instrumentation.opentelemetry.io/inject-python": "true",
222+
"sidecar.istio.io/inject": "true",
223+
}))
224+
})
225+
226+
It("should have no pod template annotations when podAnnotations is not set", func() {
227+
Expect(feast.ApplyDefaults()).To(Succeed())
228+
applySpecToStatus(featureStore)
229+
feast.refreshFeatureStore(ctx, typeNamespacedName)
230+
231+
deployment := feast.initFeastDeploy()
232+
Expect(deployment).NotTo(BeNil())
233+
Expect(feast.setDeployment(deployment)).To(Succeed())
234+
235+
Expect(deployment.Spec.Template.Annotations).To(BeNil())
236+
})
237+
238+
It("should remove pod template annotations when podAnnotations is removed", func() {
239+
featureStore.Spec.Services.PodAnnotations = map[string]string{
240+
"instrumentation.opentelemetry.io/inject-python": "true",
241+
}
242+
Expect(k8sClient.Update(ctx, featureStore)).To(Succeed())
243+
Expect(feast.ApplyDefaults()).To(Succeed())
244+
applySpecToStatus(featureStore)
245+
feast.refreshFeatureStore(ctx, typeNamespacedName)
246+
247+
deployment := feast.initFeastDeploy()
248+
Expect(deployment).NotTo(BeNil())
249+
Expect(feast.setDeployment(deployment)).To(Succeed())
250+
Expect(deployment.Spec.Template.Annotations).To(HaveKey("instrumentation.opentelemetry.io/inject-python"))
251+
252+
featureStore.Spec.Services.PodAnnotations = nil
253+
Expect(k8sClient.Update(ctx, featureStore)).To(Succeed())
254+
Expect(feast.ApplyDefaults()).To(Succeed())
255+
applySpecToStatus(featureStore)
256+
feast.refreshFeatureStore(ctx, typeNamespacedName)
257+
258+
Expect(feast.setDeployment(deployment)).To(Succeed())
259+
Expect(deployment.Spec.Template.Annotations).To(BeNil())
260+
})
261+
})
262+
205263
Describe("NodeSelector Configuration", func() {
206264
It("should apply NodeSelector to pod spec when configured", func() {
207265
// Set NodeSelector for registry service

0 commit comments

Comments
 (0)