Skip to content

Commit

Permalink
fix README styling for examples (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mengqi Yu authored May 6, 2021
1 parent d2deea1 commit d4dd831
Show file tree
Hide file tree
Showing 19 changed files with 49 additions and 49 deletions.
10 changes: 5 additions & 5 deletions examples/_template/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# some-image-foo: Example Title

## Overview
### Overview

1. Explain what this particular example demonstrates.
2. Include a link to the function reference (help doc) on first mention of the function.
Expand All @@ -9,15 +9,15 @@
1. Explain what this function config does.
Focus on explaining this particular example, not repeating the function reference.

## Function invocation
### Function invocation

4. Show exact `kpt` commands to get the example package and run the function.

## Expected result
### Expected result

5. Describe the expected outcome of running the instructions above. This needs to be specific enough
so that the user is confident the function works as expected (Don't just provide the command to `cat` a file).

## Function Reference
### Function Reference

6. Provide a link to the function help doc for reference.
6. Provide a link to the function help doc for reference.
4 changes: 2 additions & 2 deletions examples/apply-setters/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ environments: # kpt-set: ${env}
- stage
```

## Function invocation
### Function invocation

Get the config example and try it out by running the following commands:

Expand All @@ -69,7 +69,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run simple
```

## Expected result
### Expected result

Check the value of setter `name` is set to `my-new-map`.
Check the value of setter `env` is set to array value `[prod, stage]`.
Expand Down
4 changes: 2 additions & 2 deletions examples/contrib/analyze-istio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Istio configuration and outputs structured results detailing any errors found
during analysis. This example invokes the `analyze-istio` function using
declarative configuration.

## Function Invocation
### Function Invocation

Get this example and try it out by running the following commands:

Expand All @@ -14,7 +14,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run analyze-istio
```

## Expected Results
### Expected Results

This should give the following output:

Expand Down
4 changes: 2 additions & 2 deletions examples/contrib/inflate-helm-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `inflate-helm-chart` KRM config function generates a new kpt package from a
local Helm chart. This example invokes the `inflate-helm-chart` function using
declarative configuration.

## Function invocation
### Function invocation

Get this example and try it out by running the following commands:

Expand All @@ -13,7 +13,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run --as-current-user inflate-helm-chart/local-configs --mount type=bind,src=$(pwd)/inflate-helm-chart/helloworld-chart,dst=/source
```

## Expected result
### Expected result

Checking the contents of the `local-configs` directory with `kpt cfg tree inflate-helm-chart/local-configs/` should reveal the following new yaml files:

Expand Down
4 changes: 2 additions & 2 deletions examples/contrib/sops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ or if your keys are already in `gpg`, it's possibe to run:
kpt fn run --env SOPS_IMPORT_PGP="$(gpg --armor --export-secret-keys)" <folder>
```

## Function invocation
### Function invocation

Get this example and try it out by running the following commands:

Expand All @@ -37,7 +37,7 @@ curl -fsSL -o sops/key.asc https://raw.githubusercontent.com/mozilla/sops/master
kpt fn run --env SOPS_IMPORT_PGP="$(cat sops/key.asc)" sops/local-configs
```

## Expected result
### Expected result

Verify the updated configuration:

Expand Down
10 changes: 5 additions & 5 deletions examples/enforce-gatekeeper/invalid-configmap/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# enforce-gatekeeper: invalid configmap
# enforce-gatekeeper: Invalid Configmap

## Overview
### Overview

This example demonstrates how to validate ConfigMaps using a constraint.

There are 3 resources: a ConstraintTemplate, a K8sBannedConfigMapKeysV1 and a
ConfigMap.
The constraint disallows using `private_key` as a key in the ConfigMap.

## Function invocation
### Function invocation

Get the package:

Expand All @@ -30,7 +30,7 @@ Run the function:
$ kpt fn run --results-dir=results .
```

## Expected result
### Expected result

You should see the following output:

Expand Down Expand Up @@ -69,7 +69,7 @@ To pass validation, let's replace the key `private_key` in the ConfigMap in
`resources.yaml` with something else e.g. `public_key`.
Rerun the command. It will succeed (no output).

## Function Reference Doc
### Function Reference Doc

TODO: replace the following with the link to the reference doc when our site is live.
https://github.com/GoogleContainerTools/kpt-functions-catalog/blob/master/functions/go/enforce-gatekeeper/README.md
10 changes: 5 additions & 5 deletions examples/enforce-gatekeeper/warning-only/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# enforce-gatekeeper: warning only
# enforce-gatekeeper: Warning Only

## Overview
### Overview

This example is very similar to the invalid configmap example. The major
difference is that the violations are warnings instead of errors.

In the constraint, we use `enforcementAction: warn` instead of
`enforcementAction: deny`.

## Function invocation
### Function invocation

Get the package:

Expand All @@ -30,7 +30,7 @@ Run the function:
$ kpt fn run --results-dir=results .
```

## Expected result
### Expected result

You won't any failure. But if you look at the structured output, you can find a
warning about the constraint violation.
Expand Down Expand Up @@ -63,7 +63,7 @@ To pass validation, let's replace the key `private_key` in the ConfigMap in
`resources.yaml` with something else e.g. `public_key`.
Rerun the command. It will no longer have the warning.

## Function Reference Doc
### Function Reference Doc

TODO: replace the following with the link to the reference doc when our site is live.
https://github.com/GoogleContainerTools/kpt-functions-catalog/blob/master/functions/go/enforce-gatekeeper/README.md
4 changes: 2 additions & 2 deletions examples/ensure-name-substring/advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fieldSpecs:
The function will not only update field `.metadata.name` but also field
`.spec.name` in `MyResource`.

## Function invocation
### Function invocation

Get the config example and try it out by running the following commands:

Expand All @@ -37,7 +37,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run advanced
```

## Expected result
### Expected result

Check all resources have `prod-` in their names and the field `.spec.name` in
`MyResource` also got updated.
Expand Down
4 changes: 2 additions & 2 deletions examples/ensure-name-substring/prefix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data:
prepend: prod-
```
## Function invocation
### Function invocation
Get the config example and try it out by running the following commands:
Expand All @@ -29,7 +29,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run prefix
```

## Expected result
### Expected result

Check all resources have `prod-` in their names:

Expand Down
4 changes: 2 additions & 2 deletions examples/ensure-name-substring/suffix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data:
append: -prod
```
## Function invocation
### Function invocation
Get the config example and try it out by running the following commands:
Expand All @@ -29,7 +29,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run suffix
```

## Expected result
### Expected result

Check all resources have `-prod` in their names:

Expand Down
6 changes: 3 additions & 3 deletions examples/kubeval/simple/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# kubeval: simple example
# kubeval: Simple Example

The `kubeval` KRM config function validates Kubernetes resources using kubeval.
Learn more on the [kubeval website].

This example invokes the kubeval function against the builtin Kubernetes
v1.19.8 schema.

## Function invocation
### Function invocation

Get this example and try it out by running the following commands:

Expand All @@ -16,7 +16,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run simple
```

## Expected Results
### Expected Results

This should give the following output:

Expand Down
4 changes: 2 additions & 2 deletions examples/search-replace/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ metadata:
namespace: my-space
```

## Function invocation
### Function invocation

Get the config example and try it out by running the following commands:

Expand All @@ -51,7 +51,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run simple
```

## Expected result
### Expected result

Check the value of deployment `the-deloyment` is changed to `my-deloyment`.

Expand Down
4 changes: 2 additions & 2 deletions examples/set-annotations/advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CRD with group `dev.example.com`, version `v1` and kind `MyResource`. We want
the annotations to be added to field `.spec.selector.annotations` as well. We
specify it in field `fieldSpecs`.

## Function invocation
### Function invocation

Get the example config and try it out by running the following commands:

Expand All @@ -35,7 +35,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run advanced
```

## Expected result
### Expected result

Check the 2 annotations have been added to both the k8s built-in resources and
the custom resources.
Expand Down
4 changes: 2 additions & 2 deletions examples/set-annotations/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
The desired annotations are provided as key-value pairs using `data` field.

## Function invocation
### Function invocation

Get the example config and try it out by running the following commands:

Expand All @@ -26,7 +26,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run simple
```

## Expected result
### Expected result

Check the 2 annotations have been added.

Expand Down
4 changes: 2 additions & 2 deletions examples/set-labels/advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The desired labels is provided using `labels` field. We have a CRD with group
added to field `.spec.selector.labels` as well. We specify it in field
`fieldSpecs`.

## Function invocation
### Function invocation

Get the example config and try it out by running the following commands:

Expand All @@ -37,7 +37,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run advanced
```

## Expected result
### Expected result

Check all resources have 2 labels: `color: orange` and `fruit: apple`.

Expand Down
4 changes: 2 additions & 2 deletions examples/set-labels/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data:
The desired labels are provided as key-value pairs using `data` field.

## Function invocation
### Function invocation

Get the example config and try it out by running the following commands:

Expand All @@ -28,7 +28,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run simple
```

## Expected result
### Expected result

Check all resources have 2 labels `color: orange` and `fruit: apple`.

Expand Down
4 changes: 2 additions & 2 deletions examples/set-namespace/advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ with group `dev.example.com`, version `v1` and kind `MyResource`. We want the
namespace to be set in field `.spec.selector.annotations` as well. We specify it
in field `fieldSpecs`.

## Function invocation
### Function invocation

Get the example config and try it out by running the following commands:

Expand All @@ -34,7 +34,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run advanced
```

## Expected result
### Expected result

Check all resources have `.metadata.namespace` set to `example-ns`:

Expand Down
4 changes: 2 additions & 2 deletions examples/set-namespace/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
The desired namespace is provided using `.data.namespace` field.

## Function invocation
### Function invocation

Get the config example and try it out by running the following commands:

Expand All @@ -26,7 +26,7 @@ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/ex
kpt fn run simple
```

## Expected result
### Expected result

Check all resources have `metadata.namespace` set to `example-ns`:

Expand Down
Loading

0 comments on commit d4dd831

Please sign in to comment.