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:
- Service account YAML file: Creates the service account which will be use by the pods. This service account uses the
image-pull-secret
. - Role YAML file: Creates role with permission to list services.
- Role Binding YAML file: Binds the role to the service account
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
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'
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 nameCLUSTER_SERVER
: Cluster URLCLUSTER_CADATA
: CA data of the clusterUSER_NAME
: UserUSER_TOKEN
: User tokenCONTEXT_NAME
: Context name
According to the specified schema, this service has 4 ways (flows) of focusing the ePIs, depending on which parameters do you use:
- ePI id and IPS id (this is the only flow that is currently implemented and working)
- ePI id and IPS JSON object.
- ePI JSON object and IPS id.
- ePI JSON object and IPS JSON object.
In case you find a problem or you need extra help, please use the issues tab to report the issue.
To contribute, fork this repository and send a pull request with the changes squashed.
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.
- Guillermo Mejías (@gmej)