UNPKG

@gati-framework/cli

Version:

CLI tool for Gati framework - create, develop, build and deploy cloud-native applications

211 lines 5.68 kB
/** * @module runtime/deployment/kubernetes * @description Kubernetes deployment manifest generator for Gati applications */ import type { DockerfileConfig, DeploymentConfig, ServiceConfig, HPAConfig, IngressConfig, HelmChartConfig, DeploymentManifests, DeploymentEnvironment, ContainerResources, EnvironmentVariable } from './types'; /** * Generate Dockerfile for Gati application * * @param config - Dockerfile configuration * @returns Generated Dockerfile content * * @example * ```typescript * const dockerfile = generateDockerfile({ * nodeVersion: '20', * appName: 'my-gati-app', * port: 3000, * startCommand: 'pnpm start' * }); * ``` */ export declare function generateDockerfile(config: DockerfileConfig): string; /** * Generate Kubernetes Deployment manifest * * @param config - Deployment configuration * @returns Generated Deployment YAML * * @example * ```typescript * const deployment = generateDeployment({ * name: 'my-app', * namespace: 'default', * replicas: 3, * image: 'my-app:latest', * imagePullPolicy: 'IfNotPresent', * containerPort: 3000, * env: [], * resources: { * limits: { cpu: '1000m', memory: '512Mi' }, * requests: { cpu: '500m', memory: '256Mi' } * } * }); * ``` */ export declare function generateDeployment(config: DeploymentConfig): string; /** * Generate Kubernetes Service manifest * * @param config - Service configuration * @returns Generated Service YAML * * @example * ```typescript * const service = generateService({ * name: 'my-app', * namespace: 'default', * type: 'LoadBalancer', * port: 80, * targetPort: 3000, * selector: { app: 'my-app' } * }); * ``` */ export declare function generateService(config: ServiceConfig): string; /** * Generate Kubernetes HPA (Horizontal Pod Autoscaler) manifest * * @param config - HPA configuration * @returns Generated HPA YAML * * @example * ```typescript * const hpa = generateHPA({ * name: 'my-app', * namespace: 'default', * targetDeployment: 'my-app', * minReplicas: 2, * maxReplicas: 10, * targetCPUUtilizationPercentage: 70, * targetMemoryUtilizationPercentage: 80 * }); * ``` */ export declare function generateHPA(config: HPAConfig): string; /** * Generate Kubernetes Ingress manifest * * @param config - Ingress configuration * @returns Generated Ingress YAML * * @example * ```typescript * const ingress = generateIngress({ * name: 'my-app', * namespace: 'default', * ingressClassName: 'nginx', * rules: [{ * host: 'api.example.com', * paths: [{ * path: '/', * pathType: 'Prefix', * serviceName: 'my-app', * servicePort: 80 * }] * }], * tls: [{ * hosts: ['api.example.com'], * secretName: 'my-app-tls' * }] * }); * ``` */ export declare function generateIngress(config: IngressConfig): string; /** * Generate Helm Chart files * * @param config - Helm chart configuration * @returns Object containing all Helm chart files * * @example * ```typescript * const helmChart = generateHelmChart({ * name: 'my-app', * version: '1.0.0', * appVersion: '1.0.0', * description: 'My Gati Application', * values: { replicaCount: 3, ... } * }); * ``` */ export declare function generateHelmChart(config: HelmChartConfig): { chartYaml: string; valuesYaml: string; deploymentTemplate: string; serviceTemplate: string; configMapTemplate: string; secretTemplate: string; helpersTemplate: string; serviceAccountTemplate: string; hpaTemplate: string; }; /** * Validate Kubernetes manifest YAML syntax * * @param yaml - YAML content to validate * @returns True if valid, throws error if invalid * * @throws {Error} If YAML is invalid */ export declare function validateManifest(yaml: string): boolean; /** * Get default resource configuration for environment * * @param env - Deployment environment * @returns Resource configuration */ export declare function getDefaultResources(env: DeploymentEnvironment): ContainerResources; /** * Get default environment variables for Gati app * * @param env - Deployment environment * @param port - Application port * @returns Array of environment variables */ export declare function getDefaultEnvironment(env: DeploymentEnvironment, port: number): EnvironmentVariable[]; /** * Generate complete deployment manifests for a Gati application * * @param appName - Application name * @param namespace - Kubernetes namespace * @param env - Deployment environment * @param options - Additional configuration options * @returns Complete set of deployment manifests * * @example * ```typescript * const manifests = generateCompleteManifests( * 'my-app', * 'default', * 'production', * { * nodeVersion: '20', * port: 3000, * replicas: 3, * image: 'my-registry/my-app:v1.0.0' * } * ); * ``` */ export declare function generateCompleteManifests(appName: string, namespace: string, env: DeploymentEnvironment, options?: { nodeVersion?: string; port?: number; replicas?: number; image?: string; startCommand?: string; buildCommand?: string; serviceType?: 'ClusterIP' | 'LoadBalancer' | 'NodePort'; enableAutoscaling?: boolean; minReplicas?: number; maxReplicas?: number; targetCPUUtilization?: number; targetMemoryUtilization?: number; enableIngress?: boolean; ingressHost?: string; ingressClassName?: string; enableTLS?: boolean; tlsSecretName?: string; additionalEnv?: EnvironmentVariable[]; }): DeploymentManifests; //# sourceMappingURL=kubernetes.d.ts.map