Skip to content

Commit

Permalink
update for starlark/v0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mengqi Yu committed Jul 14, 2021
1 parent c27cecd commit 5bb72c2
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#! /bin/bash

kpt fn eval --image gcr.io/kpt-fn/starlark:unstable --image-pull-policy never -- source="$(cat set-replicas.star)" replicas=5
kpt fn eval --image gcr.io/kpt-fn/starlark:v0.2 --image-pull-policy never -- source="$(cat set-replicas.star)" replicas=5
4 changes: 2 additions & 2 deletions examples/starlark-configmap-as-functionconfig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ line arguments.
Get the example package by running the following commands:

```shell
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/starlark-configmap-as-functionconfig
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/starlark-configmap-as-functionconfig@starlark/v0.2
```

We are going to use the following starlark script:
Expand All @@ -33,7 +33,7 @@ setReplicas(ctx.resource_list["items"], replicas)
Invoke the function by running the following commands:

```shell
$ kpt fn eval --image gcr.io/kpt-fn/starlark:unstable -- source="$(cat set-replicas.star)" replicas=5
$ kpt fn eval --image gcr.io/kpt-fn/starlark:v0.2 -- source="$(cat set-replicas.star)" replicas=5
```

### Expected result
Expand Down
2 changes: 1 addition & 1 deletion examples/starlark-inject-sidecar/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ metadata:
name: example
pipeline:
mutators:
- image: gcr.io/kpt-fn/starlark:unstable
- image: gcr.io/kpt-fn/starlark:v0.2
configPath: fn-config.yaml
4 changes: 2 additions & 2 deletions examples/starlark-inject-sidecar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ to inject sidecar container to `Deployment`.
Get the example package by running the following commands:

```shell
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/starlark-inject-sidecar
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/starlark-inject-sidecar@starlark/v0.2
```

We are going to use the following `Kptfile` and `fn-config.yaml` to configure
Expand All @@ -24,7 +24,7 @@ metadata:
name: example
pipeline:
mutators:
- image: gcr.io/kpt-fn/starlark:unstable
- image: gcr.io/kpt-fn/starlark:v0.2
configPath: fn-config.yaml
```

Expand Down
2 changes: 1 addition & 1 deletion examples/starlark-poddisruptionbudget/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ metadata:
name: example
pipeline:
mutators:
- image: gcr.io/kpt-fn/starlark:unstable
- image: gcr.io/kpt-fn/starlark:v0.2
configPath: fn-config.yaml
4 changes: 2 additions & 2 deletions examples/starlark-poddisruptionbudget/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ the `functionConfig` and use it in the script.
Get the example package by running the following commands:

```shell
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/starlark-poddisruptionbudget
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/starlark-poddisruptionbudget@starlark/v0.2
```

We are going to use the following `Kptfile` and `fn-config.yaml` to configure
Expand All @@ -26,7 +26,7 @@ metadata:
name: example
pipeline:
mutators:
- image: gcr.io/kpt-fn/starlark:unstable
- image: gcr.io/kpt-fn/starlark:v0.2
configPath: fn-config.yaml
```

Expand Down
2 changes: 1 addition & 1 deletion examples/starlark-set-namespace/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ metadata:
name: example
pipeline:
mutators:
- image: gcr.io/kpt-fn/starlark:unstable
- image: gcr.io/kpt-fn/starlark:v0.2
configPath: fn-config.yaml
4 changes: 2 additions & 2 deletions examples/starlark-set-namespace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ to set namespaces to KRM resources.
Get the example package by running the following commands:

```shell
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/starlark-set-namespace
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/starlark-set-namespace@starlark/v0.2
```

We are going to use the following `Kptfile` and `fn-config.yaml` to configure
Expand All @@ -24,7 +24,7 @@ metadata:
name: example
pipeline:
mutators:
- image: gcr.io/kpt-fn/starlark:unstable
- image: gcr.io/kpt-fn/starlark:v0.2
configPath: fn-config.yaml
```

Expand Down
2 changes: 1 addition & 1 deletion examples/starlark-validation/.expected/results.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: fnresults
exitCode: 1
items:
- image: gcr.io/kpt-fn/starlark:unstable
- image: gcr.io/kpt-fn/starlark:v0.2
stderr: '[error] : fail: it is prohibited to have private key in a configmap'
exitCode: 1
results:
Expand Down
2 changes: 1 addition & 1 deletion examples/starlark-validation/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ metadata:
name: example
pipeline:
validators:
- image: gcr.io/kpt-fn/starlark:unstable
- image: gcr.io/kpt-fn/starlark:v0.2
configPath: fn-config.yaml
6 changes: 3 additions & 3 deletions examples/starlark-validation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ to validate a `ConfigMap`.
Get the example package by running the following commands:

```shell
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/starlark-validation
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/starlark-validation@starlark/v0.2
```

We are going to use the following `Kptfile` and `fn-config.yaml` to configure
Expand All @@ -24,7 +24,7 @@ metadata:
name: example
pipeline:
mutators:
- image: gcr.io/kpt-fn/starlark:unstable
- image: gcr.io/kpt-fn/starlark:v0.2
configPath: fn-config.yaml
```

Expand Down Expand Up @@ -67,7 +67,7 @@ metadata:
name: fnresults
exitCode: 1
items:
- image: gcr.io/kpt-fn/starlark:unstable
- image: gcr.io/kpt-fn/starlark:v0.2
stderr: 'fail: it is prohibited to have private key in a configmap'
exitCode: 1
results:
Expand Down
4 changes: 2 additions & 2 deletions functions/go/starlark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ There are 2 ways to run the function imperatively.
starlark script lives in `main.star` file.

```shell
$ kpt fn eval --image gcr.io/kpt-fn/starlark:unstable -- source="$(cat main.star)" param1=value1 param2=value2
$ kpt fn eval --image gcr.io/kpt-fn/starlark:v0.2 -- source="$(cat main.star)" param1=value1 param2=value2
```

- Run it using `--fn-config` with either a `ConfigMap` or a `StarlarkRun` that
lives in `fn-config.yaml`.

```shell
$ kpt fn eval --image gcr.io/kpt-fn/starlark:unstable --fn-config fn-config.yaml
$ kpt fn eval --image gcr.io/kpt-fn/starlark:v0.2 --fn-config fn-config.yaml
```

### Developing Starlark Script
Expand Down
12 changes: 6 additions & 6 deletions functions/go/starlark/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ description: Run a Starlark script to mutate or validate resources.
tags:
- mutator
- validator
sourceURL: https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/master/functions/go/starlark
sourceURL: https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/starlark/v0.2/functions/go/starlark
examplePackageURLs:
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/master/examples/starlark-set-namespace
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/master/examples/starlark-inject-sidecar
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/master/examples/starlark-poddisruptionbudget
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/master/examples/starlark-validation
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/master/examples/starlark-configmap-as-functionconfig
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/starlark/v0.2/examples/starlark-set-namespace
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/starlark/v0.2/examples/starlark-inject-sidecar
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/starlark/v0.2/examples/starlark-poddisruptionbudget
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/starlark/v0.2/examples/starlark-validation
- https://github.com/GoogleContainerTools/kpt-functions-catalog/tree/starlark/v0.2/examples/starlark-configmap-as-functionconfig
emails:
- kpt-team@google.com
license: Apache-2.0

0 comments on commit 5bb72c2

Please sign in to comment.