Skip to content

Commit d9e6c6a

Browse files
authored
chore: Add ability to change default feature-server image during Operator deploy (feast-dev#4940)
1 parent 28252ed commit d9e6c6a

File tree

10 files changed

+40
-16
lines changed

10 files changed

+40
-16
lines changed

infra/feast-operator/Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ endif
5151
OPERATOR_SDK_VERSION ?= v1.38.0
5252
# Image URL to use all building/pushing image targets
5353
IMG ?= $(IMAGE_TAG_BASE):$(VERSION)
54+
FS_IMG ?= docker.io/feastdev/feature-server:$(VERSION)
5455
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5556
ENVTEST_K8S_VERSION = 1.30.0
5657

@@ -172,7 +173,7 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
172173
rm Dockerfile.cross
173174

174175
.PHONY: build-installer
175-
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
176+
build-installer: manifests generate related-image-fs kustomize ## Generate a consolidated YAML with CRDs and deployment.
176177
mkdir -p dist
177178
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
178179
$(KUSTOMIZE) build config/default > dist/install.yaml
@@ -192,7 +193,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
192193
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
193194

194195
.PHONY: deploy
195-
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
196+
deploy: manifests kustomize related-image-fs ## Deploy controller to the K8s cluster specified in ~/.kube/config.
196197
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
197198
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
198199

@@ -213,12 +214,14 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
213214
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
214215
ENVTEST ?= $(LOCALBIN)/setup-envtest
215216
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
217+
ENVSUBST = $(LOCALBIN)/envsubst
216218

217219
## Tool Versions
218220
KUSTOMIZE_VERSION ?= v5.4.2
219221
CONTROLLER_TOOLS_VERSION ?= v0.15.0
220222
ENVTEST_VERSION ?= release-0.18
221223
GOLANGCI_LINT_VERSION ?= v1.59.1
224+
ENVSUBST_VERSION ?= v1.4.2
222225

223226
.PHONY: kustomize
224227
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -240,6 +243,11 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
240243
$(GOLANGCI_LINT): $(LOCALBIN)
241244
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
242245

246+
.PHONY: envsubst
247+
envsubst: $(ENVSUBST) ## Download envsubst locally if necessary.
248+
$(ENVSUBST): $(LOCALBIN)
249+
$(call go-install-tool,$(ENVSUBST),github.com/a8m/envsubst/cmd/envsubst,$(ENVSUBST_VERSION))
250+
243251
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
244252
# $1 - target path with name of binary (ideally with version)
245253
# $2 - package url which can be installed
@@ -275,7 +283,7 @@ endif
275283
endif
276284

277285
.PHONY: bundle
278-
bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
286+
bundle: manifests kustomize related-image-fs operator-sdk ## Generate bundle manifests and metadata, then validate generated files.
279287
$(OPERATOR_SDK) generate kustomize manifests -q
280288
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
281289
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
@@ -329,3 +337,7 @@ catalog-build: opm ## Build a catalog image.
329337
.PHONY: catalog-push
330338
catalog-push: ## Push a catalog image.
331339
$(MAKE) docker-push IMG=$(CATALOG_IMG)
340+
341+
.PHONY: related-image-fs
342+
related-image-fs: envsubst
343+
FS_IMG=$(FS_IMG) $(ENVSUBST) < config/default/related_image_fs_patch.tmpl > config/default/related_image_fs_patch.yaml

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ metadata:
1616
}
1717
]
1818
capabilities: Basic Install
19-
createdAt: "2025-01-20T18:02:18Z"
19+
createdAt: "2025-01-20T22:18:19Z"
2020
operators.operatorframework.io/builder: operator-sdk-v1.38.0
2121
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4
2222
name: feast-operator.v0.43.0

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@ resources:
2828
# [METRICS] Expose the controller manager metrics service.
2929
- metrics_service.yaml
3030

31-
# Uncomment the patches line if you enable Metrics, and/or are using webhooks and cert-manager
31+
3232
patches:
33-
- path: manager_related_images_patch.yaml
33+
- path: related_image_fs_patch.yaml
3434
target:
3535
kind: Deployment
36+
- path: related_image_grpc_patch.yaml
37+
target:
38+
kind: Deployment
39+
# Uncomment the patches line if you enable Metrics, and/or are using webhooks and cert-manager
3640
# [METRICS] The following patch will enable the metrics endpoint using HTTPS and the port :8443.
3741
# More info: https://book.kubebuilder.io/reference/metrics
3842
- path: manager_metrics_patch.yaml
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- op: replace
2+
path: "/spec/template/spec/containers/0/env/0"
3+
value:
4+
name: RELATED_IMAGE_FEATURE_SERVER
5+
value: ${FS_IMG}

infra/feast-operator/config/default/manager_related_images_patch.yaml renamed to infra/feast-operator/config/default/related_image_fs_patch.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,3 @@
33
value:
44
name: RELATED_IMAGE_FEATURE_SERVER
55
value: docker.io/feastdev/feature-server:0.43.0
6-
- op: replace
7-
path: "/spec/template/spec/containers/0/env/1"
8-
value:
9-
name: RELATED_IMAGE_GRPC_CURL
10-
value: docker.io/fullstorydev/grpcurl:v1.9.1-alpine
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- op: replace
2+
path: "/spec/template/spec/containers/0/env/1"
3+
value:
4+
name: RELATED_IMAGE_GRPC_CURL
5+
value: docker.io/fullstorydev/grpcurl:v1.9.1-alpine

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ import (
2525
)
2626

2727
const (
28+
feastServerImageVar = "RELATED_IMAGE_FEATURE_SERVER"
29+
grpcCurlImageVar = "RELATED_IMAGE_GRPC_CURL"
30+
grpcCurlImage = "fullstorydev/grpcurl:v1.9.1-alpine"
31+
2832
TmpFeatureStoreYamlEnvVar = "TMP_FEATURE_STORE_YAML_BASE64"
2933
FeatureStoreYamlCmKey = "feature_store.yaml"
3034
EphemeralPath = "/feast-data"

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,17 @@ func setServiceDefaultConfigs(defaultConfigs *feastdevv1alpha1.DefaultConfigs) {
172172
}
173173

174174
func getFeatureServerImage() string {
175-
if img, exists := os.LookupEnv("RELATED_IMAGE_FEATURE_SERVER"); exists {
175+
if img, exists := os.LookupEnv(feastServerImageVar); exists {
176176
return img
177177
}
178178
return DefaultImage
179179
}
180180

181181
func getGrpcCurlImage() string {
182-
if img, exists := os.LookupEnv("RELATED_IMAGE_GRPC_CURL"); exists {
182+
if img, exists := os.LookupEnv(grpcCurlImageVar); exists {
183183
return img
184184
}
185-
return "fullstorydev/grpcurl:v1.9.1-alpine"
185+
return grpcCurlImage
186186
}
187187

188188
func checkOfflineStoreFilePersistenceType(value string) error {

infra/feast-operator/test/e2e/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ var _ = Describe("controller", Ordered, func() {
7575
ExpectWithOffset(1, err).NotTo(HaveOccurred())
7676

7777
By("deploying the controller-manager")
78-
cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG=%s", projectimage))
78+
cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG=%s", projectimage), fmt.Sprintf("FS_IMG=%s", feastLocalImage))
7979
_, err = utils.Run(cmd)
8080
ExpectWithOffset(1, err).NotTo(HaveOccurred())
8181

infra/scripts/release/files_to_bump.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ infra/feast-helm-operator/Makefile 6
1414
infra/feast-helm-operator/config/manager/kustomization.yaml 8
1515
infra/feast-operator/Makefile 6
1616
infra/feast-operator/config/manager/kustomization.yaml 8
17-
infra/feast-operator/config/default/manager_related_images_patch.yaml 5
1817
infra/feast-operator/config/overlays/odh/params.env 1
1918
infra/feast-operator/api/feastversion/version.go 20
2019
java/pom.xml 38

0 commit comments

Comments
 (0)