Skip to content

Commit

Permalink
docs: fix a couple of minor docs typos
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Rogowski <[email protected]>
  • Loading branch information
trogowski committed Sep 4, 2024
1 parent 54561a2 commit 51103c0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/reference/lang/codelab/collaborative.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ In order to complete the collaborative configuration development, we first need
│ └── main.k
├── kcl.mod
└── pkg
└── sever.k
└── server.k
```

The directory of the project mainly contains three parts:
Expand Down Expand Up @@ -280,7 +280,7 @@ server:
env: dev
```

Using the same method, we can build the production configuration, write the code in the `dev/main.k` file, and add a label to it.
Using the same method, we can build the production configuration, write the code in the `prod/main.k` file, and add a label to it.

```python
import pkg
Expand Down
12 changes: 9 additions & 3 deletions docs/reference/lang/codelab/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ nginx = Nginx {
```python
nginx = NginxProd {
labels.run = "my-nginx"
labels.env = "pre-prod"
labels.env = "prod"
}
```

Expand Down Expand Up @@ -575,10 +575,10 @@ Now, we can complete the declaration of the server configuration through the Dep
However, usually, the actual situation is more complicated, and the deployment may have a variety of optional variable accessories.
For example, we want to support a persistent volume claim based on an existing schema, as a reusable Kubernetes schema. In this case, we can just wrapper it with a `mixin` and a `protocol` as follows:
For example, we want to support a persistent volume claim based on an existing schema, as a reusable Kubernetes schema. In this case, we can just wrap it with a `mixin` and a `protocol` as follows:

```python
import k8spkg.api.core.v1
import k8s.api.core.v1
protocol PVCProtocol:
pvc?: {str:}
Expand All @@ -604,6 +604,12 @@ mixin PersistentVolumeClaimMixin for PVCProtocol:
}
```
> Note: for the `k8s.api.core.v1` import to work, we need to initialize a module and add the `k8s` module as a dependency:
> ```bash
> kcl mod init
> kcl mod add k8s
> ```

With this PersistentVolumeClaimMixin, we define a PVC schema with a clear `user interface`, and use Kubernetes PVC as an implementation. Then, we can define a server schema with Deployment schema, and PVC mixin schema.

```
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/lang/codelab/simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ _priorityCpuMap = {
"3" = 1024
}
# Using a dict to simplify logic and the default value is 2048
_cpu = _priorityCpuMap[_priority] or 2048
_cpu = _priorityCpuMap[str(_priority)] or 2048
_name = "nginx"
# exported variables
cpu = _cpu
Expand Down

0 comments on commit 51103c0

Please sign in to comment.