diff --git a/microservices-connector/templates/MicroChatQnA/gmc-router.yaml b/microservices-connector/config/gmcrouter/gmc-router.yaml similarity index 95% rename from microservices-connector/templates/MicroChatQnA/gmc-router.yaml rename to microservices-connector/config/gmcrouter/gmc-router.yaml index 3c8072ff..04d4f04f 100644 --- a/microservices-connector/templates/MicroChatQnA/gmc-router.yaml +++ b/microservices-connector/config/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/templates/MicroChatQnA/gmc-manager.yaml b/microservices-connector/config/manager/gmc-manager.yaml similarity index 100% rename from microservices-connector/templates/MicroChatQnA/gmc-manager.yaml rename to microservices-connector/config/manager/gmc-manager.yaml diff --git a/microservices-connector/templates/MicroChatQnA/gmc-manager-rbac.yaml b/microservices-connector/config/rbac/gmc-manager-rbac.yaml similarity index 99% rename from microservices-connector/templates/MicroChatQnA/gmc-manager-rbac.yaml rename to microservices-connector/config/rbac/gmc-manager-rbac.yaml index 2f843331..d159693d 100644 --- a/microservices-connector/templates/MicroChatQnA/gmc-manager-rbac.yaml +++ b/microservices-connector/config/rbac/gmc-manager-rbac.yaml @@ -29,6 +29,7 @@ rules: resources: - services - secrets + - configmaps verbs: - create - delete diff --git a/microservices-connector/config/samples/chatQnA.yaml b/microservices-connector/config/samples/chatQnA.yaml deleted file mode 100644 index 76a68688..00000000 --- a/microservices-connector/config/samples/chatQnA.yaml +++ /dev/null @@ -1,106 +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: chatqa - namespace: chatqa -spec: - routerConfig: - name: router - 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 - steps: - - name: Embedding - internalService: - serviceName: embedding-service - 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: - serviceName: tei-embedding-service - 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: - serviceName: retriever-redis-server - 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: - serviceName: redis-vector-db - isDownstreamService: true - - name: Reranking - data: $response - internalService: - serviceName: reranking-service - 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: - serviceName: tei-reranking-service - 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: - serviceName: llm-service - 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: - serviceName: tgi-service - 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/config/samples/chatQnA_xeon.yaml b/microservices-connector/config/samples/chatQnA_xeon.yaml new file mode 100644 index 00000000..89879e12 --- /dev/null +++ b/microservices-connector/config/samples/chatQnA_xeon.yaml @@ -0,0 +1,62 @@ +# 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: chatqa + namespace: chatqa +spec: + routerConfig: + name: router + serviceName: router-service + nodes: + root: + routerType: Sequence + steps: + - name: Embedding + internalService: + serviceName: embedding-svc + config: + endpoint: /v1/embeddings + - name: TeiEmbedding + internalService: + serviceName: tei-embedding-svc + isDownstreamService: true + - name: Retriever + data: $response + internalService: + serviceName: retriever-svc + config: + endpoint: /v1/retrieval + - name: VectorDB + internalService: + serviceName: redis-vector-db + isDownstreamService: true + - name: Reranking + data: $response + internalService: + serviceName: reranking-svc + config: + endpoint: /v1/reranking + - name: TeiReranking + internalService: + serviceName: tei-reranking-svc + config: + endpoint: /rerank + isDownstreamService: true + - name: Llm + data: $response + internalService: + serviceName: llm-svc + config: + endpoint: /v1/chat/completions + - name: Tgi + internalService: + serviceName: tgi-svc + config: + 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 diff --git a/microservices-connector/internal/controller/gmconnector_controller.go b/microservices-connector/internal/controller/gmconnector_controller.go index 78f239b1..830dedfd 100644 --- a/microservices-connector/internal/controller/gmconnector_controller.go +++ b/microservices-connector/internal/controller/gmconnector_controller.go @@ -66,15 +66,19 @@ func getKubeConfig() (*rest.Config, error) { // This is for linting purpose, they are supposed to be removed after reading manifests from oneclick const ( - Embedding = "Embedding" - TeiEmbedding = "TeiEmbedding" - VectorDB = "VectorDB" - Retriever = "Retriever" - Reranking = "Reranking" - TeiReranking = "TeiReranking" - Tgi = "Tgi" - Llm = "Llm" - Router = "router" + Configmap = "Configmap" + ConfigmapGaudi = "ConfigmapGaudi" + Embedding = "Embedding" + TeiEmbedding = "TeiEmbedding" + TeiEmbeddingGaudi = "TeiEmbeddingGaudi" + VectorDB = "VectorDB" + Retriever = "Retriever" + Reranking = "Reranking" + TeiReranking = "TeiReranking" + Tgi = "Tgi" + TgiGaudi = "TgiGaudi" + Llm = "Llm" + Router = "router" ) func reconcileResource(step string, ns string, svc string, svcCfg *map[string]string, retSvc *corev1.Service) error { @@ -84,22 +88,30 @@ 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 == ConfigmapGaudi { + tmpltFile = yaml_dir + "/qna_configmap_gaudi.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 == TeiEmbeddingGaudi { + tmpltFile = yaml_dir + "/tei_embedding_gaudi_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 == TgiGaudi { + tmpltFile = yaml_dir + "/tgi_gaudi_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 { @@ -126,11 +138,11 @@ 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)) decUnstructured := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme) for _, res := range resources { - if res == "" { + if res == "" || !strings.Contains(res, "kind:") { continue } @@ -195,66 +207,52 @@ 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" || step == "ConfigmapGaudi" { + 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"], + 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"], @@ -288,61 +286,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 { @@ -379,7 +362,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) @@ -418,7 +404,7 @@ func (r *GMConnectorReconciler) Reconcile(ctx context.Context, req ctrl.Request) } else { router_ns = graph.Spec.RouterConfig.NameSpace } - err := r.Client.Get(ctx, types.NamespacedName{Namespace: router_ns, Name: graph.Spec.RouterConfig.ServiceName}, routerService) + err = r.Client.Get(ctx, types.NamespacedName{Namespace: router_ns, 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