Skip to content

Commit a1a160d

Browse files
committed
fix: Fix non-specific label selector on metrics service
Signed-off-by: ntkathole <nikhilkathole2683@gmail.com>
1 parent 1e1f5d9 commit a1a160d

9 files changed

Lines changed: 55 additions & 0 deletions

File tree

docs/how-to-guides/feast-on-kubernetes.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,46 @@ spec:
6464
6565
> _More advanced FeatureStore CR examples can be found in the feast-operator [samples directory](../../infra/feast-operator/config/samples)._
6666
67+
## Upgrading the Operator
68+
69+
### OLM-managed installations
70+
71+
If the operator was installed via OLM, upgrades are handled
72+
automatically. No manual steps are required — OLM recreates the operator Deployment
73+
during the upgrade process.
74+
75+
### kubectl-managed installations
76+
77+
For most upgrades, re-running the install command is sufficient:
78+
79+
```sh
80+
kubectl apply --server-side --force-conflicts -f https://raw.githubusercontent.com/feast-dev/feast/refs/heads/stable/infra/feast-operator/dist/install.yaml
81+
```
82+
83+
#### One-time step: upgrading from versions before 0.61.0
84+
85+
Version 0.61.0 updated the operator Deployment's `spec.selector` to include the
86+
`app.kubernetes.io/name: feast-operator` label, fixing a bug where the metrics service
87+
could accidentally target pods from other operators in shared namespaces.
88+
89+
Because Kubernetes treats `spec.selector` as an immutable field, upgrading directly from
90+
a pre-0.61.0 version with `kubectl apply` will fail with:
91+
92+
```
93+
The Deployment "feast-operator-controller-manager" is invalid: spec.selector: Invalid value: ... field is immutable
94+
```
95+
96+
To resolve this, delete the existing operator Deployment before applying the new manifest:
97+
98+
```sh
99+
kubectl delete deployment feast-operator-controller-manager -n feast-operator-system --ignore-not-found=true
100+
kubectl apply --server-side --force-conflicts -f https://raw.githubusercontent.com/feast-dev/feast/refs/heads/stable/infra/feast-operator/dist/install.yaml
101+
```
102+
103+
This is only required once. Existing FeatureStore CRs and their managed workloads (feature
104+
servers, registry, etc.) are not affected — the new operator pod will reconcile them
105+
automatically on startup. Future upgrades from 0.61.0 onward will not require this step.
106+
67107
{% hint style="success" %}
68108
**Scaling & High Availability:** The Feast Operator supports horizontal scaling via static replicas, HPA autoscaling, or external autoscalers like [KEDA](https://keda.sh). Scaling requires DB-backed persistence for all enabled services.
69109

infra/feast-operator/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ kubectl apply --server-side --force-conflicts -f https://raw.githubusercontent.c
2424
```
2525

2626
> **NOTE**: Server-Side Apply (`--server-side`) is required because the CRD includes both v1alpha1 and v1 API versions, making it too large for the standard `kubectl apply` annotation limit. If you encounter annotation size errors, use `--server-side --force-conflicts` flags.
27+
2728
##### Feast Operator Demo Videos
2829
[![](https://img.youtube.com/vi/48cb4AHxPR4/0.jpg)](https://www.youtube.com/playlist?list=PLPzVNzik7rsAN-amQLZckd0so3cIr7blX)
2930

infra/feast-operator/bundle/manifests/feast-operator-controller-manager-metrics-service_v1_service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ spec:
1414
protocol: TCP
1515
targetPort: 8443
1616
selector:
17+
app.kubernetes.io/name: feast-operator
1718
control-plane: controller-manager
1819
status:
1920
loadBalancer: {}

infra/feast-operator/bundle/manifests/feast-operator.clusterserviceversion.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,15 @@ spec:
212212
replicas: 1
213213
selector:
214214
matchLabels:
215+
app.kubernetes.io/name: feast-operator
215216
control-plane: controller-manager
216217
strategy: {}
217218
template:
218219
metadata:
219220
annotations:
220221
kubectl.kubernetes.io/default-container: manager
221222
labels:
223+
app.kubernetes.io/name: feast-operator
222224
control-plane: controller-manager
223225
spec:
224226
containers:

infra/feast-operator/config/default/metrics_service.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ spec:
1414
protocol: TCP
1515
targetPort: 8443
1616
selector:
17+
app.kubernetes.io/name: feast-operator
1718
control-plane: controller-manager

infra/feast-operator/config/manager/manager.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ metadata:
1919
spec:
2020
selector:
2121
matchLabels:
22+
app.kubernetes.io/name: feast-operator
2223
control-plane: controller-manager
2324
replicas: 1
2425
template:
2526
metadata:
2627
annotations:
2728
kubectl.kubernetes.io/default-container: manager
2829
labels:
30+
app.kubernetes.io/name: feast-operator
2931
control-plane: controller-manager
3032
spec:
3133
# TODO(user): Uncomment the following code to configure the nodeAffinity expression

infra/feast-operator/config/prometheus/monitor.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ spec:
2727
insecureSkipVerify: true
2828
selector:
2929
matchLabels:
30+
app.kubernetes.io/name: feast-operator
3031
control-plane: controller-manager

infra/feast-operator/dist/install.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20512,6 +20512,7 @@ spec:
2051220512
protocol: TCP
2051320513
targetPort: 8443
2051420514
selector:
20515+
app.kubernetes.io/name: feast-operator
2051520516
control-plane: controller-manager
2051620517
---
2051720518
apiVersion: apps/v1
@@ -20527,12 +20528,14 @@ spec:
2052720528
replicas: 1
2052820529
selector:
2052920530
matchLabels:
20531+
app.kubernetes.io/name: feast-operator
2053020532
control-plane: controller-manager
2053120533
template:
2053220534
metadata:
2053320535
annotations:
2053420536
kubectl.kubernetes.io/default-container: manager
2053520537
labels:
20538+
app.kubernetes.io/name: feast-operator
2053620539
control-plane: controller-manager
2053720540
spec:
2053820541
containers:

infra/feast-operator/test/utils/test_util.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ func DeployOperatorFromCode(testDir string, skipBuilds bool) {
409409
_, err = Run(cmd, testDir)
410410
ExpectWithOffset(1, err).NotTo(HaveOccurred())
411411

412+
By("deleting existing controller-manager deployment to allow selector changes on upgrade")
413+
cmd = exec.Command("kubectl", "delete", "deployment", ControllerDeploymentName, "-n", FeastControllerNamespace, "--ignore-not-found=true")
414+
_, _ = Run(cmd, testDir)
415+
412416
By("deploying the controller-manager")
413417
cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG=%s", projectimage), fmt.Sprintf("FS_IMG=%s", feastLocalImage))
414418
_, err = Run(cmd, testDir)

0 commit comments

Comments
 (0)