Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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: 4 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ module:
target: data/crds/
includeFiles:
- "**/api/**.yaml"
- source: content
target: static
includeFiles:
- "**/manifests/**.yaml"

# Give Hugo access to environmental variables matching a given regex.
# These give Hugo access to Netlify data to generate proper URLs
Expand Down
53 changes: 53 additions & 0 deletions content/contribute/code-style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,56 @@ aws_secret_access_key = $@<aws_secret_key>$@
```
{{</* /editCode */>}}
````

## Manifest shortcode

The `manifest` shortcode embeds a YAML manifest inline and generates a `kubectl apply -f` command pointing to the published URL.

Store manifests under `content/<version>/manifests/<page-path>/<file>.yaml`
based on the referencing page location.

For example, a page at `content/<version>/guides/change-logs.md` references
`content/<version>/manifests/guides/change-logs/<file>.yaml` with
`path="guides/change-logs/<file>.yaml"`.

```markdown
{{</* manifest path="code-style-guide/provider.yaml" */>}}
```
This renders as:

{{< manifest path="code-style-guide/provider.yaml" >}}

### Remove `apply` command

Use `apply="false"` to render the YAML without the `kubectl apply -f` block.

```markdown
{{</* manifest path="code-style-guide/provider.yaml" apply="false" */>}}
```

{{< manifest path="code-style-guide/provider.yaml" apply="false" >}}

### `generateName`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is it also worth mentioning the manifest-url function in this contributing guide page? i see it used quite a lot on some pages like https://deploy-preview-1086--crossplane.netlify.app/v2.2/get-started/get-started-with-composition/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for calling this out - added a mention in the contributing guide.


Use `command="kubectl create -f"` for manifests that use `generateName`. `kubectl apply` doesn't support `generateName`.

```markdown
{{</* manifest path="code-style-guide/bucket.yaml" command="kubectl create -f" */>}}
```

{{< manifest path="code-style-guide/bucket.yaml" command="kubectl create -f" >}}

### Line highlighting

Use `label=` to enable dynamic line highlighting with the `hover` shortcode.

```markdown
Apply the {{</* hover label="provider" line="2" */>}}Provider{{</* /hover */>}} resource.

{{</* manifest path="code-style-guide/provider.yaml" label="provider" */>}}
```

Apply the {{< hover label="provider" line="2" >}}Provider{{< /hover >}} resource.

{{< manifest path="code-style-guide/provider.yaml" label="provider" >}}

8 changes: 8 additions & 0 deletions content/contribute/manifests/code-style-guide/bucket.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: s3.aws.m.upbound.io/v1beta1
kind: Bucket
metadata:
namespace: default
generateName: crossplane-bucket-
spec:
forProvider:
region: us-east-2
6 changes: 6 additions & 0 deletions content/contribute/manifests/code-style-guide/provider.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: crossplane-contrib-provider-aws-s3
spec:
package: xpkg.crossplane.io/crossplane-contrib/provider-aws-s3:v2.0.0
Loading
Loading