Skip to content

Commit

Permalink
Hello World Kubernetes By Ballerina
Browse files Browse the repository at this point in the history
  • Loading branch information
abdennour committed Jul 20, 2018
1 parent 1b45ff3 commit 11ad13e
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.balx
*.log
29 changes: 29 additions & 0 deletions hello_kubernetes.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import ballerina/http;
import ballerina/log;
import ballerinax/kubernetes;


@kubernetes:Service {
serviceType: "NodePort",
name: "ballerina-demo"

}
endpoint http:Listener helloListener {
port:8888
};

@kubernetes:Deployment {
enableLiveness: true,
image: "abdennour/ballerina-demo",
name: "ballerina-demo"
}
@http:ServiceConfig {
basePath: "/"
}
service<http:Service> hello bind helloListener {
sayHello (endpoint caller, http:Request request) {
http:Response response = new;
response.setPayload("Hello Kubernetes from elegance.abdennoor.com!");
_ = caller -> respond(response);
}
}
10 changes: 10 additions & 0 deletions kubernetes/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Auto Generated Dockerfile

FROM ballerina/ballerina:0.975.1
LABEL maintainer="dev@ballerina.io"

COPY hello_kubernetes.balx /home/ballerina

EXPOSE 8888

CMD ballerina run hello_kubernetes.balx
43 changes: 43 additions & 0 deletions kubernetes/hello_kubernetes_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
apiVersion: "extensions/v1beta1"
kind: "Deployment"
metadata:
annotations: {}
finalizers: []
labels:
app: "hello_kubernetes"
name: "ballerina-demo"
ownerReferences: []
spec:
replicas: 1
template:
metadata:
annotations: {}
finalizers: []
labels:
app: "hello_kubernetes"
ownerReferences: []
spec:
containers:
- args: []
command: []
env: []
envFrom: []
image: "abdennour/ballerina-demo"
imagePullPolicy: "IfNotPresent"
livenessProbe:
initialDelaySeconds: 10
periodSeconds: 5
tcpSocket:
port: 8888
name: "ballerina-demo"
ports:
- containerPort: 8888
protocol: "TCP"
volumeMounts: []
hostAliases: []
imagePullSecrets: []
initContainers: []
nodeSelector: {}
tolerations: []
volumes: []
20 changes: 20 additions & 0 deletions kubernetes/hello_kubernetes_svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: "v1"
kind: "Service"
metadata:
annotations: {}
finalizers: []
labels:
app: "hello_kubernetes"
name: "ballerina-demo"
ownerReferences: []
spec:
externalIPs: []
loadBalancerSourceRanges: []
ports:
- port: 8888
protocol: "TCP"
targetPort: 8888
selector:
app: "hello_kubernetes"
type: "NodePort"

0 comments on commit 11ad13e

Please sign in to comment.