Module : kubernetes

Module Overview

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

Annotation Usage Sample:

import ballerina/http;
import ballerina/log;
import ballerinax/kubernetes;

@kubernetes:Ingress{
    hostname: "abc.com"
}
@kubernetes:Service {
    name:"hello"
}
listener http:Listener helloEP = new(9090);

@kubernetes:Deployment {
    livenessProbe: true
}
@http:ServiceConfig {
    basePath: "/helloWorld"
}
service helloWorld on helloEP {
    resource function sayHello(http:Caller caller, http:Request request) {
        http:Response response = new;
        response.setTextPayload("Hello, World from service helloWorld ! ");
        var responseResult = caller->respond(response);
        if (responseResult is error) {
            log:printError("error responding back to client.", err = responseResult);
        }
    }
}

Records

BuildExtension Extend building of the docker image.
ConfigMap Kubernetes Config Map volume mount.
ConfigMapKeyRef Value from config map key.
ConfigMapKeyValue Value for config map key.
ConfigMapMount Secret volume mount configurations for kubernetes.
DeploymentConfiguration Kubernetes deployment configuration.
FieldRef Value from field.
FieldValue Value for a field.
FileConfig External file type for docker.
IngressConfiguration Kubernetes ingress configuration.
JobConfig Kubernetes job configuration.
Metadata Metadata for artifacts
OpenShiftBuildConfigConfiguration Build Config configuration for OpenShift.
PersistentVolumeClaimConfig Kubernetes Persistent Volume Claim.
PersistentVolumeClaims Persistent Volume Claims configurations for kubernetes.
PodAutoscalerConfig Kubernetes Horizontal Pod Autoscaler configuration
PodTolerationConfiguration Pod toleration configuration.
ProbeConfiguration Probing configuration.
ResourceFieldRef Value from resource field.
ResourceFieldValue Value for resource field.
ResourceQuotaConfig Kubernetes Resource Quota
ResourceQuotas Resource Quota configuration for kubernetes.
Secret Kubernetes secret volume mount.
SecretKeyRef Value from secret key.
SecretKeyValue Value for a secret key.
SecretMount Secret volume mount configurations for kubernetes.
ServiceConfiguration Kubernetes service configuration.

Constants

IMAGE_PULL_POLICY_IF_NOT_PRESENT
IMAGE_PULL_POLICY_ALWAYS
IMAGE_PULL_POLICY_NEVER
SESSION_AFFINITY_NONE
SESSION_AFFINITY_CLIENT_IP
SERVICE_TYPE_NORD_PORT
SERVICE_TYPE_CLUSTER_IP
SERVICE_TYPE_LOAD_BALANCER
RESTART_POLICY_ON_FAILURE
RESTART_POLICY_ALWAYS
RESTART_POLICY_NEVER

Annotations

ConfigMap

@kubernetes:ConfigMap annotation to configure config maps.

Deployment

@kubernetes:Deployment annotation to configure deplyoment yaml.

HPA

@kubernetes:HPA annotation to configure horizontal pod autoscaler yaml.

Ingress

@kubernetes:Ingress annotation to configure ingress yaml.

Job

@kubernetes:Job annotation to configure kubernetes jobs.

PersistentVolumeClaim

@kubernetes:PersistentVolumeClaim annotation to configure Persistent Volume Claims.

ResourceQuota

@kubernetes:ResourcesQuotas annotation to configure Resource Quotas.

Secret

@kubernetes:Secret annotation to configure secrets.

Service

@kubernetes:Service annotation to configure service yaml.