Skip to content

Commit

Permalink
docs: replace touch with cat
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffmccune committed Nov 15, 2024
1 parent 374cd87 commit c9c8c13
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 30 deletions.
17 changes: 14 additions & 3 deletions doc/md/tutorial/cue.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ add the following CUE configuration to it.

```bash
mkdir -p components/podinfo
touch components/podinfo/podinfo.cue
```
```bash
cat <<EOF > components/podinfo/podinfo.cue
```
```cue showLineNumbers
package holos
Expand All @@ -66,11 +68,14 @@ Component: #Helm & {
}
}
```
```bash
EOF
```

Integrate the component with the platform.

```bash
touch platform/podinfo.cue
cat <<EOF > platform/podinfo.cue
```
```cue showLineNumbers
package holos
Expand All @@ -80,6 +85,9 @@ Platform: Components: podinfo: {
path: "components/podinfo"
}
```
```bash
EOF
```

Render the platform.

Expand Down Expand Up @@ -113,7 +121,7 @@ component kind. This field is a convenient wrapper around the core [BuildPlan]
Create the mixins.cue file.

```bash
touch components/podinfo/mixins.cue
cat <<EOF > components/podinfo/mixins.cue
```
```cue showLineNumbers
package holos
Expand Down Expand Up @@ -142,6 +150,9 @@ Component: {
}
}
```
```bash
EOF
```

:::important
Holos uses CUE to validate mixed in resources against a schema. The `Resources`
Expand Down
16 changes: 10 additions & 6 deletions doc/md/tutorial/hello-holos.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ and then add the following CUE configuration to it.

```bash
mkdir -p components/podinfo
touch components/podinfo/podinfo.cue
```
```bash
cat <<EOF > components/podinfo/podinfo.cue
```
```cue showLineNumbers
package holos
Expand All @@ -138,6 +140,9 @@ HelmChart: #Helm & {
}
}
```
```bash
EOF
```

:::important
CUE loads all of `*.cue` files in the component directory to define component,
Expand All @@ -155,10 +160,8 @@ platform root directory. In this example, `#Helm` on line 6 is defined in
Integrate the `podinfo` component into the platform by creating a new CUE file
in the `platform` directory with the following content.

<Tabs groupId="tutorial-hello-register-podinfo-component">
<TabItem value="platform/podinfo.cue" label="Register Podinfo">
```bash
touch platform/podinfo.cue
cat <<EOF > platform/podinfo.cue
```
```cue showLineNumbers
package holos
Expand All @@ -170,8 +173,9 @@ Platform: Components: podinfo: {
parameters: greeting: "Hello Holos!"
}
```
</TabItem>
</Tabs>
```bash
EOF
```

:::tip
Component parameters may have any name as long as they don't start with
Expand Down
28 changes: 18 additions & 10 deletions doc/md/tutorial/helm-values.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ the following file contents.

```bash
mkdir -p components/prometheus components/blackbox
touch components/prometheus/prometheus.cue
touch components/blackbox/blackbox.cue
```

<Tabs groupId="D15A3008-1EFC-4D34-BED1-15BC0C736CC3">
<TabItem value="prometheus.cue" label="prometheus.cue">
```txt
components/prometheus/prometheus.cue
```bash
cat <<EOF > components/prometheus/prometheus.cue
```
```cue showLineNumbers
package holos
Expand All @@ -84,11 +82,14 @@ Helm: #Helm & {
}
}
}
```
```bash
EOF
```
</TabItem>
<TabItem value="blackbox.cue" label="blackbox.cue">
```txt
components/blackbox/blackbox.cue
```bash
cat <<EOF > components/blackbox/blackbox.cue
```
```cue showLineNumbers
package holos
Expand All @@ -106,6 +107,9 @@ Helm: #Helm & {
}
}
}
```
```bash
EOF
```
</TabItem>
</Tabs>
Expand All @@ -116,9 +120,8 @@ Integrate the components with the platform by adding the following file to the
platform directory.

```bash
touch platform/prometheus.cue
cat <<EOF > platform/prometheus.cue
```

```cue showLineNumbers
package holos
Expand All @@ -133,6 +136,9 @@ Platform: Components: {
}
}
```
```bash
EOF
```

Render the platform.

Expand Down Expand Up @@ -243,9 +249,8 @@ use. We add this configuration to the `components` directory so it's in scope
for all components.

```bash
touch components/blackbox.cue
cat <<EOF > components/blackbox.cue
```

```cue showLineNumbers
package holos
Expand All @@ -263,6 +268,9 @@ Blackbox: #Blackbox & {
port: 9115
}
```
```bash
EOF
```

:::important
1. CUE loads and unifies all `*.cue` files from the root directory containing
Expand Down
31 changes: 20 additions & 11 deletions doc/md/tutorial/kustomize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ Create the `httpbin` component directory and add the `httpbin.cue` and
<TabItem value="setup" label="Setup">
```bash
mkdir -p components/httpbin
touch components/httpbin/httpbin.cue
touch components/httpbin/httpbin.yaml
```
</TabItem>
<TabItem value="components/httpbin/httpbin.cue" label="httpbin.cue">
```bash
cat <<EOF > components/httpbin/httpbin.cue
```
```cue showLineNumbers
package holos
Expand Down Expand Up @@ -97,9 +98,15 @@ Kustomize: #Kustomize & {
}
}
}
```
```bash
EOF
```
</TabItem>
<TabItem value="components/httpbin/httpbin.yaml" label="httpbin.yaml">
```bash
cat <<EOF > components/httpbin/httpbin.yaml
```
```yaml showLineNumbers
# https://github.com/mccutchen/go-httpbin/blob/v2.15.0/kustomize/resources.yaml
apiVersion: apps/v1
Expand Down Expand Up @@ -137,6 +144,9 @@ spec:
protocol: TCP
name: http
appProtocol: http
```
```bash
EOF
```
</TabItem>
</Tabs>
Expand All @@ -150,9 +160,8 @@ Integrate `httpbin` with the platform by adding the following file to the
platform directory.

```bash
touch platform/httpbin.cue
cat <<EOF > platform/httpbin.cue
```

```cue showLineNumbers
package holos
Expand All @@ -163,6 +172,9 @@ Platform: Components: {
}
}
```
```bash
EOF
```

Render the platform.

Expand Down Expand Up @@ -275,13 +287,9 @@ makes this easier with CUE. We don't need to edit any yaml files.
Add a new `patches.cue` file to the `httpbin` component with the following
content.

<Tabs groupId="104D40FD-ED59-4F66-8B91-435436084743">
<TabItem value="touch" label="touch">
```bash
touch components/httpbin/patches.cue
cat <<EOF > components/httpbin/patches.cue
```
</TabItem>
<TabItem value="patches.cue" label="patches.cue">
```cue showLineNumbers
package holos
Expand All @@ -300,8 +308,9 @@ Kustomize: KustomizeConfig: Kustomization: _patches: {
}
}
```
</TabItem>
</Tabs>
```bash
EOF
```

:::note
We use a hidden `_patches` field to easily unify data into a struct, then
Expand Down

0 comments on commit c9c8c13

Please sign in to comment.