Docs and examples use config.k8s.io/function annotation

- Update function docs to recommend new annotation
- Update examples to use config.k8s.io/function annotation
This commit is contained in:
Prachi Pendse
2020-01-03 10:52:56 +05:30
parent 2880c2ae5d
commit 5ee6380b1c
14 changed files with 49 additions and 44 deletions

View File

@@ -222,15 +222,15 @@ Following is an example of running the `kustomize config run` using the precedin
metadata:
name: my-instance
annotations:
config.kubernetes.io/local-config: "true"
configFn:
config.k8s.io/function: |
container:
image: gcr.io/example-functions/nginx-template:v1.0.0
config.kubernetes.io/local-config: "true"
spec:
replicas: 5
- `configFn.container.image`: the image to use for this API
- `annotations[config.kubernetes.io/local-config]`: mark this as not a Resource that should
- `annotations.[config.k8s.io/function]`: the image to use for this API
- `annotations.[config.kubernetes.io/local-config]`: mark this as not a Resource that should
be applied
#### `kustomize config run dir/` (Output)

View File

@@ -22,8 +22,8 @@ order they appear in the file).
#### Config Functions:
Config functions are specified as Kubernetes types containing a metadata.configFn.container.image
field. This field tells run how to invoke the container.
Config functions are specified as Kubernetes types containing a metadata.annotations.[config.k8s.io/function]
field specifying an image for the container to run. This image tells run how to invoke the container.
Example config function:
@@ -31,17 +31,17 @@ order they appear in the file).
apiVersion: fn.example.com/v1beta1
kind: ExampleFunctionKind
metadata:
configFn:
annotations:
config.k8s.io/function: |
container:
# function is invoked as a container running this image
image: gcr.io/example/examplefunction:v1.0.1
annotations:
config.kubernetes.io/local-config: "true" # tools should ignore this
spec:
configField: configValue
In the preceding example, 'kustomize config run example/' would identify the function by
the metadata.configFn field. It would then write all Resources in the directory to
the metadata.annotations.[config.k8s.io/function] field. It would then write all Resources in the directory to
a container stdin (running the gcr.io/example/examplefunction:v1.0.1 image). It
would then write the container stdout back to example/, replacing the directory
file contents.

View File

@@ -228,15 +228,15 @@ Following is an example of running the ` + "`" + `kustomize config run` + "`" +
metadata:
name: my-instance
annotations:
config.kubernetes.io/local-config: "true"
configFn:
config.k8s.io/function: |
container:
image: gcr.io/example-functions/nginx-template:v1.0.0
config.kubernetes.io/local-config: "true"
spec:
replicas: 5
- ` + "`" + `configFn.container.image` + "`" + `: the image to use for this API
- ` + "`" + `annotations[config.kubernetes.io/local-config]` + "`" + `: mark this as not a Resource that should
- ` + "`" + `annotations.[config.k8s.io/function]` + "`" + `: the image to use for this API
- ` + "`" + `annotations.[config.kubernetes.io/local-config]` + "`" + `: mark this as not a Resource that should
be applied
#### ` + "`" + `kustomize config run dir/` + "`" + ` (Output)

View File

@@ -201,8 +201,8 @@ order they appear in the file).
#### Config Functions:
Config functions are specified as Kubernetes types containing a metadata.configFn.container.image
field. This field tells run how to invoke the container.
Config functions are specified as Kubernetes types containing a metadata.annotations.[config.k8s.io/function]
field specifying an image for the container to run. This image tells run how to invoke the container.
Example config function:
@@ -210,17 +210,17 @@ order they appear in the file).
apiVersion: fn.example.com/v1beta1
kind: ExampleFunctionKind
metadata:
configFn:
annotations:
config.k8s.io/function: |
container:
# function is invoked as a container running this image
image: gcr.io/example/examplefunction:v1.0.1
annotations:
config.kubernetes.io/local-config: "true" # tools should ignore this
spec:
configField: configValue
In the preceding example, 'kustomize config run example/' would identify the function by
the metadata.configFn field. It would then write all Resources in the directory to
the metadata.annotations.[config.k8s.io/function] field. It would then write all Resources in the directory to
a container stdin (running the gcr.io/example/examplefunction:v1.0.1 image). It
would then write the container stdout back to example/, replacing the directory
file contents.

View File

@@ -15,7 +15,7 @@ Resource configuration, and looks for invalid configuration.
## Function invocation
The function is invoked by authoring a [local Resource](local-resource)
with `metadata.configFn` and running:
with `metadata.annotations.[config.k8s.io/function]` and running:
kustomize config run local-resource/

View File

@@ -4,7 +4,8 @@
apiVersion: examples.config.kubernetes.io/v1beta1
kind: Validator
metadata:
configFn:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kustomize-functions/example-tshirt:v0.1.0
---

View File

@@ -25,7 +25,7 @@ function input, and writing the function output.
## Function invocation
The function is invoked by authoring a [local Resource](local-resource)
with `metadata.configFn` and running:
with `metadata.annotations.[config.k8s.io/function]` and running:
kustomize config run local-resource/

View File

@@ -5,7 +5,8 @@ apiVersion: examples.config.kubernetes.io/v1beta1 # call `kustomize config run`
kind: Nginx
metadata:
name: demo
configFn:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kustomize-functions/example-nginx:v0.1.0
spec:

View File

@@ -20,7 +20,7 @@ heavy lifting of implementing the function interface.
## Function invocation
The function is invoked by authoring a [local Resource](local-resource)
with `metadata.configFn` and running:
with `metadata.annotations.[config.k8s.io/function]` and running:
kustomize config run local-resource/

View File

@@ -6,7 +6,8 @@ apiVersion: examples.config.kubernetes.io/v1beta1
kind: CockroachDB
metadata:
name: demo
configFn:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kustomize-functions/example-cockroachdb:v0.1.0
spec:

View File

@@ -18,7 +18,7 @@ the `API` struct definition in [main.go](image/main.go) for documentation.
## Function invocation
The function is invoked by authoring a [local Resource](local-resource)
with `metadata.configFn` and running:
with `metadata.annotations.[config.k8s.io/function]` and running:
kustomize config run local-resource/

View File

@@ -4,7 +4,8 @@
apiVersion: examples.config.kubernetes.io/v1beta1
kind: Kubeval
metadata:
configFn:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kustomize-functions/example-validator-kubeval:v0.1.0
spec:

View File

@@ -15,7 +15,7 @@ Resource configuration, and looks for invalid configuration.
## Function invocation
The function is invoked by authoring a [local Resource](local-resource)
with `metadata.configFn` and running:
with `metadata.annotations.[config.k8s.io/function]` and running:
kustomize config run local-resource/

View File

@@ -4,7 +4,8 @@
apiVersion: examples.config.kubernetes.io/v1beta1
kind: Validator
metadata:
configFn:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kustomize-functions/example-validator:v0.1.0
---