Skip to content

Commit

Permalink
Rename functions (#251)
Browse files Browse the repository at this point in the history
gatekeeper-validate -> enforce-gatekeeper
set-annotation -> set-annotations
set-label -> set-labels
helm-inflator -> inflate-helm-chart
istioctl-analyze -> analyze-istio
  • Loading branch information
Mengqi Yu authored Apr 28, 2021
1 parent 826517c commit 67c4131
Show file tree
Hide file tree
Showing 217 changed files with 151 additions and 1,482 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Istioctl Analyze
# analyze-istio

The `istioctl-analyze` KRM config function detects potential issues with your
The `analyze-istio` KRM config function detects potential issues with your
Istio configuration and outputs structured results detailing any errors found
during analysis. This example invokes the istioctl-analyze function using
during analysis. This example invokes the `analyze-istio` function using
declarative configuration.

## Function Invocation

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

```sh
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/contrib/istioctl-analyze .
kpt fn run istioctl-analyze
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/contrib/analyze-istio .
kpt fn run analyze-istio
```

## Expected Results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kpt-fn-contrib/istioctl-analyze:unstable
image: gcr.io/kpt-fn-contrib/analyze-istio:unstable
config.kubernetes.io/local-config: 'true'
data:
'--use-kube': 'false'
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Helm Template
# inflate-helm-chart

The `helm-inflator` KRM config function generates a new kpt package from a
local Helm chart. This example invokes the helm inflator function using
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

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

```sh
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/contrib/helm-inflator .
kpt fn run --as-current-user helm-inflator/local-configs --mount type=bind,src=$(pwd)/helm-inflator/helloworld-chart,dst=/source
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/contrib/inflate-helm-chart .
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

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

```sh
helm-inflator/local-configs
inflate-helm-chart/local-configs
├── [deployment_chart-helloworld-chart.yaml] Deployment chart-helloworld-chart
├── [fn-config.yaml] ConfigMap my-func-config
├── [pod_chart-helloworld-chart-test-connection.yaml] Pod chart-helloworld-chart-test-connection
Expand All @@ -29,7 +29,7 @@ helm-inflator/local-configs
To view changes without writing them into a file, a dry run can be performed as follows:

```sh
kpt fn run --as-current-user helm-inflator/local-configs --mount type=bind,src=$(pwd)/helm-inflator/helloworld-chart,dst=/source --dry-run
kpt fn run --as-current-user inflate-helm-chart/local-configs --mount type=bind,src=$(pwd)/inflate-helm-chart/helloworld-chart,dst=/source --dry-run
```

The expected output should match the following:
Expand Down Expand Up @@ -88,7 +88,7 @@ metadata:
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/kpt-fn-contrib/helm-inflator
image: gcr.io/kpt-fn-contrib/inflate-helm-chart
config.kubernetes.io/path: fn-config.yaml
data:
name: chart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/kpt-fn-contrib/helm-inflator:unstable
image: gcr.io/kpt-fn-contrib/inflate-helm-chart:unstable
data:
name: chart
local-chart-path: /source
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# gatekeeper-validate: invalid configmap
# enforce-gatekeeper: invalid configmap

## Overview

Expand All @@ -14,7 +14,7 @@ Get the package:

<!-- @getPkg @test -->
```shell
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/gatekeeper-validate/invalid-configmap .
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/enforce-gatekeeper/invalid-configmap .
```

Create a directory for storing the structured output.
Expand Down Expand Up @@ -72,4 +72,4 @@ Rerun the command. It will succeed (no output).
## 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/gatekeeper-validate/README.md
https://github.com/GoogleContainerTools/kpt-functions-catalog/blob/master/functions/go/enforce-gatekeeper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ metadata:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kpt-fn/gatekeeper-validate:unstable
image: gcr.io/kpt-fn/enforce-gatekeeper:unstable
config.kubernetes.io/local-config: 'true'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# gatekeeper-validate: warning only
# enforce-gatekeeper: warning only

## Overview

Expand All @@ -14,7 +14,7 @@ Get the package:

<!-- @getPkg @test -->
```shell
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/gatekeeper-validate/warning-only .
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/enforce-gatekeeper/warning-only .
```

Create a directory for storing the structured output.
Expand Down Expand Up @@ -66,4 +66,4 @@ Rerun the command. It will no longer have the warning.
## 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/gatekeeper-validate/README.md
https://github.com/GoogleContainerTools/kpt-functions-catalog/blob/master/functions/go/enforce-gatekeeper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ metadata:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kpt-fn/gatekeeper-validate:unstable
image: gcr.io/kpt-fn/enforce-gatekeeper:unstable
config.kubernetes.io/local-config: 'true'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff --git a/fn-config.yaml b/fn-config.yaml
deleted file mode 100644
index 0b492bf..0000000
index 97525b7..0000000
--- a/fn-config.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
Expand All @@ -11,7 +11,7 @@ index 0b492bf..0000000
- annotations:
- config.k8s.io/function: |
- container:
- image: gcr.io/kpt-fn/set-annotation:unstable
- image: gcr.io/kpt-fn/set-annotations:unstable
- config.kubernetes.io/local-config: 'true'
-annotations:
- fruit: apple
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# set-annotation: Advanced Example
# set-annotations: Advanced Example

The `set-annotation` function adds annotations to KRM resources.

Expand Down Expand Up @@ -31,7 +31,7 @@ Get the example config and try it out by running the following commands:

<!-- @getAndRunPkg @test -->
```sh
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/set-annotation/advanced .
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/set-annotations/advanced .
kpt fn run advanced
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kpt-fn/set-annotation:unstable
image: gcr.io/kpt-fn/set-annotations:unstable
config.kubernetes.io/local-config: 'true'
annotations:
fruit: apple
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff --git a/fn-config.yaml b/fn-config.yaml
deleted file mode 100644
index 2894009..0000000
index c4f0257..0000000
--- a/fn-config.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
Expand All @@ -11,7 +11,7 @@ index 2894009..0000000
- annotations:
- config.k8s.io/function: |
- container:
- image: gcr.io/kpt-fn/set-annotation:unstable
- image: gcr.io/kpt-fn/set-annotations:unstable
- config.kubernetes.io/local-config: 'true'
-data:
- color: orange
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# set-annotation: Simple Example
# set-annotations: Simple Example

The `set-annotation` function adds annotations to KRM resources.

Expand All @@ -22,7 +22,7 @@ Get the example config and try it out by running the following commands:

<!-- @getAndRunPkg @test -->
```sh
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/set-annotation/simple .
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/set-annotations/simple .
kpt fn run simple
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kpt-fn/set-annotation:unstable
image: gcr.io/kpt-fn/set-annotations:unstable
config.kubernetes.io/local-config: 'true'
data:
color: orange
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff --git a/fn-config.yaml b/fn-config.yaml
deleted file mode 100644
index 69bc62a..0000000
index 943382c..0000000
--- a/fn-config.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
Expand All @@ -11,7 +11,7 @@ index 69bc62a..0000000
- annotations:
- config.k8s.io/function: |
- container:
- image: gcr.io/kpt-fn/set-label:unstable
- image: gcr.io/kpt-fn/set-labels:unstable
- config.kubernetes.io/local-config: "true"
-labels:
- color: orange
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# set-label: Advanced Example
# set-labels: Advanced Example

The `set-label` function adds or updates labels in the `.metadata.labels` field
and other fields that has the same meaning as a label on all resources. You can
Expand Down Expand Up @@ -33,7 +33,7 @@ Get the example config and try it out by running the following commands:

<!-- @getAndRunPkg @test -->
```sh
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/set-label/advanced .
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/set-labels/advanced .
kpt fn run advanced
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kpt-fn/set-label:unstable
image: gcr.io/kpt-fn/set-labels:unstable
config.kubernetes.io/local-config: "true"
labels:
color: orange
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff --git a/fn-config.yaml b/fn-config.yaml
deleted file mode 100644
index 90ba8c0..0000000
index f2bf7f5..0000000
--- a/fn-config.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
Expand All @@ -11,7 +11,7 @@ index 90ba8c0..0000000
- annotations:
- config.k8s.io/function: |
- container:
- image: gcr.io/kpt-fn/set-label:unstable
- image: gcr.io/kpt-fn/set-labels:unstable
- config.kubernetes.io/local-config: "true"
-data:
- color: orange
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# set-label: Simple Example
# set-labels: Simple Example

The `set-label` function adds or updates labels in the `.metadata.labels` field
and other fields that has the same meaning as a label on all resources. You can
Expand All @@ -24,7 +24,7 @@ Get the example config and try it out by running the following commands:

<!-- @getAndRunPkg @test -->
```sh
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/set-label/simple .
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/set-labels/simple .
kpt fn run simple
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kpt-fn/set-label:unstable
image: gcr.io/kpt-fn/set-labels:unstable
config.kubernetes.io/local-config: "true"
data:
color: orange
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions functions/contrib/ts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ help: ## Print this help

# Edit this list to contain all ts functions
FUNCTIONS := \
helm-inflator \
istioctl-analyze \
inflate-helm-chart \
analyze-istio \
sops

# Targets for running all function tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ flags which do not take arguments while flags which take their own arguments,
like --suppress, should be passed as separate arguments. The “${OUTPUT_SHORT_FLAG}” and “${OUTPUT_LONG_FLAG}
flags are ignored as all output is included in config results. Consult the
reference for additional flags at:
https://istio.io/latest/docs/reference/commands/istioctl/#istioctl-analyze
https://istio.io/latest/docs/reference/commands/istioctl/#analyze-istio
Accepted arguments:
${FLAG_ARGS}: [Optional] List of flag arguments to istioctl analyze.
Expand All @@ -140,7 +140,7 @@ metadata:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kpt-fn-contrib/istioctl-analyze:unstable
image: gcr.io/kpt-fn-contrib/analyze-istio:unstable
config.kubernetes.io/local-config: "true"
data:
"${FLAG_ARGS}": ["--recursive"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ metadata:
annotations:
config.kubernetes.io/function: |
container:
image: gcr.io/kpt-fn-contrib/helm-inflator:unstable
image: gcr.io/kpt-fn-contrib/inflate-helm-chart:unstable
network: true
config.kubernetes.io/local-config: "true"
data:
Expand All @@ -274,7 +274,7 @@ metadata:
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kpt-fn-contrib/helm-inflator:unstable
image: gcr.io/kpt-fn-contrib/inflate-helm-chart:unstable
config.kubernetes.io/local-config: "true"
data:
${CHART_NAME}: my-chart
Expand Down
12 changes: 6 additions & 6 deletions functions/go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ GOBIN := $(shell go env GOPATH)/bin

# Edit this list to contain all go functions
FUNCTIONS := \
set-label \
set-annotation \
set-namespace \
starlark \
apply-setters \
enforce-gatekeeper \
ensure-name-substring \
search-replace \
gatekeeper-validate \
ensure-name-substring
set-annotations \
set-labels \
set-namespace \
starlark

# Targets for running all function tests
FUNCTION_TESTS := $(patsubst %,%-TEST,$(FUNCTIONS))
Expand Down
2 changes: 0 additions & 2 deletions functions/go/apply-setters/generated/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 67c4131

Please sign in to comment.