ballerina/cloud1.0.0

Module Overview

This module offers an annotation based Kubernetes extension implementation for ballerina.

Annotation Usage Sample:

1import ballerina/http;
2import ballerina/log;
3
4listener http:Listener helloEP = new(9090);
5
6service /helloWorld on helloEP {
7 resource function get sayHello(http:Caller caller, http:Request request) {
8 var responseResult = caller->respond("Hello, World from service helloWorld ! ");
9 if (responseResult is error) {
10 log:printError("error responding back to client.", 'error = responseResult);
11 }
12 }
13}

Build the above program with build-option --cloud = k8s to generate kubernetes artifacts.

1
2$> bal build --cloud=k8s hello_world.bal
3
4Compiling source
5 hello_world.bal
6
7Generating executable
8
9Generating artifacts...
10
11 @kubernetes:Service - complete 1/1
12 @kubernetes:Deployment - complete 1/1
13 @kubernetes:HPA - complete 1/1
14 @kubernetes:Docker - complete 2/2
15
16 Execute the below command to deploy the Kubernetes artifacts:
17 kubectl apply -f /Users/anuruddha/workspace/ballerinax/module-ballerina-c2c/samples/sample1/kubernetes
18
19 Execute the below command to access service via NodePort:
20 kubectl expose deployment hello-world-deployment --type=NodePort --name=hello-world-svc-local

Records

[2]

ScheduleConfig

Cron Job Schedule Configuration.

TaskConfig

Task Configuration.

Annotations

[1]

Task

@c2c:Task annotation to configure cron job.