Skip to content

Commit

Permalink
Add note about .SelectKeyParts to README
Browse files Browse the repository at this point in the history
  • Loading branch information
Vassil Kovatchev committed Apr 14, 2021
1 parent 19bc3ed commit cbf53ca
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ When a patch is evaluated, KubeMod executes the patch value as a [Golang templat

* `.Target` - the original resource object being patched with all its properties.
* `.Namespace` - the namespace of the resource object.

* `.SelectKeyParts` - when `select` was used for the patch, `.SelectKeyParts` can be used in `value` to access
the wildcard/filter values captured for this patch operation.

### Resource rejection

Expand Down Expand Up @@ -707,14 +708,16 @@ value: |-
protocol: UDP
```

##### Golang Template
#### Golang Template

When `value` contains `{{ ... }}`, it is evaluated as a [Golang template](https://golang.org/pkg/text/template/).

The following intrinsic item are accessible through the template's context:
The following intrinsic items are accessible through the template's context:

* `.Target` — the original resource object being patched.
* `.Namespace` — the namespace of the target object.
* `.SelectKeyParts` - when `select` was used for the patch, `.SelectKeyParts` can be used in `value` to access
the wildcard/filter values captured for this patch operation.

For example, the following excerpt of a Jaeger side-car injection `ModRule` includes a `value` which uses `{{ .Target.metadata.name }}` to access the name of the `Deployment` being patched.

Expand Down

0 comments on commit cbf53ca

Please sign in to comment.