Skip to content

Commit

Permalink
fix: Remove grpcurl dependency from Operator (#4972)
Browse files Browse the repository at this point in the history
remove grpcurl dependency

Signed-off-by: Tommy Hughes <[email protected]>
  • Loading branch information
tchughesiv authored Jan 28, 2025
1 parent 72d3247 commit 439e0b9
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 55 deletions.
3 changes: 0 additions & 3 deletions infra/feast-operator/config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ patches:
- path: related_image_fs_patch.yaml
target:
kind: Deployment
- path: related_image_grpc_patch.yaml
target:
kind: Deployment
# Uncomment the patches line if you enable Metrics, and/or are using webhooks and cert-manager
# [METRICS] The following patch will enable the metrics endpoint using HTTPS and the port :8443.
# More info: https://book.kubebuilder.io/reference/metrics
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions infra/feast-operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ spec:
env:
- name: RELATED_IMAGE_FEATURE_SERVER
value: feast:latest
- name: RELATED_IMAGE_GRPC_CURL
value: grpc:latest
livenessProbe:
httpGet:
path: /healthz
Expand Down
2 changes: 0 additions & 2 deletions infra/feast-operator/dist/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4184,8 +4184,6 @@ spec:
env:
- name: RELATED_IMAGE_FEATURE_SERVER
value: docker.io/feastdev/feature-server:0.43.0
- name: RELATED_IMAGE_GRPC_CURL
value: docker.io/fullstorydev/grpcurl:v1.9.1-alpine
image: feastdev/feast-operator:0.43.0
livenessProbe:
httpGet:
Expand Down
2 changes: 1 addition & 1 deletion infra/feast-operator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.22.9
require (
github.com/onsi/ginkgo/v2 v2.17.1
github.com/onsi/gomega v1.32.0
github.com/openshift/api v0.0.0-20240912201240-0a8800162826 // release-4.17
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.30.1
k8s.io/apimachinery v0.30.1
Expand Down Expand Up @@ -48,7 +49,6 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/openshift/api v0.0.0-20240912201240-0a8800162826 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ var _ = Describe("FeatureStore Controller", func() {
Namespace: objMeta.Namespace,
}, deploy)
Expect(err).NotTo(HaveOccurred())
Expect(deploy.Spec.Template.Spec.InitContainers).To(HaveLen(2))
Expect(deploy.Spec.Template.Spec.InitContainers).To(HaveLen(1))

// check client config
cm := &corev1.ConfigMap{}
Expand Down
26 changes: 1 addition & 25 deletions infra/feast-operator/internal/controller/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (feast *FeastServices) ApplyDefaults() error {
// Deploy the feast services
func (feast *FeastServices) Deploy() error {
if feast.noLocalServiceConfigured() {
return errors.New("At least one local service must be configured. e.g. registry / online / offline.")
return errors.New("at least one local service must be configured. e.g. registry / online / offline")
}
openshiftTls, err := feast.checkOpenshiftTls()
if err != nil {
Expand Down Expand Up @@ -349,7 +349,6 @@ func (feast *FeastServices) setPod(podSpec *corev1.PodSpec) error {
if err := feast.setContainers(podSpec); err != nil {
return err
}
feast.setRegistryClientInitContainer(podSpec)
feast.mountTlsConfigs(podSpec)
feast.mountPvcConfigs(podSpec)
feast.mountEmptyDirVolumes(podSpec)
Expand Down Expand Up @@ -506,29 +505,6 @@ func (feast *FeastServices) setInitContainer(podSpec *corev1.PodSpec, fsYamlB64
}
}

// add grpc init container if remote registry reference (feastRef) is configured
func (feast *FeastServices) setRegistryClientInitContainer(podSpec *corev1.PodSpec) {
if !feast.Handler.FeatureStore.Status.Applied.Services.DisableInitContainers {
hostname := feast.Handler.FeatureStore.Status.ServiceHostnames.Registry
if len(hostname) > 0 && feast.IsRemoteRefRegistry() {
grpcurlFlag := "-plaintext"
hostSplit := strings.Split(hostname, ":")
if len(hostSplit) > 1 && hostSplit[1] == "443" {
grpcurlFlag = "-insecure"
}
podSpec.InitContainers = append(podSpec.InitContainers, corev1.Container{
Name: "init-registry",
Image: getGrpcCurlImage(),
Command: []string{
"sh", "-c",
"until grpcurl -H \"authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)\" " +
grpcurlFlag + " -d '' -format text " + hostname + " grpc.health.v1.Health/Check; do echo waiting for registry; sleep 2; done",
},
})
}
}
}

func (feast *FeastServices) setService(svc *corev1.Service, feastType FeastServiceType) error {
svc.Labels = feast.getFeastTypeLabels(feastType)
if feast.isOpenShiftTls(feastType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ import (
)

const (
feastServerImageVar = "RELATED_IMAGE_FEATURE_SERVER"
grpcCurlImageVar = "RELATED_IMAGE_GRPC_CURL"
grpcCurlImage = "fullstorydev/grpcurl:v1.9.1-alpine"

TmpFeatureStoreYamlEnvVar = "TMP_FEATURE_STORE_YAML_BASE64"
feastServerImageVar = "RELATED_IMAGE_FEATURE_SERVER"
FeatureStoreYamlCmKey = "feature_store.yaml"
EphemeralPath = "/feast-data"
FeatureRepoDir = "/feature_repo"
Expand Down
16 changes: 4 additions & 12 deletions infra/feast-operator/internal/controller/services/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
feastdevv1alpha1 "github.com/feast-dev/feast/infra/feast-operator/api/v1alpha1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -182,26 +181,19 @@ func getFeatureServerImage() string {
return DefaultImage
}

func getGrpcCurlImage() string {
if img, exists := os.LookupEnv(grpcCurlImageVar); exists {
return img
}
return grpcCurlImage
}

func checkOfflineStoreFilePersistenceType(value string) error {
if slices.Contains(feastdevv1alpha1.ValidOfflineStoreFilePersistenceTypes, value) {
return nil
}
return fmt.Errorf("invalid file type %s for offline store", value)
}

func ensureRequestedStorage(resources *v1.VolumeResourceRequirements, requestedStorage string) {
func ensureRequestedStorage(resources *corev1.VolumeResourceRequirements, requestedStorage string) {
if resources.Requests == nil {
resources.Requests = v1.ResourceList{}
resources.Requests = corev1.ResourceList{}
}
if _, ok := resources.Requests[v1.ResourceStorage]; !ok {
resources.Requests[v1.ResourceStorage] = resource.MustParse(requestedStorage)
if _, ok := resources.Requests[corev1.ResourceStorage]; !ok {
resources.Requests[corev1.ResourceStorage] = resource.MustParse(requestedStorage)
}
}

Expand Down

0 comments on commit 439e0b9

Please sign in to comment.