From 826396f71da484c4d30e3ab7e3abdba0e1557af3 Mon Sep 17 00:00:00 2001 From: peefy Date: Wed, 11 Sep 2024 11:31:55 +0800 Subject: [PATCH] feat: release konfig 0.8.0 Signed-off-by: peefy --- konfig/README-zh.md | 56 ---------------------------- konfig/README.md | 11 +++--- konfig/kcl.mod | 4 +- konfig/kcl.mod.lock | 8 +--- konfig/models/kube/frontend/job.k | 7 ++++ konfig/models/kube/frontend/server.k | 4 +- konfig/models/kube/render/render.k | 2 +- 7 files changed, 20 insertions(+), 72 deletions(-) delete mode 100644 konfig/README-zh.md diff --git a/konfig/README-zh.md b/konfig/README-zh.md deleted file mode 100644 index 047bcd5b..00000000 --- a/konfig/README-zh.md +++ /dev/null @@ -1,56 +0,0 @@ -# Konfig - -[英语](README.md) | [中文](README-zh.md) - -Konfig 是 KCL 配置中基础设施配置的存储库。Konfig 提供给用户开箱即用、高度抽象的配置界面,模型库最初朴素的出发点就是改善 YAML 用户的效率和体验,我们希望通过将代码更繁杂的模型抽象封装到统一的模型中,从而简化用户侧配置代码的编写。当然您也可以使用 KCL 工具将 Konfig 代码作为依赖集成到您的配置代码中。 - -更多细节可参考:[《模型概览》](https://kcl-lang.io/docs/user_docs/guides/working-with-konfig/overview) - -## 目录结构概览 - -配置大库整体结构如下: - -```bash -. -├── LICENSE -├── Makefile -├── README-zh.md -├── README.md -├── examples # konfig examples -├── kcl.mod # konfig package metadata file -├── kcl.mod.lock # konfig package metadata lock file -└── models - ├── commons # Common models - ├── kube # Cloud-native resource core models - │ ├── backend # Back-end models - │ ├── frontend # Front-end models - │ │ ├── common # Common front-end models - │ │ ├── configmap # ConfigMap - │ │ ├── container # Container - │ │ ├── ingress # Ingress - │ │ ├── resource # Resource - │ │ ├── secret # Secret - │ │ ├── service # Service - │ │ ├── sidecar # Sidecar - │ │ ├── strategy # strategy - │ │ ├── volume # Volume - │ │ └── server.k # The `Server` model - │ ├── metadata # Kubernetes metadata - │ ├── mixins # Mixin - │ ├── render # Front-to-back-end renderers. - │ ├── templates # Data template - │ └── utils - └── metadata # Common metadata -``` - -## 前置条件 - -安装 [KCL](https://kcl-lang.io/docs/user_docs/guides/package-management/installation) - -## 快速开始 - -参考[这里](https://kcl-lang.io/docs/user_docs/guides/working-with-konfig/guide) - -## License - -Apache License Version 2.0 diff --git a/konfig/README.md b/konfig/README.md index 8f20a28f..d3c486ba 100644 --- a/konfig/README.md +++ b/konfig/README.md @@ -2,11 +2,8 @@ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcl-lang%2Fkonfig.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcl-lang%2Fkonfig?ref=badge_shield) - [English](README.md) | [Chinese](README-zh.md) -Konfig is the repository of the infra configuration in KCL. - Konfig provides users with an out-of-the-box, highly abstract configuration interface. The original starting point of the model library is to improve the efficiency and experience of YAML users. We hope to simplify the writing of user-side configuration code by abstracting and encapsulating the model with more complex code into a unified model. For more details, please refer to: [Model Overview](https://kcl-lang.io/docs/user_docs/guides/working-with-konfig/overview) @@ -56,9 +53,13 @@ Install [KCL](https://kcl-lang.io/docs/user_docs/getting-started/install) See [here](https://kcl-lang.io/docs/user_docs/guides/working-with-konfig/guide) +## Resources + +- More examples can be found [here](https://github.com/kcl-lang/konfig/blob/main/examples/README.md) +- Konfig schema reference document can be found [here](https://github.com/kcl-lang/konfig/blob/main/docs/konfig.md) + ## License Apache License Version 2.0 - -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcl-lang%2Fkonfig.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcl-lang%2Fkonfig?ref=badge_large) \ No newline at end of file +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcl-lang%2Fkonfig.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcl-lang%2Fkonfig?ref=badge_large) diff --git a/konfig/kcl.mod b/konfig/kcl.mod index 1855ba4c..89f6fa6f 100644 --- a/konfig/kcl.mod +++ b/konfig/kcl.mod @@ -1,7 +1,7 @@ [package] name = "konfig" -version = "0.7.0" +version = "0.8.0" description = "Konfig provides users with an out-of-the-box, highly abstract configuration interface. The original starting point of the model library is to improve the efficiency and experience of YAML users. We hope to simplify the writing of user-side configuration code by abstracting and encapsulating the model with more complex code into a unified model." [dependencies] -k8s = "1.28" +k8s = "1.31" diff --git a/konfig/kcl.mod.lock b/konfig/kcl.mod.lock index 8c61a23b..41b4867f 100644 --- a/konfig/kcl.mod.lock +++ b/konfig/kcl.mod.lock @@ -1,9 +1,5 @@ [dependencies] [dependencies.k8s] name = "k8s" - full_name = "k8s_1.28" - version = "1.28" - sum = "aTxPUVZyr9MdiB3YdiY/8pCh9sC55yURnZdGlJsKG6Q=" - reg = "ghcr.io" - repo = "kcl-lang/k8s" - oci_tag = "1.28" + full_name = "k8s_1.31" + version = "1.31" diff --git a/konfig/models/kube/frontend/job.k b/konfig/models/kube/frontend/job.k index 4d45c1c0..32bdf5f9 100644 --- a/konfig/models/kube/frontend/job.k +++ b/konfig/models/kube/frontend/job.k @@ -13,6 +13,11 @@ schema Job: Attributes ---------- + name: str, default is Undefined, optional. + The name of the workload and service. + If not defined, a generated name ("{__META_APP_NAME}-{__META_ENV_TYPE_NAME}") will be used. + The value of metadata.__META_APP_NAME will be extracted from the value of the "name" defined through option("app"), + and the value of metadata.__META_ENV_TYPE_NAME will be extracted from the value of the "name" defined through option("env"). activeDeadlineSeconds: int, default is Undefined, optional. Specifies the duration in seconds relative to the startTime that the job may be active before the system tries to terminate it; value must be positive integer @@ -80,6 +85,8 @@ schema Job: } """ + # job name + name?: str # subset of batchv1.JobSpec activeDeadlineSeconds?: int backoffLimit?: int = 6 diff --git a/konfig/models/kube/frontend/server.k b/konfig/models/kube/frontend/server.k index 718fd047..61d9a38e 100644 --- a/konfig/models/kube/frontend/server.k +++ b/konfig/models/kube/frontend/server.k @@ -18,8 +18,8 @@ schema Server: name: str, default is Undefined, optional. The name of the workload and service. If not defined, a generated name ("{__META_APP_NAME}-{__META_ENV_TYPE_NAME}") will be used. - The value of __META_APP_NAME will be extracted from the value of the "name" defined in project.yaml, - and the value of __META_ENV_TYPE_NAME will be extracted from the value of the "name" defined in stack.yaml. + The value of metadata.__META_APP_NAME will be extracted from the value of the "name" defined through option("app"), + and the value of metadata.__META_ENV_TYPE_NAME will be extracted from the value of the "name" defined through option("env"). workloadType: "Deployment" | "StatefulSet", default is "Deployment", required. Application workload type, default to 'Deployment' renderType: "Server" | "KubeVelaApplication", default is "Server", optional. diff --git a/konfig/models/kube/render/render.k b/konfig/models/kube/render/render.k index 077a3659..55f46e6d 100644 --- a/konfig/models/kube/render/render.k +++ b/konfig/models/kube/render/render.k @@ -77,7 +77,7 @@ __resource_map_original___: {str: []} = { __resource_map___: {str: []} = {kind = remove_duplicated_iter(res_list, checkIdentical) for kind, res_list in __resource_map_original___} # kubernetes id: apiVersion:Kind:Namespace:Name -getId = lambda _resource { +getId = lambda _resource -> str { _resource.apiVersion + ":" + _resource.kind + ":" + (_resource.metadata.namespace + ":" if _resource.metadata.namespace else "") + _resource.metadata.name }