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;34listener http:Listener helloEP = new(9090);56service /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.
12$> bal build --cloud=k8s hello_world.bal34Compiling source5 hello_world.bal67Generating executable89Generating artifacts...1011 @kubernetes:Service - complete 1/112 @kubernetes:Deployment - complete 1/113 @kubernetes:HPA - complete 1/114 @kubernetes:Docker - complete 2/21516 Execute the below command to deploy the Kubernetes artifacts:17 kubectl apply -f /Users/anuruddha/workspace/ballerinax/module-ballerina-c2c/samples/sample1/kubernetes1819 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. |