Module : kubernetes

Version : 1.0.0

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

ConfigMap 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.

ProjectedVolumeMount

Projected volume mount configurations for kubernetes.

PrometheusConfig

Prometheus port configuration.

ResourceFieldRef

Value from resource field.

ResourceFieldValue

Value for resource field.

ResourceQuotaConfig

Kubernetes Resource Quota

ResourceQuotas

Resource Quota configuration for kubernetes.

RollingUpdateConfig

Rolling Update config type field for deployment.

Secret

Kubernetes secret volume mount.

SecretKeyRef

Value from secret key.

SecretKeyValue

Value for a secret key.

SecretMount

Secret volume mount configurations for kubernetes.

ServiceAccountToken

Service account token configurations for kubernetes.

ServiceConfiguration

Kubernetes service configuration.

Constants

IMAGE_PULL_POLICY_IF_NOT_PRESENT

Pull image if it is not present for deployment or job.

IMAGE_PULL_POLICY_ALWAYS

Always pull the image for knative service for deployment or job.

IMAGE_PULL_POLICY_NEVER

Never pull the image for deployment or job.

STRATEGY_RECREATE
STRATEGY_ROLLING_UPDATE
SESSION_AFFINITY_NONE

Disable session affinity on pods.

SESSION_AFFINITY_CLIENT_IP

Enable session affinity on pods.

SERVICE_TYPE_NORD_PORT

Node port type service.

SERVICE_TYPE_CLUSTER_IP

Cluster IP type service.

SERVICE_TYPE_LOAD_BALANCER

Load balancer type service.

RESTART_POLICY_ON_FAILURE

Restart on failure policy for jobs.

RESTART_POLICY_ALWAYS

Always restart policy when job is finished.

RESTART_POLICY_NEVER

Never restart policy for jobs.

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.

Types

StrategyRollingType
StrategyType