From fd96c70651367775714b7488b4686a57c5edb2eb Mon Sep 17 00:00:00 2001 From: zhlsunshine Date: Mon, 3 Jun 2024 18:36:38 +0800 Subject: [PATCH 1/6] demo yaml files integration between gmc and oneclick. Signed-off-by: zhlsunshine remove bin files --- .../config/samples/chatQnA_v2.yaml | 34 +--- .../samples/gmcmanager}/gmc-manager-rbac.yaml | 1 + .../samples/gmcmanager}/gmc-manager.yaml | 0 .../samples/gmcrouter}/gmc-router.yaml | 4 +- .../controller/gmconnector_controller.go | 157 ++++++++---------- .../templates/MicroChatQnA/Embedding.yaml | 44 ----- .../templates/MicroChatQnA/Llm.yaml | 50 ------ .../templates/MicroChatQnA/Reranking.yaml | 49 ------ .../templates/MicroChatQnA/Retriever.yaml | 46 ----- .../templates/MicroChatQnA/TeiEmbedding.yaml | 57 ------- .../templates/MicroChatQnA/TeiReranking.yaml | 57 ------- .../templates/MicroChatQnA/Tgi.yaml | 62 ------- .../templates/MicroChatQnA/VectorDB.yaml | 43 ----- .../templates/MicroChatQnA/gmc-rbac.yaml | 28 ---- .../templates/MicroChatQnA/gmc-secret.yaml | 11 -- .../templates/MicroChatQnA/qna-and-redis.yaml | 87 ---------- .../text-embeddings-inference.yaml | 99 ----------- .../text-generation-inference.yaml | 110 ------------ .../text-reranking-inference.yaml | 104 ------------ 19 files changed, 81 insertions(+), 962 deletions(-) rename microservices-connector/{templates/MicroChatQnA => config/samples/gmcmanager}/gmc-manager-rbac.yaml (99%) rename microservices-connector/{templates/MicroChatQnA => config/samples/gmcmanager}/gmc-manager.yaml (100%) rename microservices-connector/{templates/MicroChatQnA => config/samples/gmcrouter}/gmc-router.yaml (95%) delete mode 100644 microservices-connector/templates/MicroChatQnA/Embedding.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/Llm.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/Reranking.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/Retriever.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/TeiEmbedding.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/TeiReranking.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/Tgi.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/VectorDB.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/gmc-rbac.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/gmc-secret.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/qna-and-redis.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/text-embeddings-inference.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/text-generation-inference.yaml delete mode 100644 microservices-connector/templates/MicroChatQnA/text-reranking-inference.yaml diff --git a/microservices-connector/config/samples/chatQnA_v2.yaml b/microservices-connector/config/samples/chatQnA_v2.yaml index c32ea575..e88df854 100644 --- a/microservices-connector/config/samples/chatQnA_v2.yaml +++ b/microservices-connector/config/samples/chatQnA_v2.yaml @@ -25,91 +25,73 @@ spec: - name: Embedding internalService: nameSpace: chatqa - serviceName: embedding-service + serviceName: embedding-svc config: no_proxy: ".chatqa.svc.cluster.local" http_proxy: "insert-your-http-proxy-here" https_proxy: "insert-your-https-proxy-here" - tei_endpoint: "http://tei-embedding-service.chatqa.svc.cluster.local:6006" endpoint: /v1/embeddings - name: TeiEmbedding internalService: nameSpace: chatqa - serviceName: tei-embedding-service + serviceName: tei-embedding-svc config: no_proxy: ".chatqa.svc.cluster.local" http_proxy: "insert-your-http-proxy-here" https_proxy: "insert-your-https-proxy-here" - gmcTokenSecret: gmc-tokens - hostPath: /root/GMC/data/tei - modelId: BAAI/bge-base-en-v1.5 - endpoint: /embed isDownstreamService: true - name: Retriever data: $response internalService: nameSpace: chatqa - serviceName: retriever-redis-server + serviceName: retriever-svc config: no_proxy: ".chatqa.svc.cluster.local" http_proxy: "insert-your-http-proxy-here" https_proxy: "insert-your-https-proxy-here" - RedisUrl: redis://redis-vector-db.chatqa.svc.cluster.local:6379 - IndexName: rag-redis - tei_endpoint: "http://tei-embedding-service.chatqa.svc.cluster.local:6006" endpoint: /v1/retrieval - name: VectorDB internalService: nameSpace: chatqa - serviceName: redis-vector-db + serviceName: redis-vector-db isDownstreamService: true - name: Reranking data: $response internalService: nameSpace: chatqa - serviceName: reranking-service + serviceName: reranking-svc config: no_proxy: ".chatqa.svc.cluster.local" http_proxy: "insert-your-http-proxy-here" https_proxy: "insert-your-https-proxy-here" - tei_reranking_endpoint: http://tei-reranking-service.chatqa.svc.cluster.local:8808 - gmcTokenSecret: gmc-tokens endpoint: /v1/reranking - name: TeiReranking internalService: nameSpace: chatqa - serviceName: tei-reranking-service + serviceName: tei-reranking-svc config: no_proxy: ".chatqa.svc.cluster.local" http_proxy: "insert-your-http-proxy-here" https_proxy: "insert-your-https-proxy-here" - gmcTokenSecret: gmc-tokens - hostPath: /root/GMC/data/rerank - modelId: BAAI/bge-reranker-large endpoint: /rerank isDownstreamService: true - name: Llm data: $response internalService: nameSpace: chatqa - serviceName: llm-service + serviceName: llm-svc config: no_proxy: ".chatqa.svc.cluster.local" http_proxy: "insert-your-http-proxy-here" https_proxy: "insert-your-https-proxy-here" - tgi_endpoint: http://tgi-service.chatqa.svc.cluster.local:9009 - gmcTokenSecret: gmc-tokens endpoint: /v1/chat/completions - name: Tgi internalService: nameSpace: chatqa - serviceName: tgi-service + serviceName: tgi-svc config: no_proxy: ".chatqa.svc.cluster.local" http_proxy: "insert-your-http-proxy-here" https_proxy: "insert-your-https-proxy-here" - gmcTokenSecret: gmc-tokens - hostPath: /root/GMC/data/tgi - modelId: Intel/neural-chat-7b-v3-3 endpoint: /generate isDownstreamService: true diff --git a/microservices-connector/templates/MicroChatQnA/gmc-manager-rbac.yaml b/microservices-connector/config/samples/gmcmanager/gmc-manager-rbac.yaml similarity index 99% rename from microservices-connector/templates/MicroChatQnA/gmc-manager-rbac.yaml rename to microservices-connector/config/samples/gmcmanager/gmc-manager-rbac.yaml index 2f843331..d159693d 100644 --- a/microservices-connector/templates/MicroChatQnA/gmc-manager-rbac.yaml +++ b/microservices-connector/config/samples/gmcmanager/gmc-manager-rbac.yaml @@ -29,6 +29,7 @@ rules: resources: - services - secrets + - configmaps verbs: - create - delete diff --git a/microservices-connector/templates/MicroChatQnA/gmc-manager.yaml b/microservices-connector/config/samples/gmcmanager/gmc-manager.yaml similarity index 100% rename from microservices-connector/templates/MicroChatQnA/gmc-manager.yaml rename to microservices-connector/config/samples/gmcmanager/gmc-manager.yaml diff --git a/microservices-connector/templates/MicroChatQnA/gmc-router.yaml b/microservices-connector/config/samples/gmcrouter/gmc-router.yaml similarity index 95% rename from microservices-connector/templates/MicroChatQnA/gmc-router.yaml rename to microservices-connector/config/samples/gmcrouter/gmc-router.yaml index 3c8072ff..04d4f04f 100644 --- a/microservices-connector/templates/MicroChatQnA/gmc-router.yaml +++ b/microservices-connector/config/samples/gmcrouter/gmc-router.yaml @@ -1,6 +1,8 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 + +--- apiVersion: v1 kind: Service metadata: @@ -27,7 +29,7 @@ spec: labels: app: router-service spec: - serviceAccountName: gmc-service-sa + serviceAccountName: default containers: - name: router-server image: zhlsunshine/gmcrouter:latest diff --git a/microservices-connector/internal/controller/gmconnector_controller.go b/microservices-connector/internal/controller/gmconnector_controller.go index 3ddc1ceb..8d108d74 100644 --- a/microservices-connector/internal/controller/gmconnector_controller.go +++ b/microservices-connector/internal/controller/gmconnector_controller.go @@ -71,22 +71,24 @@ func reconcileResource(step string, ns string, svc string, svcCfg *map[string]st fmt.Printf("get step %s config for %s@%s: %v\n", step, svc, ns, svcCfg) //TODO add validation to rule out unexpected case like both embedding and retrieving - if step == "Embedding" { - tmpltFile = yaml_dir + "/Embedding.yaml" + if step == "Configmap" { + tmpltFile = yaml_dir + "/qna_configmap_xeon.yaml" + } else if step == "Embedding" { + tmpltFile = yaml_dir + "/embedding.yaml" } else if step == "TeiEmbedding" { - tmpltFile = yaml_dir + "/TeiEmbedding.yaml" + tmpltFile = yaml_dir + "/tei_embedding_service.yaml" } else if step == "VectorDB" { - tmpltFile = yaml_dir + "/VectorDB.yaml" + tmpltFile = yaml_dir + "/redis-vector-db.yaml" } else if step == "Retriever" { - tmpltFile = yaml_dir + "/Retriever.yaml" + tmpltFile = yaml_dir + "/retriever.yaml" } else if step == "Reranking" { - tmpltFile = yaml_dir + "/Reranking.yaml" + tmpltFile = yaml_dir + "/reranking.yaml" } else if step == "TeiReranking" { - tmpltFile = yaml_dir + "/TeiReranking.yaml" + tmpltFile = yaml_dir + "/tei_reranking_service.yaml" } else if step == "Tgi" { - tmpltFile = yaml_dir + "/Tgi.yaml" + tmpltFile = yaml_dir + "/tgi_service.yaml" } else if step == "Llm" { - tmpltFile = yaml_dir + "/Llm.yaml" + tmpltFile = yaml_dir + "/llm.yaml" } else if step == "router" { tmpltFile = yaml_dir + "/gmc-router.yaml" } else { @@ -113,6 +115,10 @@ func reconcileResource(step string, ns string, svc string, svcCfg *map[string]st return fmt.Errorf("failed to apply user config: %v", err) } resources = strings.Split(appliedCfg, "---") + fmt.Printf("The raw yaml file has been splitted into %v yaml files", len(resources)) + if len(resources) >= 2 { + resources = resources[1:] + } decUnstructured := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme) @@ -182,66 +188,53 @@ func getServiceURL(service *corev1.Service) string { func getCustomConfig(step string, svcCfg *map[string]string, yamlFile []byte) (string, error) { var userDefinedCfg interface{} - if step == "Embedding" { + if step == "Configmap" { + return string(yamlFile), nil + } else if step == "Embedding" { userDefinedCfg = EmbeddingCfg{ - NoProxy: (*svcCfg)["no_proxy"], - HttpProxy: (*svcCfg)["http_proxy"], - HttpsProxy: (*svcCfg)["https_proxy"], - TeiEndpoint: (*svcCfg)["tei_endpoint"], + NoProxy: (*svcCfg)["no_proxy"], + HttpProxy: (*svcCfg)["http_proxy"], + HttpsProxy: (*svcCfg)["https_proxy"], } } else if step == "TeiEmbedding" { userDefinedCfg = TeiEmbeddingCfg{ - EmbeddingModelId: (*svcCfg)["modelId"], - NoProxy: (*svcCfg)["no_proxy"], - HttpProxy: (*svcCfg)["http_proxy"], - HttpsProxy: (*svcCfg)["https_proxy"], - GmcTokenSecret: (*svcCfg)["gmcTokenSecret"], - EmbeddingModelDir: (*svcCfg)["hostPath"], + EmbeddingModelId: (*svcCfg)["modelId"], + NoProxy: (*svcCfg)["no_proxy"], + HttpProxy: (*svcCfg)["http_proxy"], + HttpsProxy: (*svcCfg)["https_proxy"], } } else if step == "VectorDB" { userDefinedCfg = nil } else if step == "Retriever" { userDefinedCfg = RetriverCfg{ - NoProxy: (*svcCfg)["no_proxy"], - HttpProxy: (*svcCfg)["http_proxy"], - HttpsProxy: (*svcCfg)["https_proxy"], - RedisUrl: (*svcCfg)["RedisUrl"], - IndexName: (*svcCfg)["IndexName"], - TeiEndpoint: (*svcCfg)["tei_endpoint"], + NoProxy: (*svcCfg)["no_proxy"], + HttpProxy: (*svcCfg)["http_proxy"], + HttpsProxy: (*svcCfg)["https_proxy"], } } else if step == "Reranking" { userDefinedCfg = RerankingCfg{ - NoProxy: (*svcCfg)["no_proxy"], - HttpProxy: (*svcCfg)["http_proxy"], - HttpsProxy: (*svcCfg)["https_proxy"], - TeiRerankingEndpoint: (*svcCfg)["tei_reranking_endpoint"], - GmcTokenSecret: (*svcCfg)["gmcTokenSecret"], + NoProxy: (*svcCfg)["no_proxy"], + HttpProxy: (*svcCfg)["http_proxy"], + HttpsProxy: (*svcCfg)["https_proxy"], } } else if step == "TeiReranking" { userDefinedCfg = TeiRerankingCfg{ - RerankingModelId: (*svcCfg)["modelId"], - NoProxy: (*svcCfg)["no_proxy"], - HttpProxy: (*svcCfg)["http_proxy"], - HttpsProxy: (*svcCfg)["https_proxy"], - GmcTokenSecret: (*svcCfg)["gmcTokenSecret"], - RerankingModelDir: (*svcCfg)["hostPath"], + NoProxy: (*svcCfg)["no_proxy"], + HttpProxy: (*svcCfg)["http_proxy"], + HttpsProxy: (*svcCfg)["https_proxy"], } } else if step == "Tgi" { userDefinedCfg = TgiCfg{ - NoProxy: (*svcCfg)["no_proxy"], - HttpProxy: (*svcCfg)["http_proxy"], - HttpsProxy: (*svcCfg)["https_proxy"], - GmcTokenSecret: (*svcCfg)["gmcTokenSecret"], - LlmModelId: (*svcCfg)["modelId"], - LlmModelDir: (*svcCfg)["hostPath"], + NoProxy: (*svcCfg)["no_proxy"], + HttpProxy: (*svcCfg)["http_proxy"], + HttpsProxy: (*svcCfg)["https_proxy"], } } else if step == "Llm" { userDefinedCfg = LlmCfg{ - NoProxy: (*svcCfg)["no_proxy"], - HttpProxy: (*svcCfg)["http_proxy"], - HttpsProxy: (*svcCfg)["https_proxy"], - TgiEndpoint: (*svcCfg)["tgi_endpoint"], - GmcTokenSecret: (*svcCfg)["gmcTokenSecret"]} + NoProxy: (*svcCfg)["no_proxy"], + HttpProxy: (*svcCfg)["http_proxy"], + HttpsProxy: (*svcCfg)["https_proxy"], + } } else if step == "router" { userDefinedCfg = RouterCfg{ NoProxy: (*svcCfg)["no_proxy"], @@ -275,61 +268,46 @@ func getCustomConfig(step string, svcCfg *map[string]string, yamlFile []byte) (s } type EmbeddingCfg struct { - NoProxy string - HttpProxy string - HttpsProxy string - TeiEndpoint string + NoProxy string + HttpProxy string + HttpsProxy string } type TeiEmbeddingCfg struct { - EmbeddingModelId string - NoProxy string - HttpProxy string - HttpsProxy string - GmcTokenSecret string - EmbeddingModelDir string + EmbeddingModelId string + NoProxy string + HttpProxy string + HttpsProxy string } type RetriverCfg struct { - NoProxy string - HttpProxy string - HttpsProxy string - RedisUrl string - IndexName string - TeiEndpoint string + NoProxy string + HttpProxy string + HttpsProxy string } type RerankingCfg struct { - NoProxy string - HttpProxy string - HttpsProxy string - TeiRerankingEndpoint string - GmcTokenSecret string + NoProxy string + HttpProxy string + HttpsProxy string } type TeiRerankingCfg struct { - RerankingModelId string - NoProxy string - HttpProxy string - HttpsProxy string - GmcTokenSecret string - RerankingModelDir string + RerankingModelId string + NoProxy string + HttpProxy string + HttpsProxy string } type TgiCfg struct { - NoProxy string - HttpProxy string - HttpsProxy string - GmcTokenSecret string - LlmModelId string - LlmModelDir string + NoProxy string + HttpProxy string + HttpsProxy string } type LlmCfg struct { - NoProxy string - HttpProxy string - HttpsProxy string - TgiEndpoint string - GmcTokenSecret string + NoProxy string + HttpProxy string + HttpsProxy string } type RouterCfg struct { @@ -366,7 +344,10 @@ func (r *GMConnectorReconciler) Reconcile(ctx context.Context, req ctrl.Request) // get the router config // r.Log.Info("Reconciling connector graph", "apiVersion", graph.APIVersion, "graph", graph.Name) fmt.Println("Reconciling connector graph", "apiVersion", graph.APIVersion, "graph", graph.Name) - + err := reconcileResource("Configmap", req.NamespacedName.Namespace, "", nil, nil) + if err != nil { + return reconcile.Result{Requeue: true}, errors.Wrapf(err, "Failed to reconcile the Configmap file") + } for node, router := range graph.Spec.Nodes { for i, step := range router.Steps { fmt.Println("reconcile resource for node:", step.StepName) @@ -394,7 +375,7 @@ func (r *GMConnectorReconciler) Reconcile(ctx context.Context, req ctrl.Request) //to start a router controller routerService := &corev1.Service{} - err := r.Client.Get(ctx, types.NamespacedName{Namespace: graph.Spec.RouterConfig.NameSpace, Name: graph.Spec.RouterConfig.ServiceName}, routerService) + err = r.Client.Get(ctx, types.NamespacedName{Namespace: graph.Spec.RouterConfig.NameSpace, Name: graph.Spec.RouterConfig.ServiceName}, routerService) if err == nil { fmt.Println("success to get router service ", graph.Spec.RouterConfig.ServiceName) } else { diff --git a/microservices-connector/templates/MicroChatQnA/Embedding.yaml b/microservices-connector/templates/MicroChatQnA/Embedding.yaml deleted file mode 100644 index 11e5891b..00000000 --- a/microservices-connector/templates/MicroChatQnA/Embedding.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: embedding-service -spec: - ports: - - port: 6000 - targetPort: 6000 - selector: - app: embedding-service ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: embedding-server -spec: - replicas: 1 - selector: - matchLabels: - app: embedding-service - template: - metadata: - labels: - app: embedding-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: embedding-server - image: zhlsunshine/gen-ai-comps:embedding-tei-server - imagePullPolicy: IfNotPresent - ports: - - containerPort: 6000 - env: - - name: no_proxy - value: {{.NoProxy}} - - name: http_proxy - value: {{.HttpProxy}} - - name: https_proxy - value: {{.HttpsProxy}} - - name: TEI_EMBEDDING_ENDPOINT - value: {{.TeiEndpoint}} diff --git a/microservices-connector/templates/MicroChatQnA/Llm.yaml b/microservices-connector/templates/MicroChatQnA/Llm.yaml deleted file mode 100644 index 610a6635..00000000 --- a/microservices-connector/templates/MicroChatQnA/Llm.yaml +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: llm-service -spec: - selector: - app: llm-service - ports: - - protocol: TCP - port: 9000 - targetPort: 9000 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: llm-server -spec: - replicas: 1 - selector: - matchLabels: - app: llm-service - template: - metadata: - labels: - app: llm-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: llm-server - image: zhlsunshine/gen-ai-comps:llm-tgi-server - imagePullPolicy: IfNotPresent - ports: - - containerPort: 9000 - env: - - name: no_proxy - value: {{.NoProxy}} - - name: http_proxy - value: {{.HttpProxy}} - - name: https_proxy - value: {{.HttpsProxy}} - - name: TGI_LLM_ENDPOINT - value: {{.TgiEndpoint}} - - name: HUGGINGFACEHUB_API_TOKEN - valueFrom: - secretKeyRef: - name: {{.GmcTokenSecret}} - key: huggingfacehub_api_token diff --git a/microservices-connector/templates/MicroChatQnA/Reranking.yaml b/microservices-connector/templates/MicroChatQnA/Reranking.yaml deleted file mode 100644 index 3dde27c3..00000000 --- a/microservices-connector/templates/MicroChatQnA/Reranking.yaml +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: reranking-service -spec: - ports: - - port: 8000 - targetPort: 8000 - selector: - app: reranking-service ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: reranking-server -spec: - replicas: 1 - selector: - matchLabels: - app: reranking-service - template: - metadata: - labels: - app: reranking-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: reranking-server - image: zhlsunshine/gen-ai-comps:reranking-tei-xeon-server - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8000 - env: - - name: no_proxy - value: {{.NoProxy}} - - name: http_proxy - value: {{.HttpProxy}} - - name: https_proxy - value: {{.HttpsProxy}} - - name: TEI_RERANKING_ENDPOINT - value: {{.TeiRerankingEndpoint}} - - name: HUGGINGFACEHUB_API_TOKEN - valueFrom: - secretKeyRef: - name: {{.GmcTokenSecret}} - key: huggingfacehub_api_token diff --git a/microservices-connector/templates/MicroChatQnA/Retriever.yaml b/microservices-connector/templates/MicroChatQnA/Retriever.yaml deleted file mode 100644 index 281a57d7..00000000 --- a/microservices-connector/templates/MicroChatQnA/Retriever.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: retriever-redis-server -spec: - selector: - app: retriever-redis-server - ports: - - protocol: TCP - port: 7000 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: retriever-redis-server -spec: - replicas: 1 - selector: - matchLabels: - app: retriever-redis-server - template: - metadata: - labels: - app: retriever-redis-server - spec: - containers: - - name: retriever-redis-server - image: zhlsunshine/gen-ai-comps:retriever-redis-server - ports: - - containerPort: 7000 - env: - - name: no_proxy - value: {{.NoProxy}} - - name: http_proxy - value: {{.HttpProxy}} - - name: https_proxy - value: {{.HttpsProxy}} - - name: REDIS_URL - value: {{.RedisUrl}} - - name: INDEX_NAME - value: {{.IndexName}} - - name: TEI_EMBEDDING_ENDPOINT - value: {{.TeiEndpoint}} diff --git a/microservices-connector/templates/MicroChatQnA/TeiEmbedding.yaml b/microservices-connector/templates/MicroChatQnA/TeiEmbedding.yaml deleted file mode 100644 index 5a923b8d..00000000 --- a/microservices-connector/templates/MicroChatQnA/TeiEmbedding.yaml +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: tei-embedding-service -spec: - ports: - - port: 6006 - targetPort: 80 - selector: - app: tei-embedding-service ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: tei-embedding-server -spec: - replicas: 1 - selector: - matchLabels: - app: tei-embedding-service - template: - metadata: - labels: - app: tei-embedding-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: tei-embedding-server - image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.2 - imagePullPolicy: IfNotPresent - args: - - "--model-id" - - {{.EmbeddingModelId}} - ports: - - containerPort: 80 - volumeMounts: - - name: tei-data - mountPath: /data - env: - - name: no_proxy - value: {{.NoProxy}} - - name: http_proxy - value: {{.HttpProxy}} - - name: https_proxy - value: {{.HttpsProxy}} - - name: HUGGINGFACEHUB_API_TOKEN - valueFrom: - secretKeyRef: - name: {{.GmcTokenSecret}} - key: huggingfacehub_api_token - volumes: - - name: tei-data - hostPath: - path: {{.EmbeddingModelDir}} diff --git a/microservices-connector/templates/MicroChatQnA/TeiReranking.yaml b/microservices-connector/templates/MicroChatQnA/TeiReranking.yaml deleted file mode 100644 index ac23ec0a..00000000 --- a/microservices-connector/templates/MicroChatQnA/TeiReranking.yaml +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: tei-reranking-service -spec: - ports: - - port: 8808 - targetPort: 80 - selector: - app: tei-reranking-service ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: tei-reranking-server -spec: - replicas: 1 - selector: - matchLabels: - app: tei-reranking-service - template: - metadata: - labels: - app: tei-reranking-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: tei-reranking-server - image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.2 - imagePullPolicy: IfNotPresent - args: - - "--model-id" - - {{.RerankingModelId}} - ports: - - containerPort: 80 - volumeMounts: - - name: rerank-data - mountPath: /data - env: - - name: no_proxy - value: {{.NoProxy}} - - name: http_proxy - value: {{.HttpProxy}} - - name: https_proxy - value: {{.HttpsProxy}} - - name: HUGGINGFACEHUB_API_TOKEN - valueFrom: - secretKeyRef: - name: {{.GmcTokenSecret}} - key: huggingfacehub_api_token - volumes: - - name: rerank-data - hostPath: - path: {{.RerankingModelDir}} diff --git a/microservices-connector/templates/MicroChatQnA/Tgi.yaml b/microservices-connector/templates/MicroChatQnA/Tgi.yaml deleted file mode 100644 index 4b24c78c..00000000 --- a/microservices-connector/templates/MicroChatQnA/Tgi.yaml +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: tgi-service -spec: - selector: - app: tgi-service - ports: - - protocol: TCP - port: 9009 - targetPort: 80 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: tgi-server -spec: - replicas: 1 - selector: - matchLabels: - app: tgi-service - template: - metadata: - labels: - app: tgi-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: tgi-server - image: ghcr.io/huggingface/text-generation-inference:1.4 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 80 - env: - - name: no_proxy - value: {{.NoProxy}} - - name: http_proxy - value: {{.HttpProxy}} - - name: https_proxy - value: {{.HttpsProxy}} - - name: HUGGINGFACEHUB_API_TOKEN - valueFrom: - secretKeyRef: - name: {{.GmcTokenSecret}} - key: huggingfacehub_api_token - volumeMounts: - - name: tgi-data - mountPath: /data - args: - - "--model-id" - - {{.LlmModelId}} - - "--max-total-tokens" - - "4096" - - "--max-input-length" - - "4095" - volumes: - - name: tgi-data - hostPath: - path: {{.LlmModelDir}} diff --git a/microservices-connector/templates/MicroChatQnA/VectorDB.yaml b/microservices-connector/templates/MicroChatQnA/VectorDB.yaml deleted file mode 100644 index 8bc9ccd2..00000000 --- a/microservices-connector/templates/MicroChatQnA/VectorDB.yaml +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: redis-vector-db -spec: - selector: - app: redis-vector-db - ports: - - name: poredis - protocol: TCP - port: 6379 - targetPort: 6379 - - name: poserver - protocol: TCP - port: 8001 - targetPort: 8001 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-vector-db -spec: - replicas: 1 - selector: - matchLabels: - app: redis-vector-db - template: - metadata: - labels: - app: redis-vector-db - spec: - serviceAccountName: gmc-service-sa - containers: - - name: redis-vector-db - image: redis/redis-stack:7.2.0-v9 - ports: - - containerPort: 6379 - name: poredis - - containerPort: 8001 - name: poserver diff --git a/microservices-connector/templates/MicroChatQnA/gmc-rbac.yaml b/microservices-connector/templates/MicroChatQnA/gmc-rbac.yaml deleted file mode 100644 index 80879a0c..00000000 --- a/microservices-connector/templates/MicroChatQnA/gmc-rbac.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: ServiceAccount -metadata: - name: gmc-service-sa ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: gmc-service-role -rules: -- apiGroups: [""] - resources: ["pods"] - verbs: ["get", "list", "watch", "create", "delete"] ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: gmc-service-rolebinding -subjects: -- kind: ServiceAccount - name: gmc-service-sa -roleRef: - kind: Role - name: gmc-service-role - apiGroup: rbac.authorization.k8s.io diff --git a/microservices-connector/templates/MicroChatQnA/gmc-secret.yaml b/microservices-connector/templates/MicroChatQnA/gmc-secret.yaml deleted file mode 100644 index d1a43d6a..00000000 --- a/microservices-connector/templates/MicroChatQnA/gmc-secret.yaml +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Secret -metadata: - name: gmc-tokens -type: Opaque -data: - huggingfacehub_api_token: "insert-your-huggingface-token-here" - openai_api_token: "insert-your-openai-api-token-here" diff --git a/microservices-connector/templates/MicroChatQnA/qna-and-redis.yaml b/microservices-connector/templates/MicroChatQnA/qna-and-redis.yaml deleted file mode 100644 index eb4e98b3..00000000 --- a/microservices-connector/templates/MicroChatQnA/qna-and-redis.yaml +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: redis-vector-db -spec: - selector: - app: redis-vector-db - ports: - - name: poredis - protocol: TCP - port: 6379 - targetPort: 6379 - - name: poserver - protocol: TCP - port: 8001 - targetPort: 8001 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: redis-vector-db -spec: - replicas: 1 - selector: - matchLabels: - app: redis-vector-db - template: - metadata: - labels: - app: redis-vector-db - spec: - serviceAccountName: gmc-service-sa - containers: - - name: redis-vector-db - image: redis/redis-stack:7.2.0-v9 - ports: - - containerPort: 6379 - name: poredis - - containerPort: 8001 - name: poserver ---- -apiVersion: v1 -kind: Service -metadata: - name: retriever-redis-server -spec: - selector: - app: retriever-redis-server - ports: - - protocol: TCP - port: 7000 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: retriever-redis-server -spec: - replicas: 1 - selector: - matchLabels: - app: retriever-redis-server - template: - metadata: - labels: - app: retriever-redis-server - spec: - containers: - - name: retriever-redis-server - image: zhlsunshine/gen-ai-comps:retriever-redis-server - ports: - - containerPort: 7000 - env: - - name: http_proxy - value: ${http_proxy} - - name: https_proxy - value: ${https_proxy} - - name: no_proxy - value: ${no_proxy} - - name: REDIS_URL - value: ${REDIS_URL} - - name: INDEX_NAME - value: ${INDEX_NAME} - - name: TEI_EMBEDDING_ENDPOINT - value: ${TEI_EMBEDDING_ENDPOINT} diff --git a/microservices-connector/templates/MicroChatQnA/text-embeddings-inference.yaml b/microservices-connector/templates/MicroChatQnA/text-embeddings-inference.yaml deleted file mode 100644 index 7a452680..00000000 --- a/microservices-connector/templates/MicroChatQnA/text-embeddings-inference.yaml +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: tei-embedding-service -spec: - ports: - - port: 6006 - targetPort: 80 - selector: - app: tei-embedding-service ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: tei-embedding-server -spec: - replicas: 1 - selector: - matchLabels: - app: tei-embedding-service - template: - metadata: - labels: - app: tei-embedding-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: tei-embedding-server - image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.2 - imagePullPolicy: IfNotPresent - args: - - "--model-id" - - ${EMBEDDING_MODEL_ID} - ports: - - containerPort: 80 - volumeMounts: - - name: tei-data - mountPath: /data - env: - - name: http_proxy - value: ${http_proxy} - - name: https_proxy - value: ${https_proxy} - - name: no_proxy - value: ${no_proxy} - - name: HUGGINGFACEHUB_API_TOKEN - valueFrom: - secretKeyRef: - name: ${GMC_TOKEN_SECRET} - key: huggingfacehub_api_token - volumes: - - name: tei-data - hostPath: - path: ${EMBEDDING_MODEL_DIR} ---- -apiVersion: v1 -kind: Service -metadata: - name: embedding-service -spec: - ports: - - port: 6000 - targetPort: 6000 - selector: - app: embedding-service ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: embedding-server -spec: - replicas: 1 - selector: - matchLabels: - app: embedding-service - template: - metadata: - labels: - app: embedding-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: embedding-server - image: zhlsunshine/gen-ai-comps:embedding-tei-server - imagePullPolicy: IfNotPresent - ports: - - containerPort: 6000 - env: - - name: http_proxy - value: ${http_proxy} - - name: https_proxy - value: ${https_proxy} - - name: no_proxy - value: ${no_proxy} - - name: TEI_EMBEDDING_ENDPOINT - value: ${TEI_EMBEDDING_ENDPOINT} diff --git a/microservices-connector/templates/MicroChatQnA/text-generation-inference.yaml b/microservices-connector/templates/MicroChatQnA/text-generation-inference.yaml deleted file mode 100644 index e93a2f04..00000000 --- a/microservices-connector/templates/MicroChatQnA/text-generation-inference.yaml +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: tgi-service -spec: - selector: - app: tgi-service - ports: - - protocol: TCP - port: 9009 - targetPort: 80 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: tgi-server -spec: - replicas: 1 - selector: - matchLabels: - app: tgi-service - template: - metadata: - labels: - app: tgi-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: tgi-server - image: ghcr.io/huggingface/text-generation-inference:1.4 - imagePullPolicy: IfNotPresent - ports: - - containerPort: 80 - env: - - name: http_proxy - value: ${http_proxy} - - name: https_proxy - value: ${https_proxy} - - name: no_proxy - value: ${no_proxy} - - name: HUGGINGFACEHUB_API_TOKEN - valueFrom: - secretKeyRef: - name: ${GMC_TOKEN_SECRET} - key: huggingfacehub_api_token - volumeMounts: - - name: tgi-data - mountPath: /data - args: - - "--model-id" - - ${LLM_MODEL_ID} - - "--max-total-tokens" - - "4096" - - "--max-input-length" - - "4095" - volumes: - - name: tgi-data - hostPath: - path: ${LLM_MODEL_DIR} ---- -apiVersion: v1 -kind: Service -metadata: - name: llm-service -spec: - selector: - app: llm-service - ports: - - protocol: TCP - port: 9000 - targetPort: 9000 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: llm-server -spec: - replicas: 1 - selector: - matchLabels: - app: llm-service - template: - metadata: - labels: - app: llm-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: llm-server - image: zhlsunshine/gen-ai-comps:llm-tgi-server - imagePullPolicy: IfNotPresent - ports: - - containerPort: 9000 - env: - - name: http_proxy - value: ${http_proxy} - - name: https_proxy - value: ${https_proxy} - - name: no_proxy - value: ${no_proxy} - - name: TGI_LLM_ENDPOINT - value: ${TGI_LLM_ENDPOINT} - - name: HUGGINGFACEHUB_API_TOKEN - valueFrom: - secretKeyRef: - name: ${GMC_TOKEN_SECRET} - key: huggingfacehub_api_token diff --git a/microservices-connector/templates/MicroChatQnA/text-reranking-inference.yaml b/microservices-connector/templates/MicroChatQnA/text-reranking-inference.yaml deleted file mode 100644 index 81dd8fef..00000000 --- a/microservices-connector/templates/MicroChatQnA/text-reranking-inference.yaml +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: v1 -kind: Service -metadata: - name: tei-reranking-service -spec: - ports: - - port: 8808 - targetPort: 80 - selector: - app: tei-reranking-service ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: tei-reranking-server -spec: - replicas: 1 - selector: - matchLabels: - app: tei-reranking-service - template: - metadata: - labels: - app: tei-reranking-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: tei-reranking-server - image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.2 - imagePullPolicy: IfNotPresent - args: - - "--model-id" - - ${RERANK_MODEL_ID} - ports: - - containerPort: 80 - volumeMounts: - - name: rerank-data - mountPath: /data - env: - - name: http_proxy - value: ${http_proxy} - - name: https_proxy - value: ${https_proxy} - - name: no_proxy - value: ${no_proxy} - - name: HUGGINGFACEHUB_API_TOKEN - valueFrom: - secretKeyRef: - name: ${GMC_TOKEN_SECRET} - key: huggingfacehub_api_token - volumes: - - name: rerank-data - hostPath: - path: ${RERANK_MODEL_DIR} ---- -apiVersion: v1 -kind: Service -metadata: - name: reranking-service -spec: - ports: - - port: 8000 - targetPort: 8000 - selector: - app: reranking-service ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: reranking-server -spec: - replicas: 1 - selector: - matchLabels: - app: reranking-service - template: - metadata: - labels: - app: reranking-service - spec: - serviceAccountName: gmc-service-sa - containers: - - name: reranking-server - image: zhlsunshine/gen-ai-comps:reranking-tei-xeon-server - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8000 - env: - - name: http_proxy - value: ${http_proxy} - - name: https_proxy - value: ${https_proxy} - - name: no_proxy - value: ${no_proxy} - - name: TEI_RERANKING_ENDPOINT - value: ${TEI_RERANKING_ENDPOINT} - - name: HUGGINGFACEHUB_API_TOKEN - valueFrom: - secretKeyRef: - name: ${GMC_TOKEN_SECRET} - key: huggingfacehub_api_token From 07a6c2159a8a7a23aa378dbbd0d1bd830beafa1f Mon Sep 17 00:00:00 2001 From: zhlsunshine Date: Tue, 4 Jun 2024 15:31:47 +0800 Subject: [PATCH 2/6] change code based on comments. Signed-off-by: zhlsunshine --- .../{samples => }/gmcrouter/gmc-router.yaml | 0 .../gmcmanager => manager}/gmc-manager.yaml | 0 .../gmcmanager => rbac}/gmc-manager-rbac.yaml | 0 .../internal/controller/gmconnector_controller.go | 15 ++++++++++----- 4 files changed, 10 insertions(+), 5 deletions(-) rename microservices-connector/config/{samples => }/gmcrouter/gmc-router.yaml (100%) rename microservices-connector/config/{samples/gmcmanager => manager}/gmc-manager.yaml (100%) rename microservices-connector/config/{samples/gmcmanager => rbac}/gmc-manager-rbac.yaml (100%) diff --git a/microservices-connector/config/samples/gmcrouter/gmc-router.yaml b/microservices-connector/config/gmcrouter/gmc-router.yaml similarity index 100% rename from microservices-connector/config/samples/gmcrouter/gmc-router.yaml rename to microservices-connector/config/gmcrouter/gmc-router.yaml diff --git a/microservices-connector/config/samples/gmcmanager/gmc-manager.yaml b/microservices-connector/config/manager/gmc-manager.yaml similarity index 100% rename from microservices-connector/config/samples/gmcmanager/gmc-manager.yaml rename to microservices-connector/config/manager/gmc-manager.yaml diff --git a/microservices-connector/config/samples/gmcmanager/gmc-manager-rbac.yaml b/microservices-connector/config/rbac/gmc-manager-rbac.yaml similarity index 100% rename from microservices-connector/config/samples/gmcmanager/gmc-manager-rbac.yaml rename to microservices-connector/config/rbac/gmc-manager-rbac.yaml diff --git a/microservices-connector/internal/controller/gmconnector_controller.go b/microservices-connector/internal/controller/gmconnector_controller.go index 8d108d74..b4c9a177 100644 --- a/microservices-connector/internal/controller/gmconnector_controller.go +++ b/microservices-connector/internal/controller/gmconnector_controller.go @@ -73,10 +73,14 @@ func reconcileResource(step string, ns string, svc string, svcCfg *map[string]st //TODO add validation to rule out unexpected case like both embedding and retrieving if step == "Configmap" { tmpltFile = yaml_dir + "/qna_configmap_xeon.yaml" + } else if step == "ConfigmapGaudi" { + tmpltFile = yaml_dir + "/qna_configmap_gaudi.yaml" } else if step == "Embedding" { tmpltFile = yaml_dir + "/embedding.yaml" } else if step == "TeiEmbedding" { tmpltFile = yaml_dir + "/tei_embedding_service.yaml" + } else if step == "TeiEmbeddingGaudi" { + tmpltFile = yaml_dir + "/tei_embedding_gaudi_service.yaml" } else if step == "VectorDB" { tmpltFile = yaml_dir + "/redis-vector-db.yaml" } else if step == "Retriever" { @@ -87,6 +91,8 @@ func reconcileResource(step string, ns string, svc string, svcCfg *map[string]st tmpltFile = yaml_dir + "/tei_reranking_service.yaml" } else if step == "Tgi" { tmpltFile = yaml_dir + "/tgi_service.yaml" + } else if step == "TgiGaudi" { + tmpltFile = yaml_dir + "/tgi_gaudi_service.yaml" } else if step == "Llm" { tmpltFile = yaml_dir + "/llm.yaml" } else if step == "router" { @@ -188,7 +194,7 @@ func getServiceURL(service *corev1.Service) string { func getCustomConfig(step string, svcCfg *map[string]string, yamlFile []byte) (string, error) { var userDefinedCfg interface{} - if step == "Configmap" { + if step == "Configmap" || step == "ConfigmapGaudi" { return string(yamlFile), nil } else if step == "Embedding" { userDefinedCfg = EmbeddingCfg{ @@ -198,10 +204,9 @@ func getCustomConfig(step string, svcCfg *map[string]string, yamlFile []byte) (s } } else if step == "TeiEmbedding" { userDefinedCfg = TeiEmbeddingCfg{ - EmbeddingModelId: (*svcCfg)["modelId"], - NoProxy: (*svcCfg)["no_proxy"], - HttpProxy: (*svcCfg)["http_proxy"], - HttpsProxy: (*svcCfg)["https_proxy"], + NoProxy: (*svcCfg)["no_proxy"], + HttpProxy: (*svcCfg)["http_proxy"], + HttpsProxy: (*svcCfg)["https_proxy"], } } else if step == "VectorDB" { userDefinedCfg = nil From 637871a82168355f5d7fe7c9eccc37f749b18567 Mon Sep 17 00:00:00 2001 From: zhlsunshine Date: Wed, 5 Jun 2024 10:11:51 +0800 Subject: [PATCH 3/6] update redis service name. Signed-off-by: zhlsunshine --- microservices-connector/config/samples/chatQnA_v2.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microservices-connector/config/samples/chatQnA_v2.yaml b/microservices-connector/config/samples/chatQnA_v2.yaml index e88df854..83791ba0 100644 --- a/microservices-connector/config/samples/chatQnA_v2.yaml +++ b/microservices-connector/config/samples/chatQnA_v2.yaml @@ -53,7 +53,7 @@ spec: - name: VectorDB internalService: nameSpace: chatqa - serviceName: redis-vector-db + serviceName: redis-service isDownstreamService: true - name: Reranking data: $response From baefcac22fb310712c9ee3134cc9759663fdbee6 Mon Sep 17 00:00:00 2001 From: zhlsunshine Date: Wed, 5 Jun 2024 10:33:34 +0800 Subject: [PATCH 4/6] change yaml files based on comments. Signed-off-by: zhlsunshine --- .../config/samples/chatQnA.yaml | 39 --------- .../{chatQnA_v2.yaml => chatQnA_xeon.yaml} | 26 ------ .../samples/gmc_v1alpha3_gmconnector.yaml | 82 ------------------- 3 files changed, 147 deletions(-) delete mode 100644 microservices-connector/config/samples/chatQnA.yaml rename microservices-connector/config/samples/{chatQnA_v2.yaml => chatQnA_xeon.yaml} (58%) delete mode 100644 microservices-connector/config/samples/gmc_v1alpha3_gmconnector.yaml diff --git a/microservices-connector/config/samples/chatQnA.yaml b/microservices-connector/config/samples/chatQnA.yaml deleted file mode 100644 index 3e7d4200..00000000 --- a/microservices-connector/config/samples/chatQnA.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: gmc.opea.io/v1alpha3 -kind: GMConnector -metadata: - labels: - app.kubernetes.io/name: gmconnector - app.kubernetes.io/managed-by: kustomize - name: gmconnector-sample - namespace: gmcsample -spec: - nodes: - root: - routerType: Sequence - steps: - - name: embedding - target: - embedding: - embedderService: - modelId: BAAI/bge-base-en-v1.5 - name: someEmbedder - - name: retrieving - target: - retrieving: - vectorDbService: - type: REDIS - data: $response - - name: reranking - target: - reranking: - rerankerService: - name: someReranker - modelId: BAAI/bge-reranker-large - data: $response - - name: llm - target: - lLM: - runtimeService: tgiGaudi diff --git a/microservices-connector/config/samples/chatQnA_v2.yaml b/microservices-connector/config/samples/chatQnA_xeon.yaml similarity index 58% rename from microservices-connector/config/samples/chatQnA_v2.yaml rename to microservices-connector/config/samples/chatQnA_xeon.yaml index 83791ba0..8e6ecc15 100644 --- a/microservices-connector/config/samples/chatQnA_v2.yaml +++ b/microservices-connector/config/samples/chatQnA_xeon.yaml @@ -14,10 +14,6 @@ spec: name: router nameSpace: chatqa serviceName: router-service - config: - no_proxy: ".chatqa.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" nodes: root: routerType: Sequence @@ -27,18 +23,11 @@ spec: nameSpace: chatqa serviceName: embedding-svc config: - no_proxy: ".chatqa.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" endpoint: /v1/embeddings - name: TeiEmbedding internalService: nameSpace: chatqa serviceName: tei-embedding-svc - config: - no_proxy: ".chatqa.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" isDownstreamService: true - name: Retriever data: $response @@ -46,9 +35,6 @@ spec: nameSpace: chatqa serviceName: retriever-svc config: - no_proxy: ".chatqa.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" endpoint: /v1/retrieval - name: VectorDB internalService: @@ -61,18 +47,12 @@ spec: nameSpace: chatqa serviceName: reranking-svc config: - no_proxy: ".chatqa.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" endpoint: /v1/reranking - name: TeiReranking internalService: nameSpace: chatqa serviceName: tei-reranking-svc config: - no_proxy: ".chatqa.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" endpoint: /rerank isDownstreamService: true - name: Llm @@ -81,17 +61,11 @@ spec: nameSpace: chatqa serviceName: llm-svc config: - no_proxy: ".chatqa.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" endpoint: /v1/chat/completions - name: Tgi internalService: nameSpace: chatqa serviceName: tgi-svc config: - no_proxy: ".chatqa.svc.cluster.local" - http_proxy: "insert-your-http-proxy-here" - https_proxy: "insert-your-https-proxy-here" endpoint: /generate isDownstreamService: true diff --git a/microservices-connector/config/samples/gmc_v1alpha3_gmconnector.yaml b/microservices-connector/config/samples/gmc_v1alpha3_gmconnector.yaml deleted file mode 100644 index 956229dc..00000000 --- a/microservices-connector/config/samples/gmc_v1alpha3_gmconnector.yaml +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: gmc.opea.io/v1alpha3 -kind: GMConnector -metadata: - labels: - app.kubernetes.io/name: gmconnector - app.kubernetes.io/managed-by: kustomize - name: gmconnector-sample -spec: - nodes: - rag: - routerType: Sequence - steps: - - name: embd - nodeName: rtrv - target: - serviceName: embeddingSvc - embedding: - embedderService: - modelId: embd-model-id - name: someEmbder - data: $request - - name: rtrv - nodeName: rrnk - target: - serviceName: retrivingSvc - retrieving: - vectorDbService: - type: sometype - - name: rrnk - nodeName: llm - target: - serviceName: rerankingSvc - reranking: - rerankerService: - name: someReranker - modelId: reranker-model-id - - name: llm - target: - serviceName: llmSvc - lLM: - runtimeService: tgiGaudi - ingest: - routerType: Sequence - steps: - - name: embd - nodeName: rtrv - target: - serviceName: embeddingSvc - embedding: - embedderService: - modelId: embd-model-id - name: someEmbder - data: $request - - name: rtrv - nodeName: rrnk - target: - serviceName: retrivingSvc - retrieving: - vectorDbService: - type: sometype - bookinfo: - routerType: Sequence - steps: - - name: step1 - nodeName: rtrv - target: - serviceName: ratings - embedding: - embedderService: - modelId: embd-model-id - name: someEmbder - data: $request - - name: rtrv - nodeName: rrnk - target: - serviceName: reviews - retrieving: - vectorDbService: - type: sometype From 47a20bb59c3c6979f85af7c81dd54345c3aeefe4 Mon Sep 17 00:00:00 2001 From: zhlsunshine Date: Wed, 5 Jun 2024 11:18:17 +0800 Subject: [PATCH 5/6] change redis vectorDB svc name. Signed-off-by: zhlsunshine --- microservices-connector/config/samples/chatQnA_xeon.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microservices-connector/config/samples/chatQnA_xeon.yaml b/microservices-connector/config/samples/chatQnA_xeon.yaml index 8e6ecc15..b8fea42c 100644 --- a/microservices-connector/config/samples/chatQnA_xeon.yaml +++ b/microservices-connector/config/samples/chatQnA_xeon.yaml @@ -39,7 +39,7 @@ spec: - name: VectorDB internalService: nameSpace: chatqa - serviceName: redis-service + serviceName: redis-vector-db isDownstreamService: true - name: Reranking data: $response From 0e4ad6a17cfe64cbaf769e0784af1fe9eb7ff52c Mon Sep 17 00:00:00 2001 From: zhlsunshine Date: Wed, 5 Jun 2024 14:41:49 +0800 Subject: [PATCH 6/6] integrate with oneclick and complete the test on stag-opea-07. Signed-off-by: zhlsunshine --- .../internal/controller/gmconnector_controller.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/microservices-connector/internal/controller/gmconnector_controller.go b/microservices-connector/internal/controller/gmconnector_controller.go index b4c9a177..da640d1e 100644 --- a/microservices-connector/internal/controller/gmconnector_controller.go +++ b/microservices-connector/internal/controller/gmconnector_controller.go @@ -122,14 +122,10 @@ func reconcileResource(step string, ns string, svc string, svcCfg *map[string]st } resources = strings.Split(appliedCfg, "---") fmt.Printf("The raw yaml file has been splitted into %v yaml files", len(resources)) - if len(resources) >= 2 { - resources = resources[1:] - } - decUnstructured := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme) for _, res := range resources { - if res == "" { + if res == "" || !strings.Contains(res, "kind:") { continue }