Skip to content

docs: fix a couple of minor docs typos/mistakes #460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this package no longer exists

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:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first time in this doc where external dependencies are used. Perhaps it's worth mentioning how to run this example.

> ```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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example would originally always return 2048 regardless of priority as the dict expects an str as the key.

_name = "nginx"
# exported variables
cpu = _cpu
Expand Down
Loading