Skip to content

Commit 1ac3c93

Browse files
Update search-replace docs for v0.2 (#485)
* Update search-replace docs for v0.1.1 * Update docs to v0.2 * Update sourceURL * Update example urls * Update example urls
1 parent fa5eb54 commit 1ac3c93

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/bash
22

33
# shellcheck disable=SC2016
4-
kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable --image-pull-policy never -- \
4+
kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 --image-pull-policy never -- \
55
by-path='data.**' by-value-regex='(.*)nginx.com(.*)' put-comment='kpt-set: ${1}${host}${2}'

examples/search-replace-create-setters/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This is an advanced example depicting [setter] creation process using `search-re
1212
Get the example package by running the following commands:
1313

1414
```shell
15-
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/search-replace-create-setters
15+
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/search-replace-create-setters@search-replace/v0.2
1616
```
1717

1818
Let's start with the input resource
@@ -37,7 +37,7 @@ You can target specific values using path expression and regex capture groups,
3737
and add setter comments as per your intent.
3838

3939
```shell
40-
$ kpt fn eval search-replace-create-setters --image gcr.io/kpt-fn/search-replace:unstable -- \
40+
$ kpt fn eval search-replace-create-setters --image gcr.io/kpt-fn/search-replace:v0.2 -- \
4141
by-path='data.**' by-value-regex='(.*)nginx.com(.*)' put-comment='kpt-set: ${1}${host}${2}'
4242
```
4343

examples/search-replace-simple/Kptfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ metadata:
44
name: example
55
pipeline:
66
mutators:
7-
- image: gcr.io/kpt-fn/search-replace:unstable
7+
- image: gcr.io/kpt-fn/search-replace:v0.2
88
configMap:
99
by-path: metadata.name
1010
by-value: the-deployment

examples/search-replace-simple/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This is a simple example depicting search and replace operation on KRM resource
1212
Get the example package by running the following commands:
1313

1414
```shell
15-
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/search-replace-simple
15+
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/search-replace-simple@search-replace/v0.2
1616
```
1717

1818
Let's start with the input resource

functions/go/search-replace/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ data:
7676
The function can be invoked using:
7777
7878
```shell
79-
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable --fn-config /path/to/fn-config.yaml
79+
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 --fn-config /path/to/fn-config.yaml
8080
```
8181

8282
Alternatively, data can be passed as key-value pairs in the CLI
8383

8484
```shell
85-
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable -- 'by-path=metadata.name' 'put-value=the-deployment'
85+
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 -- 'by-path=metadata.name' 'put-value=the-deployment'
8686
```
8787

8888
### Field path patterns
@@ -233,38 +233,38 @@ baz.yaml
233233

234234
```shell
235235
# Matches fields with value "3":
236-
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable -- by-value=3
236+
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 -- by-value=3
237237
```
238238

239239
```shell
240240
# Matches fields with value prefixed by "nginx-":
241-
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable -- by-value-regex='ngnix-.*'
241+
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 -- by-value-regex='ngnix-.*'
242242
```
243243

244244
```shell
245245
# Matches field with path "spec.namespaces" set to "bookstore":
246-
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable -- by-path='metadata.namespace' by-value='bookstore'
246+
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 -- by-path='metadata.namespace' by-value='bookstore'
247247
```
248248

249249
```shell
250250
# Matches fields with name "containerPort" arbitrarily deep in "spec" that have value of 80:
251-
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable -- by-path='spec.**.containerPort' by-value=80
251+
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 -- by-path='spec.**.containerPort' by-value=80
252252
```
253253

254254
```shell
255255
# Set namespaces for all resources to "bookstore", even namespace is not set on a resource:
256-
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable -- by-path='metadata.namespace' put-value='bookstore'
256+
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 -- by-path='metadata.namespace' put-value='bookstore'
257257
```
258258

259259
```shell
260260
# Update the setter value "project-id" to value "new-project" in all "setters.yaml" files in the current directory tree:
261-
kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable --include-meta-resources -- \
261+
kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 --include-meta-resources -- \
262262
by-value=project-id by-file-path='**/setters.yaml' put-value=new-project
263263
```
264264

265265
```shell
266266
# Search and Set multiple values using regex numbered capture groups
267-
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable -- by-value-regex='something-(.*)' put-value='my-project-id-${1}'
267+
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 -- by-value-regex='something-(.*)' put-value='my-project-id-${1}'
268268
metadata:
269269
name: something-foo
270270
namespace: something-bar
@@ -278,12 +278,12 @@ metadata:
278278

279279
```shell
280280
# Put the setter pattern as a line comment for matching fields.
281-
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable -- by-value='my-project-id-foo' put-comment='kpt-set: ${project-id}-foo'
281+
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 -- by-value='my-project-id-foo' put-comment='kpt-set: ${project-id}-foo'
282282
metadata:
283283
name: my-project-id-foo # kpt-set: ${project-id}-foo
284284
285285
# Setter pattern comments can be added to multiple values matching a regex numbered capture groups
286-
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:unstable -- by-value-regex='my-project-id-(.*)' put-comment='kpt-set: ${project-id}-${1}'
286+
$ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2 -- by-value-regex='my-project-id-(.*)' put-comment='kpt-set: ${project-id}-${1}'
287287
metadata:
288288
name: my-project-id-foo # kpt-set: ${project-id}-foo
289289
namespace: my-project-id-bar # kpt-set: ${project-id}-bar

functions/go/search-replace/metadata.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ image: gcr.io/kpt-fn/search-replace
22
description: Search and optionally replace field values.
33
tags:
44
- mutator
5-
sourceURL: https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/master/functions/go/search-replace
5+
sourceURL: https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/search-replace/v0.2/functions/go/search-replace
66
examplePackageURLs:
7-
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/master/examples/search-replace-simple
8-
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/master/examples/search-replace-create-setters
7+
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/search-replace/v0.2/examples/search-replace-simple
8+
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/search-replace/v0.2/examples/search-replace-create-setters
99
emails:
1010
- kpt-team@google.com
1111
license: Apache-2.0

0 commit comments

Comments
 (0)