Skip to main content








简单易用

源于 Python、Go 等语言,丰富的语言特性,IDE 插件和工具链

快速建模

以 Schema 为中心的配置类型及模块化抽象,基于 Config、Schema、Lambda、Rule 的逻辑和策略编写

可靠稳定

依赖静态类型系统、约束和自定义规则的配置稳定性

强可扩展

通过独立配置块自动合并机制保证配置编写的高可扩展性

易自动化

CRUD APIs,多语言 SDK,语言插件 构成的梯度自动化方案

API 亲和

原生支持 OpenAPI、 Kubernetes CRD, Kubernetes YAML,KRM 等 API 生态规范





以更现代化的编程方式管理配置和策略

配置,模型,函数和规则

import konfig.models.kube.frontend
server: frontend.Server {
image = "nginx"
}
-- Config
import konfig.models.kube.frontend
server: frontend.Server {
image = "nginx"
}
schema Server:
"""Server is the abstraction of Deployment and StatefulSet.
image: str, default is Undefined, required.
Image name. More info: https://kubernetes.io/docs/concepts/containers/images.
replicas: int, default is 1, required.
Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.
labels: {str:str}, default is Undefined, optional.
Labels is a map of string keys and values that can be used to organize and categorize (scope and select) objects.
"""
image: str
replicas: int = option("replicas") or 1
labels?: {str:str}
-- Schema
schema Server:
"""Server is the abstraction of Deployment and StatefulSet.
image: str, default is Undefined, required.
Image name. More info: https://kubernetes.io/docs/concepts/containers/images.
replicas: int, default is 1, required.
Number of desired pods. This is a pointer to distinguish between explicit zero and not specified. Defaults to 1.
labels: {str:str}, default is Undefined, optional.
Labels is a map of string keys and values that can be used to organize and categorize (scope and select) objects.
"""
image: str
replicas: int = option("replicas") or 1
labels?: {str:str}
import konfig.models.kube.frontend
genLocalityLabels = lambda cluster: str, app: str -> {str:str} {
{
"cluster.x-k8s.io/cluster-name" = cluster
"app.kubernetes.io/name" = app
}
}
server: frontend.Server {
labels: genLocalityLabels("my-cluster", "nginx")
}
-- Lambda
import konfig.models.kube.frontend
genLocalityLabels = lambda cluster: str, app: str -> {str:str} {
{
"cluster.x-k8s.io/cluster-name" = cluster
"app.kubernetes.io/name" = app
}
}
server: frontend.Server {
labels: genLocalityLabels("my-cluster", "nginx")
}
import regex
rule ServerRule for Server:
1 <= replicas < 20, "replica should be in range [1, 20)"
regex.match(image, r"^([a-z0-9.:]+).([a-z]+):([a-z0-9]+)/([a-z0-9.]+)/([a-z0-9-_.:]+)$"), "image name should satisfy the `REPOSITORY:TAG` form"
ServerRule()
-- Rule
import regex
rule ServerRule for Server:
1 <= replicas < 20, "replica should be in range [1, 20)"
regex.match(image, r"^([a-z0-9.:]+).([a-z]+):([a-z0-9]+)/([a-z0-9.]+)/([a-z0-9-_.:]+)$"), "image name should satisfy the `REPOSITORY:TAG` form"
ServerRule()

Config

使用可扩展的配置开始您的云原生之旅

Schema

使用静态类型和 Schema 抽象您的模型

Lambda

通过小函数片段定义和复用配置和逻辑

Rule

定义环境规则以确保配置的一致性和稳定性





使用工具提升体验

IDE 插件,包管理,格式化,测试和文档工具

Tool image




与您最喜欢的项目集成

Kubernetes
Kustomize
Helm
Helmfile
KPT
Argo
Flux
Ansible
KusionStack
KubeVela
CrossPlane
Terraform




工程师信赖的技术产品

Ant Group
Youzan
Huawei
Kyligence




KCL 是 云原生计算基金会 沙箱项目


CNCF themed image




邮件订阅