UNPKG

@puls-atlas/cli

Version:

The Puls Atlas CLI tool for managing Atlas projects

34 lines 1.68 kB
import { resolveAtlasPlatformRegion } from '../../utils/terraformPlatform.js'; import { normalizeOptionalString } from '../../utils/value.js'; export const DEFAULT_SERVICE_PLATFORM_CLUSTER_NAME = 'atlas-platform-gke'; export const DEFAULT_SERVICE_PLATFORM_NODE_POOL_NAME = 'atlas-platform-workload'; export const resolveServicePlatformDefaultRegion = (_context, serviceRuntimeHints = {}) => normalizeOptionalString(serviceRuntimeHints.cloudRunRegion) ?? resolveAtlasPlatformRegion(serviceRuntimeHints.searchConfig ?? {}); export const createDefaultServicePlatformClusterConfig = (context, serviceConfig, serviceRuntimeHints = {}) => ({ deletionProtection: false, kubernetesVersion: null, location: normalizeOptionalString(serviceConfig.clusterLocation) ?? resolveServicePlatformDefaultRegion(context, serviceRuntimeHints), name: normalizeOptionalString(serviceConfig.clusterName) ?? DEFAULT_SERVICE_PLATFORM_CLUSTER_NAME, privateCluster: false, releaseChannel: 'REGULAR' }); export const createDefaultServicePlatformNodePoolConfig = serviceConfig => ({ diskSizeGb: 100, diskType: 'pd-balanced', machineType: 'e2-standard-2', maxNodeCount: 3, minNodeCount: 1, name: DEFAULT_SERVICE_PLATFORM_NODE_POOL_NAME, nodeLabels: {}, nodeTaints: [], serviceAccountEmail: normalizeOptionalString(serviceConfig.gcpServiceAccountEmail) ?? null, spot: false }); export const createServiceResourceLabels = (context, serviceName) => ({ 'atlas-component': 'service', ...(context.environment ? { 'atlas-environment': context.environment } : {}), 'atlas-managed-by': 'terraform', 'atlas-project': context.projectId, 'atlas-service': serviceName });