Skip to content
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

docs: Format code blocks with CUE v0.7.0 #294

Merged
merged 1 commit into from
Dec 22, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
**/go.sum
**/go.mod
- name: Generate cmd docs
run: make docs
run: make prep-docs
- name: Run mkdocs
uses: mhausenblas/mkdocs-deploy-gh-pages@e55ecab6718b449a90ebd4313f1320f9327f1386 # master
env:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ generate: controller-gen ## Generate API code.
docs: build
./bin/timoni docgen

prep-docs: docs
find ./docs -name '*.md' -print0 | xargs -0 sed -i 's/```cue/```go/g'

CONTROLLER_GEN=$(BIN_DIR)/controller-gen
.PHONY: controller-gen
controller-gen:
Expand Down
21 changes: 10 additions & 11 deletions docs/bundle-multi-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ bundle: {
}
}
}

```

The cluster name and group, are mapped to fields in a Bundle using the following attributes:
Expand Down Expand Up @@ -207,7 +206,7 @@ Perform a dry-run apply of the Bundle to review the changes across clusters:

```text
b:apps > c:preview-eu-1 > applying 1 instance(s) on staging (server dry run)
b:apps > c:preview-eu-1 > i:podinfo > applying module timoni.sh/podinfo version 6.5.3
b:apps > c:preview-eu-1 > i:podinfo > applying module timoni.sh/podinfo version 6.5.4
b:apps > c:preview-eu-1 > i:podinfo > Namespace/apps created (server dry run)
b:apps > c:preview-eu-1 > i:podinfo > ServiceAccount/apps/podinfo created (server dry run)
b:apps > c:preview-eu-1 > i:podinfo > Service/apps/podinfo created (server dry run)
Expand All @@ -216,7 +215,7 @@ Perform a dry-run apply of the Bundle to review the changes across clusters:
b:apps > c:preview-eu-1 > i:podinfo > applied successfully (server dry run)
b:apps > c:preview-eu-1 > applied successfully (server dry run)
b:apps > c:prod-eu-1 > applying 1 instance(s) on production (server dry run)
b:apps > c:prod-eu-1 > i:podinfo > applying module timoni.sh/podinfo version 6.5.3
b:apps > c:prod-eu-1 > i:podinfo > applying module timoni.sh/podinfo version 6.5.4
b:apps > c:prod-eu-1 > i:podinfo > Namespace/apps created (server dry run)
b:apps > c:prod-eu-1 > i:podinfo > ServiceAccount/apps/podinfo created (server dry run)
b:apps > c:prod-eu-1 > i:podinfo > Service/apps/podinfo created (server dry run)
Expand All @@ -240,7 +239,7 @@ To install or upgrade the instances defined in the Bundle to all clusters:

```text
b:apps > c:preview-eu-1 > applying 1 instance(s) on staging
b:apps > c:preview-eu-1 > i:podinfo > applying module timoni.sh/podinfo version 6.5.3
b:apps > c:preview-eu-1 > i:podinfo > applying module timoni.sh/podinfo version 6.5.4
b:apps > c:preview-eu-1 > i:podinfo > installing podinfo in namespace apps
b:apps > c:preview-eu-1 > i:podinfo > Namespace/apps created
b:apps > c:preview-eu-1 > i:podinfo > applying app
Expand All @@ -253,7 +252,7 @@ To install or upgrade the instances defined in the Bundle to all clusters:
b:apps > c:preview-eu-1 > i:podinfo > test resources ready
b:apps > c:preview-eu-1 > applied successfully in 22s
b:apps > c:prod-eu-1 > applying 1 instance(s) on production
b:apps > c:prod-eu-1 > i:podinfo > applying module timoni.sh/podinfo version 6.5.3
b:apps > c:prod-eu-1 > i:podinfo > applying module timoni.sh/podinfo version 6.5.4
b:apps > c:prod-eu-1 > i:podinfo > installing podinfo in namespace apps
b:apps > c:prod-eu-1 > i:podinfo > Namespace/apps created
b:apps > c:prod-eu-1 > i:podinfo > applying app
Expand Down Expand Up @@ -292,19 +291,19 @@ To list the current status of the deployed apps on all clusters:

```text
b:apps > c:preview-eu-1 > i:podinfo > last applied 2023-11-25T12:50:02Z
b:apps > c:preview-eu-1 > i:podinfo > module oci://ghcr.io/stefanprodan/modules/podinfo:6.5.3
b:apps > c:preview-eu-1 > i:podinfo > digest sha256:54d38b407012ccfb42badf0974ba70f9ae229ecd38f17e8a1f4e7189283b924f
b:apps > c:preview-eu-1 > i:podinfo > module oci://ghcr.io/stefanprodan/modules/podinfo:6.5.4
b:apps > c:preview-eu-1 > i:podinfo > digest sha256:1dba385f9d56f9a79e5b87344bbec1502bd11f056df51834e18d3e054de39365
b:apps > c:preview-eu-1 > i:podinfo > container image ghcr.io/curl/curl-container/curl-multi:master
b:apps > c:preview-eu-1 > i:podinfo > container image ghcr.io/stefanprodan/podinfo:6.5.3
b:apps > c:preview-eu-1 > i:podinfo > container image ghcr.io/stefanprodan/podinfo:6.5.4
b:apps > c:preview-eu-1 > i:podinfo > ServiceAccount/apps/podinfo Current - Resource is current
b:apps > c:preview-eu-1 > i:podinfo > Service/apps/podinfo Current - Service is ready
b:apps > c:preview-eu-1 > i:podinfo > Deployment/apps/podinfo Current - Deployment is available. Replicas: 1
b:apps > c:preview-eu-1 > i:podinfo > Job/apps/podinfo-test Current - Job Completed. succeeded: 1/1
b:apps > c:prod-eu-1 > i:podinfo > last applied 2023-11-25T12:50:24Z
b:apps > c:prod-eu-1 > i:podinfo > module oci://ghcr.io/stefanprodan/modules/podinfo:6.5.3
b:apps > c:prod-eu-1 > i:podinfo > digest sha256:54d38b407012ccfb42badf0974ba70f9ae229ecd38f17e8a1f4e7189283b924f
b:apps > c:prod-eu-1 > i:podinfo > module oci://ghcr.io/stefanprodan/modules/podinfo:6.5.4
b:apps > c:prod-eu-1 > i:podinfo > digest sha256:1dba385f9d56f9a79e5b87344bbec1502bd11f056df51834e18d3e054de39365
b:apps > c:prod-eu-1 > i:podinfo > container image ghcr.io/curl/curl-container/curl-multi:master
b:apps > c:prod-eu-1 > i:podinfo > container image ghcr.io/stefanprodan/podinfo:6.5.3
b:apps > c:prod-eu-1 > i:podinfo > container image ghcr.io/stefanprodan/podinfo:6.5.4
b:apps > c:prod-eu-1 > i:podinfo > ServiceAccount/apps/podinfo Current - Resource is current
b:apps > c:prod-eu-1 > i:podinfo > Service/apps/podinfo Current - Service is ready
b:apps > c:prod-eu-1 > i:podinfo > Deployment/apps/podinfo Current - Deployment is available. Replicas: 2
Expand Down
4 changes: 2 additions & 2 deletions docs/bundle-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ A Runtime file must contain a definition that matches the following schema:
#Runtime: {
apiVersion: string
name: string

clusters?: [string]: {
group!: string
kubeContext!: string
}

values?: [...#RuntimeValue]
}

Expand Down
2 changes: 1 addition & 1 deletion docs/bundle-secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ bundle: {
module: url: "oci://my-registry/timoni/modules/my-app-storage"
namespace: "my-app"
values: {
endpoint: "https://my-acc.r2.cloudflarestorage.com"
endpoint: "https://my-acc.r2.cloudflarestorage.com"
// The secrets are omitted here!
}
}
Expand Down
44 changes: 22 additions & 22 deletions docs/bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ bundle: {
redis: {
module: {
url: "oci://ghcr.io/stefanprodan/modules/redis"
version: "7.2.2"
version: "7.2.3"
}
namespace: "podinfo"
values: maxmemory: 256
}
podinfo: {
module: url: "oci://ghcr.io/stefanprodan/modules/podinfo"
module: version: "6.5.3"
module: version: "6.5.4"
namespace: "podinfo"
values: caching: {
enabled: true
Expand Down Expand Up @@ -66,8 +66,8 @@ Apply the Bundle on the cluster:

```text
applying instance redis
pulling oci://ghcr.io/stefanprodan/modules/redis:7.2.2
using module timoni.sh/redis version 7.2.2
pulling oci://ghcr.io/stefanprodan/modules/redis:7.2.3
using module timoni.sh/redis version 7.2.3
installing redis in namespace podinfo
Namespace/podinfo created
applying master
Expand All @@ -84,8 +84,8 @@ Apply the Bundle on the cluster:
waiting for 2 resource(s) to become ready...
resources are ready
applying instance podinfo
pulling oci://ghcr.io/stefanprodan/modules/podinfo:6.5.3
using module timoni.sh/podinfo version 6.5.3
pulling oci://ghcr.io/stefanprodan/modules/podinfo:6.5.4
using module timoni.sh/podinfo version 6.5.4
installing podinfo in namespace podinfo
ServiceAccount/podinfo/podinfo created
Service/podinfo/podinfo created
Expand All @@ -112,7 +112,7 @@ Build the Bundle and print the resulting Kubernetes resources for all the Bundle
metadata:
labels:
app.kubernetes.io/part-of: redis
app.kubernetes.io/version: 7.2.2
app.kubernetes.io/version: 7.2.3
name: redis
namespace: podinfo
---
Expand All @@ -125,7 +125,7 @@ Build the Bundle and print the resulting Kubernetes resources for all the Bundle
metadata:
labels:
app.kubernetes.io/name: podinfo
app.kubernetes.io/version: 6.5.3
app.kubernetes.io/version: 6.5.4
name: podinfo
namespace: podinfo
---
Expand All @@ -144,8 +144,8 @@ List the managed resources from a bundle and their rollout status:

```text
last applied 2023-10-08T20:21:19Z
module oci://ghcr.io/stefanprodan/modules/redis:7.2.2
digest: sha256:22ab5f4f0158f02b353c168f21a54901a45b2a56865fcc470e5492120deb4111
module oci://ghcr.io/stefanprodan/modules/redis:7.2.3
digest: sha256:fe22718cc6ad8c306fcea2c75d9ddfea1cc176b02c66796ce0fa7b79d2f3e0f5
ServiceAccount/podinfo/redis Current Resource is current
ConfigMap/podinfo/redis Current Resource is always ready
Service/podinfo/redis Current Service is ready
Expand All @@ -155,8 +155,8 @@ List the managed resources from a bundle and their rollout status:
PersistentVolumeClaim/podinfo/redis-master Current PVC is Bound

last applied 2023-10-08T20:21:19Z
module oci://ghcr.io/stefanprodan/modules/podinfo:6.5.3
digest: sha256:54d38b407012ccfb42badf0974ba70f9ae229ecd38f17e8a1f4e7189283b924f
module oci://ghcr.io/stefanprodan/modules/podinfo:6.5.4
digest: sha256:1dba385f9d56f9a79e5b87344bbec1502bd11f056df51834e18d3e054de39365
ServiceAccount/podinfo/podinfo Current Resource is always ready
Service/podinfo/podinfo Current Service is ready
Deployment/podinfo/podinfo Current Deployment is available. Replicas: 1
Expand All @@ -174,8 +174,8 @@ List the instances in Bundle `podinfo` across all namespaces:

```text
NAME NAMESPACE MODULE VERSION LAST APPLIED BUNDLE
podinfo podinfo oci://ghcr.io/stefanprodan/modules/podinfo 6.5.3 2023-09-10T16:20:07Z podinfo
redis podinfo oci://ghcr.io/stefanprodan/modules/redis 7.2.2 2023-09-10T16:20:00Z podinfo
podinfo podinfo oci://ghcr.io/stefanprodan/modules/podinfo 6.5.4 2023-12-10T16:20:07Z podinfo
redis podinfo oci://ghcr.io/stefanprodan/modules/redis 7.2.3 2023-12-10T16:20:00Z podinfo
```

## Writing a Bundle spec
Expand All @@ -185,7 +185,7 @@ A Bundle file must contain a definition that matches the following schema:
```cue
#Bundle: {
apiVersion: string
name: string
name: string
instances: [string]: {
module: {
url: string
Expand Down Expand Up @@ -225,7 +225,7 @@ A Bundle must contain at least one instance with the following required fields:
```cue
bundle: {
apiVersion: "v1alpha1"
name: "podinfo"
name: "podinfo"
instances: {
podinfo: {
module: url: "oci://ghcr.io/stefanprodan/modules/podinfo"
Expand Down Expand Up @@ -253,8 +253,8 @@ When not specified, the version defaults to `latest`, which pulls the module OCI

```cue
module: {
url: "oci://ghcr.io/stefanprodan/modules/podinfo"
version: "6.5.3"
url: "oci://ghcr.io/stefanprodan/modules/podinfo"
version: "6.5.4"
}
```

Expand All @@ -270,7 +270,7 @@ The `instance.module.digest` is an optional field that specifies the OCI digest
```cue
module: {
url: "oci://ghcr.io/stefanprodan/modules/podinfo"
digest: "sha256:54d38b407012ccfb42badf0974ba70f9ae229ecd38f17e8a1f4e7189283b924f"
digest: "sha256:1dba385f9d56f9a79e5b87344bbec1502bd11f056df51834e18d3e054de39365"
}
```

Expand All @@ -279,9 +279,9 @@ upstream digest of the version matches the specified `instance.module.digest`.

```cue
module: {
url: "oci://ghcr.io/stefanprodan/modules/podinfo"
version: "6.5.3"
digest: "sha256:54d38b407012ccfb42badf0974ba70f9ae229ecd38f17e8a1f4e7189283b924f"
url: "oci://ghcr.io/stefanprodan/modules/podinfo"
version: "6.5.4"
digest: "sha256:1dba385f9d56f9a79e5b87344bbec1502bd11f056df51834e18d3e054de39365"
}
```

Expand Down
9 changes: 5 additions & 4 deletions docs/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ For deterministic operations, it is possible to pin a module version by its OCI

```cue
redis: {
module: {
url: "oci://ghcr.io/stefanprodan/modules/redis"
digest: "sha256:e9137d41b0d263bfaf2a43fc862648ad9dc3a976b4b0fc6e27617ea28ee27d45"
}
module: {
url: "oci://ghcr.io/stefanprodan/modules/redis"
digest: "sha256:e9137d41b0d263bfaf2a43fc862648ad9dc3a976b4b0fc6e27617ea28ee27d45"
}
}
```

Expand Down Expand Up @@ -183,3 +183,4 @@ Commands for distributing bundles and runtimes:
- `timoni artifact push oci://<artifact-url> -t <tag> -f <path/to/dir>`
- `timoni artifact pull oci://<artifact-url> -o <path/to/dir>`
- `timoni artifact list oci://<artifact-url>`
- `timoni artifact tag oci://<artifact-url>:<tag> -t <new-tag>`
10 changes: 6 additions & 4 deletions docs/module-distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ Example:

```console
$ timoni mod list oci://ghcr.io/stefanprodan/modules/podinfo
VERSION DIGEST
latest sha256:d5cb5a8c625045ee1da01d629a2d46cd361f2b6472b8bd07bcabbd0012bc574b
VERSION DIGEST
latest sha256:1dba385f9d56f9a79e5b87344bbec1502bd11f056df51834e18d3e054de39365
6.5.4 sha256:1dba385f9d56f9a79e5b87344bbec1502bd11f056df51834e18d3e054de39365
6.5.3 sha256:54d38b407012ccfb42badf0974ba70f9ae229ecd38f17e8a1f4e7189283b924f
6.5.2 sha256:6feb340acfc8f566bad9d4fa1e71a3cd0feade41a00750428b4f1b0b5e3c86a0
6.5.1 sha256:aa76ad9ab7e7a3efd12af1ceaaaa7e53a165a77869fecc64342c8ea6b1b758e2
6.5.0 sha256:d5cb5a8c625045ee1da01d629a2d46cd361f2b6472b8bd07bcabbd0012bc574b
6.4.1 sha256:b3ef5d3ce9f0246e2c596db62f2d0830f58aa2b7f07199fe002c913d991e9d0c
6.4.0 sha256:f2d85995c0936221eb58a16ead23125d81154ab2cd25a31b2b6314f1f584ee0b
```
23 changes: 11 additions & 12 deletions docs/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ Note that this file must have no imports and all values must be concrete.
// source: myapp/values.cue

values: {
message: "Hello World"
image: {
repository: "cgr.dev/chainguard/nginx"
digest: "sha256:d2b0e52d7c2e5dd9fe5266b163e14d41ed97fd380deb55a36ff17efd145549cd"
tag: "1.25.1"
}
message: "Hello World"
image: {
repository: "cgr.dev/chainguard/nginx"
digest: "sha256:d2b0e52d7c2e5dd9fe5266b163e14d41ed97fd380deb55a36ff17efd145549cd"
tag: "1.25.1"
}
}
```

Expand Down Expand Up @@ -217,7 +217,6 @@ Example of a minimal config for an app deployment:
service: port: *80 | int & >0 & <=65535
resources?: corev1.#ResourceRequirements
}

```

The user-supplied values can:
Expand Down Expand Up @@ -284,8 +283,8 @@ Example of defining an instance containing a Kubernetes Service and Deployment:
config: #Config

objects: {
svc: #Service & {_config: config}
deploy: #Deployment & {_config: config}
svc: #Service & {_config: config}
deploy: #Deployment & {_config: config}
}
}
```
Expand All @@ -308,7 +307,7 @@ import (
apiVersion: "v1"
kind: "Service"
metadata: _config.metadata
spec: corev1.#ServiceSpec & {
spec: corev1.#ServiceSpec & {
type: corev1.#ServiceTypeClusterIP
selector: _config.selector.labels
ports: [
Expand Down Expand Up @@ -501,8 +500,8 @@ import (
)

#ServiceMonitor: promv1.#ServiceMonitor & {
_config: #Config
metadata: _config.metadata
_config: #Config
metadata: _config.metadata
spec: {
endpoints: [{
path: "/metrics"
Expand Down
10 changes: 5 additions & 5 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ in a new namespace:
```console
$ timoni -n test apply podinfo oci://ghcr.io/stefanprodan/modules/podinfo --version latest
pulling oci://ghcr.io/stefanprodan/modules/podinfo:latest
using module timoni.sh/podinfo version 6.5.3
using module timoni.sh/podinfo version 6.5.4
installing podinfo in namespace test
Namespace/test created
ServiceAccount/test/podinfo created
Expand All @@ -57,9 +57,9 @@ To get more information on an instance, you can use the `timoni inspect` sub-com
```console
$ timoni -n test inspect module podinfo
name: timoni.sh/podinfo
version: 6.5.3
version: 6.5.4
repository: oci://ghcr.io/stefanprodan/modules/podinfo
digest: sha256:22ab5f4f0158f02b353c168f21a54901a45b2a56865fcc470e5492120deb4111
digest: sha256:1dba385f9d56f9a79e5b87344bbec1502bd11f056df51834e18d3e054de39365
```

To learn more about the available commands, use `timoni inspect --help`.
Expand Down Expand Up @@ -127,14 +127,14 @@ bundle: {
redis: {
module: {
url: "oci://ghcr.io/stefanprodan/modules/redis"
version: "7.2.2"
version: "7.2.3"
}
namespace: "podinfo"
values: maxmemory: 256
}
podinfo: {
module: url: "oci://ghcr.io/stefanprodan/modules/podinfo"
module: version: "6.5.3"
module: version: "6.5.4"
namespace: "podinfo"
values: caching: {
enabled: true
Expand Down