Skip to content

Commit

Permalink
chore: sync v0.9.0 documents
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <xpf6677@163.com>
  • Loading branch information
Peefy committed Jul 5, 2024
1 parent fdd2e27 commit 7655e90
Show file tree
Hide file tree
Showing 46 changed files with 789 additions and 140 deletions.
102 changes: 51 additions & 51 deletions blog/2024-07-05-kcl-0.9.0-release/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The KCL team is pleased to announce that **KCL v0.9.0 is now available**! This r

**We would like to extend our heartfelt thanks to all 120 community contributors who participated in the iteration from version v0.8 to v0.9 over the past 120 days. The following list is in no particular order.**

*@Shashank Mittal, @MattHodge, @officialasishkumar, @Gmin2, @Akash Kumar, @sfshumaker, @sanzoghenzo, @MOHAMED FAWAS, @bradkwadsworth-mw, @excalq, @Daksh-10, @metacoma, @Wes McNamee, @Stéphane Este-Gracias, @octonawish-akcodes, @zong-zhe, @shashank-iitbhu, @NAVRockClimber, @AkashKumar7902, @Petrosz007, @patrycju, @Korada Vishal, @selfuryon, @tvandinther, @vtomilov, @Peefy, @taylormonacelli, @Tertium, @Stefano Borrelli, @Bishal, @kukacz, @borgius, @steeling, @jheyduk, @HStéphane Este-Gracias, @userxiaosi, @folliehiyuki, @kubernegit, @nizq, @Alexander Fuchs, @ihor-hrytskiv, @Mohamed Asif, @reedjosh, @Wck-iipi, @evensolberg, @aldoborrero@ron18219, @rodrigoalvamat, @mproffitt, @karlhepler, @shruti2522, @leon-andria, @prahaladramji, @Even Solberg, @utnim2, @warjiang, @Asish Kumar, @He1pa, @Emmanuel Alap, @d4v1d03, @Yvan da Silva, @Abhishek, @DavidChevallier, @zargor, @Kim Sondrup, @SamirMarin, @Hai Wu, @MatisseB, @beholdenkey, @nestoralonso, @HAkash Kumar, @olinux, @liangyuanpeng, @ngergs, @Penguin, @ealap, @markphillips100, @Henri Williams, @eshepelyuk, @CC007, @mintu, @M Slane, @zhuxw, @atelsier, @aleeriz, @LinYunling, @YvanDaSilva, @chai2010, @Sergey Ryabin, @vfarcic, @vemoo, @riven-blade, @ibishal, @empath-nirvana, @bozaro, @jgascon-nx, @reckless-huang, @Sergei Iakovlev, @Blarc, @JeevaRamanathan, @dennybaa, @PrettySolution, @east4ming, @nkabir, @sestegra, @XiaoK29, @ricochet1k, @yjsnly, @umaher, @SjuulJanssen, @wilsonwang371, @Lukáš Kubín, @samuel-deal-tisseo, @blakebarnett, @Uladzislau Maher, @ytsarev, @Vishalk91-4, @Stephen C, @Tom van Dinther, @MrGuoRanDuo, @dopesickjam*
_@Shashank Mittal, @MattHodge, @officialasishkumar, @Gmin2, @Akash Kumar, @sfshumaker, @sanzoghenzo, @MOHAMED FAWAS, @bradkwadsworth-mw, @excalq, @Daksh-10, @metacoma, @Wes McNamee, @Stéphane Este-Gracias, @octonawish-akcodes, @zong-zhe, @shashank-iitbhu, @NAVRockClimber, @AkashKumar7902, @Petrosz007, @patrycju, @Korada Vishal, @selfuryon, @tvandinther, @vtomilov, @Peefy, @taylormonacelli, @Tertium, @Stefano Borrelli, @Bishal, @kukacz, @borgius, @steeling, @jheyduk, @HStéphane Este-Gracias, @userxiaosi, @folliehiyuki, @kubernegit, @nizq, @Alexander Fuchs, @ihor-hrytskiv, @Mohamed Asif, @reedjosh, @Wck-iipi, @evensolberg, @aldoborrero@ron18219, @rodrigoalvamat, @mproffitt, @karlhepler, @shruti2522, @leon-andria, @prahaladramji, @Even Solberg, @utnim2, @warjiang, @Asish Kumar, @He1pa, @Emmanuel Alap, @d4v1d03, @Yvan da Silva, @Abhishek, @DavidChevallier, @zargor, @Kim Sondrup, @SamirMarin, @Hai Wu, @MatisseB, @beholdenkey, @nestoralonso, @HAkash Kumar, @olinux, @liangyuanpeng, @ngergs, @Penguin, @ealap, @markphillips100, @Henri Williams, @eshepelyuk, @CC007, @mintu, @M Slane, @zhuxw, @atelsier, @aleeriz, @LinYunling, @YvanDaSilva, @chai2010, @Sergey Ryabin, @vfarcic, @vemoo, @riven-blade, @ibishal, @empath-nirvana, @bozaro, @jgascon-nx, @reckless-huang, @Sergei Iakovlev, @Blarc, @JeevaRamanathan, @dennybaa, @PrettySolution, @east4ming, @nkabir, @sestegra, @XiaoK29, @ricochet1k, @yjsnly, @umaher, @SjuulJanssen, @wilsonwang371, @Lukáš Kubín, @samuel-deal-tisseo, @blakebarnett, @Uladzislau Maher, @ytsarev, @Vishalk91-4, @Stephen C, @Tom van Dinther, @MrGuoRanDuo, @dopesickjam_

## 📚 Key Updates

Expand All @@ -39,15 +39,15 @@ KCL IDE has further optimized incremental compilation and performance for semant

#### Language

+ String interpolation now supports escaping with `\${}` similar to Shell to cancel interpolation.
- String interpolation now supports escaping with `\${}` similar to Shell to cancel interpolation.

```python
world = "world"
hello_world_0 = "hello ${world}" # hello world
hello_world_1 = "hello \${world}" # hello ${world}
```

+ Added schema type support to the `typeof` function for distinguishing schema types from instances.
- Added schema type support to the `typeof` function for distinguishing schema types from instances.

```python
schema Foo:
Expand All @@ -58,7 +58,7 @@ type_schema = typeof(foo) # schema
type_type = typeof(Foo) # type
```

+ Added a `full_pkg` keyword argument to the `instances()` method of Schema to read instances of the corresponding schema from all code.
- Added a `full_pkg` keyword argument to the `instances()` method of Schema to read instances of the corresponding schema from all code.

```python
schema Person:
Expand All @@ -68,43 +68,43 @@ alice = Person {name = "Alice"}
all_persons = Person.instances(True)
```

+ Removed implicit comparison between bool and int types `0 < True`.
+ Removed comparison features for the list type `[0] < [1]`.
+ Added type assertion failure functionality to the `as` keyword.
+ Optimized closure variable capture logic of `lambda` functions and configuration code blocks `{}` in different scopes to be more intuitive.
- Removed implicit comparison between bool and int types `0 < True`.
- Removed comparison features for the list type `[0] < [1]`.
- Added type assertion failure functionality to the `as` keyword.
- Optimized closure variable capture logic of `lambda` functions and configuration code blocks `{}` in different scopes to be more intuitive.

#### Toolchain

+ `kcl run` now supports outputting configurations in TOML format with the `--format` toml option.
+ `kcl mod add` now supports adding dependencies from private third-party OCI Registries and Git repositories with the `--oci` and `--git` options.
+ `kcl import` now supports importing entire Go Packages as KCL Schemas.
+ `kcl import` now supports importing files with YAML stream format (`---`).
+ `kcl import` now supports importing TOML files as KCL configurations.
+ `kcl clean` now supports cleaning external dependencies and compile caches.
+ `kcl mod init` now supports setting the version of a new KCL module with the `--version` tag.
+ Commands like `kcl run`, `kcl mod add`, and `kcl mod pull` now support accessing private repositories via local Git.
- `kcl run` now supports outputting configurations in TOML format with the `--format` toml option.
- `kcl mod add` now supports adding dependencies from private third-party OCI Registries and Git repositories with the `--oci` and `--git` options.
- `kcl import` now supports importing entire Go Packages as KCL Schemas.
- `kcl import` now supports importing files with YAML stream format (`---`).
- `kcl import` now supports importing TOML files as KCL configurations.
- `kcl clean` now supports cleaning external dependencies and compile caches.
- `kcl mod init` now supports setting the version of a new KCL module with the `--version` tag.
- Commands like `kcl run`, `kcl mod add`, and `kcl mod pull` now support accessing private repositories via local Git.

#### IDE

+ Supports multiple quick fix options.
+ Syntax highlighting for `kcl.mod` and `kcl.mod.lock` files.
+ Partial syntax hover highlighting in the IDE.
+ `import` completion for external dependencies.
+ Function symbol highlighting and Inlay Hints displaying default variable types.
- Supports multiple quick fix options.
- Syntax highlighting for `kcl.mod` and `kcl.mod.lock` files.
- Partial syntax hover highlighting in the IDE.
- `import` completion for external dependencies.
- Function symbol highlighting and Inlay Hints displaying default variable types.

![inlayhint](/img/blog/2024-07-05-kcl-0.9.0-release/inlayhint.png)

#### API

+ The Override API now supports setting different attribute operators (`:`, `=`, and `+=`) for configuration overrides.
+ Go API now supports prototext format and KCL schema output as KCL configurations.
+ Go API now supports serializing any Go Type and Go Value to KCL Schema and configurations.
- The Override API now supports setting different attribute operators (`:`, `=`, and `+=`) for configuration overrides.
- Go API now supports prototext format and KCL schema output as KCL configurations.
- Go API now supports serializing any Go Type and Go Value to KCL Schema and configurations.

### 📦️ Standard Libraries and Third-Party Libraries

#### Standard Libraries

+ Added the `file` standard library for file IO operations, such as reading configurations from YAML and performing configuration merges.
- Added the `file` standard library for file IO operations, such as reading configurations from YAML and performing configuration merges.

```python
import file
Expand All @@ -118,14 +118,14 @@ config = p.merge(yaml.decode(file.read("deployment.yaml")), {

For more functions in the `file` module, see: [https://www.kcl-lang.io/docs/reference/model/file](https://www.kcl-lang.io/docs/reference/model/file)

+ Added the `template` standard library for writing template configurations.
- Added the `template` standard library for writing template configurations.

```python
import template

_data = {
name = "handlebars",
v = [ { a = 1 }, { a = 2 } ],
name = "handlebars",
v = [ { a = 1 }, { a = 2 } ],
c = { d = 5 },
g = { b = [ { aa = { bb = 55} }, { aa = { bb = 66} } ] },
people = [ "Yehuda Katz", "Alan Johnson", "Charles Jolley" ]
Expand All @@ -147,7 +147,7 @@ Hello world from {{name}}
""", _data)
```

+ Added the `runtime` standard library for capturing runtime exceptions, useful for `kcl test` tool to test exception cases.
- Added the `runtime` standard library for capturing runtime exceptions, useful for `kcl test` tool to test exception cases.

```python
import runtime
Expand All @@ -170,24 +170,24 @@ test_person_check_error = lambda {

The number of KCL models has increased to **313**, including major updates as follows:

+ `k8s` released version 1.30
+ `argo-cd` released version 0.1.1
+ `argo-workflow` released version 0.0.3
+ `istio` released version 1.21.2
+ `victoria-metrics-operator` released version 0.45.1
+ `cert-manager` released version 0.1.2
+ `cilium` released version 0.1.1
+ `Longhorn` released version 0.0.1
+ `jsonpatch` released version 0.0.5, supporting rfc6901Decode
+ Added a new third-party library `difflib` for comparing configuration differences
+ Added `argo-cd-order` for sorting argocd sync operation resource order
+ Added models for `cluster-api`, including `cluster-api`, `cluster-api-provider-metal3`, `cluster-api-provider-gcp`, `cluster-api-addon-provider-helm`, `cluster-api-addon-provider-aws`, `cluster-api-provider-azure`, and more
- `k8s` released version 1.30
- `argo-cd` released version 0.1.1
- `argo-workflow` released version 0.0.3
- `istio` released version 1.21.2
- `victoria-metrics-operator` released version 0.45.1
- `cert-manager` released version 0.1.2
- `cilium` released version 0.1.1
- `Longhorn` released version 0.0.1
- `jsonpatch` released version 0.0.5, supporting rfc6901Decode
- Added a new third-party library `difflib` for comparing configuration differences
- Added `argo-cd-order` for sorting argocd sync operation resource order
- Added models for `cluster-api`, including `cluster-api`, `cluster-api-provider-metal3`, `cluster-api-provider-gcp`, `cluster-api-addon-provider-helm`, `cluster-api-addon-provider-aws`, `cluster-api-provider-azure`, and more

### ☸️ Ecosystem Integration

+ Fixed concurrency issue in Argo KCL plugin causing Sync errors.
+ Releasing Flux KCL Controller [https://github.com/kcl-lang/flux-kcl-controller](https://github.com/kcl-lang/flux-kcl-controller), currently supporting GitOps with OCI and Git configurations.
+ KCL officially integrated into Crossplane Functions Marketplace, releasing v0.9.0 [https://github.com/crossplane-contrib/function-kcl](https://github.com/crossplane-contrib/function-kcl).
- Fixed concurrency issue in Argo KCL plugin causing Sync errors.
- Releasing Flux KCL Controller [https://github.com/kcl-lang/flux-kcl-controller](https://github.com/kcl-lang/flux-kcl-controller), currently supporting GitOps with OCI and Git configurations.
- KCL officially integrated into Crossplane Functions Marketplace, releasing v0.9.0 [https://github.com/crossplane-contrib/function-kcl](https://github.com/crossplane-contrib/function-kcl).

```yaml
apiVersion: apiextensions.crossplane.io/v1
Expand Down Expand Up @@ -231,18 +231,18 @@ spec:

Additionally, you can find more real use cases of KCL with other ecosystem projects here:

+ [https://github.com/mindwm/mindwm-gitops](https://github.com/mindwm/mindwm-gitops)
+ [https://github.com/vfarcic/crossplane-kubernetes](https://github.com/vfarcic/crossplane-kubernetes)
+ [https://github.com/giantswarm/crossplane-gs-apis/blob/main/crossplane.giantswarm.io/xnetworks/package/compositions/peered-vpc-network.yaml](https://github.com/giantswarm/crossplane-gs-apis/blob/main/crossplane.giantswarm.io/xnetworks/package/compositions/peered-vpc-network.yaml)
+ [https://github.com/upbound/configuration-aws-eks/blob/main/apis/composition-kcl.yaml](https://github.com/upbound/configuration-aws-eks/blob/main/apis/composition-kcl.yaml)
- [https://github.com/mindwm/mindwm-gitops](https://github.com/mindwm/mindwm-gitops)
- [https://github.com/vfarcic/crossplane-kubernetes](https://github.com/vfarcic/crossplane-kubernetes)
- [https://github.com/giantswarm/crossplane-gs-apis/blob/main/crossplane.giantswarm.io/xnetworks/package/compositions/peered-vpc-network.yaml](https://github.com/giantswarm/crossplane-gs-apis/blob/main/crossplane.giantswarm.io/xnetworks/package/compositions/peered-vpc-network.yaml)
- [https://github.com/upbound/configuration-aws-eks/blob/main/apis/composition-kcl.yaml](https://github.com/upbound/configuration-aws-eks/blob/main/apis/composition-kcl.yaml)

### 🧩 Multi-Language SDKs and Plugins

#### Multi-Language SDKs

The number of KCL multi-language SDKs has increased to **7**, currently supporting Rust, Go, Java, .NET, Python, Node.js, and WASM. These can be used without installing additional KCL command-line tools, optimizing the installation size to **90%** of previous versions and removing the need for complex system dependencies. Furthermore, each SDK provides the same APIs for code execution, code analysis, type parsing, and adding external dependencies. Here are some examples with the Java and C# SDKs:

+ Java
- Java

```java
import com.kcl.api.API;
Expand All @@ -259,7 +259,7 @@ public class ExecProgramTest {
}
```

+ C#
- C#

```csharp
namespace KclLib.Tests;
Expand Down Expand Up @@ -336,7 +336,7 @@ For more examples of using other multi-language plugins, see [https://www.kcl-la

Additionally, you can find more real use cases of KCL multi-language plugins here:

+ [https://github.com/cakehappens/kcfoil/blob/main/cmd/kcf/template.go](https://github.com/cakehappens/kcfoil/blob/main/cmd/kcf/template.go)
- [https://github.com/cakehappens/kcfoil/blob/main/cmd/kcf/template.go](https://github.com/cakehappens/kcfoil/blob/main/cmd/kcf/template.go)

## 🌐 Other Resources

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Examples:
kcl mod init <command> [arguments]...
# Init one kcl module with the current folder name
kcl mod init

# Init one kcl module with the name
kcl mod init package-name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Usage:
Examples:
# Update the current module
kcl mod update

# Update the module with the specified path
kcl mod update path/to/package

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Usage:
Examples:
# Package the current module
kcl mod pkg

# Package the current module in the vendor mode
kcl mod pkg --vendor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Usage:
Examples:
# Output the resolved dependencies the current module
kcl mod metadata

# Output the resolved dependencies the current module in the vendor mode
kcl mod metadata --vendor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Usage:
Examples:
# Push the current module to the registry
kcl mod push

# Push the current module to the registry in the vendor mode
kcl mod push --vendor

Expand Down
22 changes: 11 additions & 11 deletions docs/user_docs/getting-started/kcl-quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,25 @@ kcl server.k
title: KCL Example
owner:
name: The KCL Authors
data: '2020-01-02T03:04:05'
data: "2020-01-02T03:04:05"
database:
enabled: true
ports:
- 8000
- 8001
- 8002
- 8000
- 8001
- 8002
data:
- - delta
- phi
- - 3.14
- - delta
- phi
- - 3.14
temp_targets:
cpu: 79.5
case: 72.0
servers:
- ip: 10.0.0.1
role: frontend
- ip: 10.0.0.2
role: backend
- ip: 10.0.0.1
role: frontend
- ip: 10.0.0.2
role: backend
```

## 3. Define the structure of the configuration using KCL schema
Expand Down
Loading

0 comments on commit 7655e90

Please sign in to comment.