Skip to content

Gravitate-Health/focusing-manager

Repository files navigation

Focusing Manager

License

Table of contents

Requirements

To let this service to query a kubernetes cluster, the cluster needs a role, serviceaccount and rolebinding to grant permission to query the cluster. These resources are created with the following files:

To apply them:

kubectl apply -f kubernetes-yaml/001_focusing-manager-service-account.yaml
kubectl apply -f kubernetes-yaml/002_focusing-manager-role.yaml
kubectl apply -f kubernetes-yaml/003_focusing-manager-role-binding.yaml

Deployment

The service needs the following environment variables:

  • FOCUSING_LABEL_SELECTOR: The focusing label selector. Kubernetes cluster will filter the services with this label selector. (E.g: FOCUSING_LABEL_SELECTOR="eu.gravitate-health.fosps.focusing=true")
  • PREPROCESSING_LABEL_SELECTOR: The preprocessing label selector. Kubernetes cluster will filter the services with this label selector. (E.g: PREPROCESSING_LABEL_SELECTOR="eu.gravitate-health.fosps.preprocessing=true")

To deploy the service, create the service, deployment and virtual service:

kubectl apply -f kubernetes-yaml/004_focusing-manager-service.yaml
kubectl apply -f kubernetes-yaml/005_focusing-manager-deployment.yaml
kubectl apply -f kubernetes-yaml/006_focusing-manager_vs.yml

And try querying the focusing manager:

curl --location 'https://fosps.gravitatehealth.eu/focusing'

Development

The service can be executed listening for changes under the src directory with:

npm run dev

This service uses the Kubernetes javascript client to query the kubernetes cluster

In production, the service uses the service account to query the cluster. Outside the cluster this is not possible. To develop this service outside the cluster, set the the following enviornment variables (or create a .env file) so the kubernetes client can connect to the cluster:

  • ENVIRONMENT: "dev"
  • CLUSTER_NAME: Cluster name
  • CLUSTER_SERVER: Cluster URL
  • CLUSTER_CADATA: CA data of the cluster
  • USER_NAME: User
  • USER_TOKEN: User token
  • CONTEXT_NAME: Context name

Focusing Flows

According to the specified schema, this service has 4 ways (flows) of focusing the ePIs, depending on which parameters do you use:

  1. ePI id and IPS id (this is the only flow that is currently implemented and working)
  2. ePI id and IPS JSON object.
  3. ePI JSON object and IPS id.
  4. ePI JSON object and IPS JSON object.

Getting help

In case you find a problem or you need extra help, please use the issues tab to report the issue.

Contributing

To contribute, fork this repository and send a pull request with the changes squashed.

License

This project is distributed under the terms of the Apache License, Version 2.0 (AL2). The license applies to this file and other files in the GitHub repository hosting this file.

Copyright 2022 Universidad Politécnica de Madrid

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Authors and history

  • Guillermo Mejías (@gmej)