Sign inSign up

getdtk/controller-workflow-executor

By getdtk

Updated about 6 years ago

Image
0

8.6K

getdtk/controller-workflow-executor repository overview

Controller Workflow Executor

This repo has dependencies on several dtk repos:

  1. Stub remote executor: https://github.com/dtk/cwe-grpc-client-server
  2. Comm interface npm module: https://github.com/dtk/comm-interface

Stub remote executor and cwe-grpc-client-server mentioned below are synonyms.

Prerequisites

Start minikube

  1. Install minikube
  2. Start minikube
minikube start

No additional setup for minikube is required

Local Setup

  1. After cloning do:
npm install
  1. Execute script that installs kube resources:
cd ./workflow_with_node_group_components
bash init_kube_resources.sh -m apply
cd ..

Available mode (-m) parameters are:

  • apply
Creates necessary namespaces, custom resource definitions and resource instances
  • recreate
Deletes and then applies component and action instances
Note: apply must be executed first
  • delete
Deletes every resource it created starting with namespaces
  1. Create .env file and populate it according to info provided in example.env

  2. Setup stub remote executor by following these steps

  3. Change the following client config properties to match the ones in stub remote executor server config properties.

Execution

To execute, follow execution section in stub remote executor repo.

Execution status can be checked by executing:

$ kubectl get actions -n test
NAME                           AGE
create-component-group-test1   19m

kubectl get action -n test create-component-group-test1 -o yaml -w

Kubernetes Deployment

Assuming user pulled workflow executor repo.

Start stub remote executor kube deployment

git clone [email protected]:dtk/cwe-grpc-client-server.git
cd cwe-grpc-client-server
npm install

Apply stub remote executor service:

bash apply-service.sh

service/stub-remote-executor created
http://{ip}:32422
Add above address and port to controller workflow executor 'config/grpc.ts' client data

Apply controller workflow executor service, in controller workflow executor dir:

cd kube-cwe-resources
bash apply-service.sh

service/cwe created
http://{ip}:31038
Add above address and port to stub remote executor 'config/grpc.ts' client data

After editing controller workflow executor and stub remote executor config, push images to docker

- In workflow executor dir:
nano kube-cwe-resources/cwe.yaml
- Change the below image to your username
...
  - name: app-container
    image: {user-name}/c-w-e
    imagePullPolicy: Always
    ports:
      - containerPort: 8083
...
cd ..
docker build -t {user-name}/c-w-e .
docker push {user-name}/c-w-e

- In stub remote executor dir:
nano stub-deployment.yaml
- Change the below image to your username
...
  - name: app-container
    image: {user-name}/stub-remote-executor
    imagePullPolicy: Always
    ports:
      - containerPort: 8082
...
docker build -t {user-name}/stub-remote-executor .
docker push {user-name}/stub-remote-executor

create service account and apply deployment (in stub remote executor dir)

kubectl create serviceaccount api-service-account
kubectl apply -f stub-deployment.yaml

kubectl get pods -w
NAME                                    READY   STATUS    RESTARTS   AGE
stub-remote-executor-5867ccddc4-7hsxz   1/1     Running   0          31s

After pod is running, check if log output is similar to the following

$ kubectl logs -c app-container -f stub-remote-executor-5867ccddc4-7hsxz
server started:  Server {
  handlers:
   { '/pckg_executable_action.ActionRequest/StreamAction':
      ...,
  _server: Server {},
  started: true }

Start controller workflow executor kube deployment

Navigate to workflow executor dir.

  1. Execute script that installs kube resources:
cd ./workflow_with_node_group_components
bash init_kube_resources.sh -m apply
cd ..
  1. Execute script that applies necessary kube resources:
cd ./kube-cwe-resources
bash apply-cwe.sh
cd ..

If pod is running

kubectl get pods -w
NAME                                    READY   STATUS    RESTARTS   AGE
stub-remote-executor-5867ccddc4-7hsxz   1/1     Running   0          2m56s
cwe-5849d9cdc9-p6z9l                    1/1     Running   0          28s

check if log output is similar to the following

$ kubectl logs -c app-container -f cwe-5849d9cdc9-p6z9l 
server started:  Server {
  handlers:
   { '/pckg_executable_action.ActionRequest/StreamAction':
      ...,
  _server: Server {},
  started: true }

In stub remote executor repo do:

npm run send

while watching logs of both pods.

Check status of steps in:

kubectl get action -n test create-component-group-test1 -o yaml

Tag summary

Content type

Image

Digest

Size

126.2 MB

Last updated

over 6 years ago

docker pull getdtk/controller-workflow-executor