How to trigger a container to be activated by passing a yaml file through another container having it's env variables?

8/2/2019

i have the main container running which runs the swagger application with open api 3.0. Now i want that when i pass a query to this swagger interface it should take the parameters in this yaml file which basically are the environment variables for the other container and it should activate that container. How can i do hat and how should develop project structure(aligning and naming of files & folders) for that? here is the example query:

{
    "workflowName": "ingestion_and_preprocessing",
    "jobs": [
        {
            "jobName": "ingestion",
            "container": {
                "image": "cdi_ingestion",
                "properties": {
                    "scihub_username": "#user#",
                    "scihub_password": "#pw#",
                    "producttype": "S2MSI2A",
                    "platformname": "Sentinel-2",
                    "footprint":"POLYGON((6.3853 51.7592,7.3604 51.7592,7.3604 51.5001,6.3853 51.5001,6.3853 51.7592))",
                    "start_date": "2018-04-01T00:00:00.000Z",
                    "end_date": "2018-10-01T00:00:00.000Z",
                    "max_cloud_cover_percentage": "10"
                },
                "volumes": [
                    {
                        "name": "pvc-cdi-datastore",
                        "mountPath": "/out_data"
                    }
                ]
            }
        },
        {
            "jobName": "preprocessing",
            "container": {
                "image": "cdi_preprocessing",
                "properties": { },
                "volumes": [
                    {
                        "name": "pvc-cdi-datastore",
                        "mountPath": "/in_data"
                    },
                    {
                        "name": "pvc-cdi-datastore",
                        "mountPath": "/out_data"
                    }
                ]
            }
        }
    ]
}

here is how i am running the to-be activated docker container independently.

 docker run --rm -v $(pwd):/out_data \
-e scihub_username=rehans516 \
-e scihub_password=Rehan123 \
-e producttype=S2MSI2A \
-e platformname=Sentinel-2 \
-e start_date=2019-06-09T00:00:00.000Z \
-e end_date=2019-06-12T00:00:00.000Z \
-e days_back=7 \
-e footprint="POLYGON((5.8664000 50.3276000,9.4623000 50.3276000,9.4623000 52.5325000,5.8664000 52.5325000,5.8664000 50.3276000))" \
-e max_cloud_cover_percentage=10 \
-e CDINRW_BASE_URL=10.1.40.11:8081/swagger-ui.html \
-e CDINRW_JOB_ID=3fa85f64-5717-4562-b3fc-2c963f66afa6 \
ingestion

i want that when i pass the above query with parameters it should run the below container but only when i want. How can i do that and that too with minikube/kubernetes?

-- rehan
docker
kubernetes
minikube
swagger-ui
yaml

0 Answers