《KCL重塑配置管理界面丨平台工程技术大会.pdf》由会员分享,可在线阅读,更多相关《KCL重塑配置管理界面丨平台工程技术大会.pdf(37页珍藏版)》请在三个皮匠报告上搜索。
1、使用 KCL 重塑配置管理界面徐鹏飞|KCL 项目 Maintainer目录01背景02概念04实践03架构05规划背景01 认知认知负担负担应用开发人员需要面对复杂的基础设施和平台概念不像基础设施配置有 Terraform 等 IaC 工具,Kubernetes 是平台的平台,特别是在客户端缺乏轻量的配置组合和校验工具 静态配置静态配置YAML 膨胀,维度爆炸跨团队配置协作负担和配置漂移 效率效率、可靠性低可靠性低缺乏标准的测试验证手段,大多是胶水代码或者脚本的拼盘缺乏高效配置协同的工具,大多通过人肉拉群解决减轻基础设施对开发人员的负担,提高配置管理效率背景Kubernetes 中的声明式应
2、用管理:https:/ 平台工程白皮书:https:/tag-app-cf.io/whitepapers/platforms/Google SRE 工作手册:https:/sre.google/workbook/configuration-specifics/屏蔽基础设施和平台细节,降低开发者认知负担屏蔽基础设施和平台细节,降低开发者认知负担自定义抽象模型解决 YAML 或者模版配置维度爆炸问题可编程支持:逻辑、类型、函数、模块、无副作用地进行大规模配置管理无副作用地进行大规模配置管理可扩展风险左移自动化高性能包管理支持通过插件为已有的配置管理工具进行增强通过插件为已有的配置管理工具进行增强H
3、elmKustomizekpt背景KCL 可以做什么概念02开发者可以理解的声明式应用配置模型动态配置管理 DCM:可编程可扩展关注点分离:应用/平台Dev/SRE风险左移:实时的配置错误提示标准的 OCI 配置交付和包管理支持:KPMValidation:通过 KCL Schema/Rule 等结构对配置进行约束校验Mutation:通过 KCL 函数对资源进行变换或注入配置配置Standalone KCL 形式形式遵循统一的遵循统一的 KRM Function 规范规范可编程可扩展可编程可扩展多种代码源支持:OCI,Git,Https,https:/ KCL 形式形式https:/kcl-
4、lang.io/docs/user_docs/guides/gitops/gitops-quick-start配置驱动的工作流:同时支持Standalone KCL 和KRM KCL 配置格式多种 CI/CD 和 GitOps 工具支持自动化多语言 SDK:Go,Rust,Python,Java包管理支持:KPM 工具和多种 Registry 支持数据和 Schema 集成:KCL Import 工具运行时集成:使用 KCL Operator 而不是重复开发Admission WebhookKRM 支持:统一的规范和插件支持 e.g.,kubectl-kcl plugin,helm-kcl p
5、lugin,kustomize-kcl plugin,kpt-kcl-plugin 平台工程工具支持:作为 DCM 语言配合不同引擎/编排器进行应用交付IaC/IaDAdmission RequestMutating/Validating WebhookKCL OperatorHelm/Kustomize/KPT/.KCL Plugins客户端运行时SDKs集成架构03Language+Tools+IDEs+SDKs+PluginsTools&CI/CD Engagementkcl-formatkcl-lintkcl-testkcl-docKCL Coding AssistantHighlig
6、htGo To Def/RefCompletionFormatCompileDebugError/Warning CheckingTestLSPKCL Language ServerKCL CompilerKCL Package Manager工作空间组件技术架构配置生成自动合并多种合并策略支持配置变换数据/Schema 集成CRUD API配置校验静态类型约束规则不可变性配置抽象关注点分离KCL SETTA 2022 Paper:https:/ 引擎Structured KVTemplated KVProgrammable KVTyped KVModeled KVPros.Easy to w
7、rite and readRich multi-language APIVarious Path ToolsCons.Redundant informationInsufficient functionality e.g.abstraction,constraint,Tech.JSONYAMLProductKustomizePros.Simple config logic supportDynamic argument inputCons.Increase of argument makes it difficult to maintainInsufficient functionality
8、e.g.abstraction,constraint,Tech.VelocityGo TemplateProductHelmHelmfilePros.Required programming featuresCode modularityTemplates&Data abstractionCons.Insufficient type constraintsInsufficient restraint abilityRuntime errorTech.GCLHCLStarlarkJsonnetProduct Terraform Tanka yttPros.Rich config constrai
9、nt syntaxUnified type&value constraint Configuration conflict checkingCons.Difficult to configuration override for multi-environment scenariosRuntime checks and limited performanceTech.CUEProductKubeVelaPros.Model-centric&constraint-centricScalability on separated block writing with rich merge strat
10、egiesStatic type system&analysisHigh PerformanceCons.Expansion of different models requires investment in R&DTech.KCLProduct KusionStack KRM-KCL Tools and Operators社区项目Loop and FunctionKubernetes ConfigurationTest environment:single core macOS 10.15.7 CPU:i7-8850H 2.6GHz 32GB 2400Mhz DDR4 No NUMA,e2
11、e run time(ms)02000400060008000KCL v0.4.5CUE v0.4.3Jsonnet v0.18Terraform HCL v1.300KCL v0.4.5CUE v0.4.3Note:Jsonnet and HCL do not have any schema related concepts and are excluded from comparison性能对比实践04实践实践实践实践实践CodeOCI实践https:/ JSON/YAML 支持 双向 Open API 转换支持 自定义错误信息更多玩法,欢迎加入 KCL 社区用户声音
12、社区2022 年 5 月开源规划05https:/ Based Programming Language for the Cloud?AIGC AI+DSL+Engine+CoT 平台/云能力抽象封装成 DSL 统一 App 和 Infra引擎消费 DSL 输入将 DSL 的组合方式(链式思维的方式,CoT)提炼成 Prompt 喂给 AI 模型并返回结果 官方网站 https:/kcl-lang.io/https:/kusionstack.io/GitHub https:/ https:/ Twitter kcl language kusionstack Slack https:/kcl-
13、https:/钉钉(DingTalk ID 42753001)其他资源KCL=Config+Schema+Rule+LambdaConfigLambdaSchemaRuleOrganizeValidateCombinateDefinitionDescribe概念ConfigLambdaSchemaRuleOrganizeValidateCombinateDefinitionDescribeKCL=Config+Schema+Rule+Lambda概念ConfigLambdaSchemaRuleOrganizeValidateCombinateDefinitionDescribeKCL=Conf
14、ig+Schema+Rule+Lambda概念ConfigLambdaSchemaRuleOrganizeValidateCombinateDefinitionDescribeKCL=Config+Schema+Rule+Lambda概念Not only a cloud-native config modeling tech stack,but also an unified API layer of App and Infra for CloudApp and Infra Code in One InterfaceZero Configuration:No CI/CD Pipeline,IaC,IaD and ScriptsEasy to use:Discover,develop,test,shipping with API Registry such as storage,network,etc.Automatic Identity and ObservationMulti-Cloud/Runtime Support