Skip to content

Commit

Permalink
Merge pull request #811 from kremerpatrick/development
Browse files Browse the repository at this point in the history
  • Loading branch information
embano1 authored Mar 7, 2022
2 parents cc04243 + 11f9c4e commit f2186d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions examples/knative/powercli/kn-pcli-template/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Knative Function Template
Delete this section before publishing your new function
- Find all instances of #REPLACE-ME# and replace it with descriptive names for your function
- Find all instances of `#REPLACE-FN-NAME#` and replace it with descriptive names for your function
- For example, if you are writing a function for a distributed virtual switch, you might name the function `kn-pcli-dvs`
- Find all instances of FUNCTION_SECRET and function_secret, replacing it with descriptive names for your function. For example, if you are writing a function for a distributed virtual switch, you might use DVS_SECRET
- test/docker-test-env-variable
Expand All @@ -9,8 +9,8 @@ Delete this section before publishing your new function
- function_secret.json (rename the file)
- Obtain a new payload file
- The example `test/test-payload.json` is a sample event payload file for event type `DvsReconfiguredEvent`. This needs to be replaced with the payload for your specific event. This is easily obtained using the built-in Sockeye service. Browse to the `/events` endpoint of your VEBA deployment and cause your event to trigger. You can then can easily copy and paste the payload from the output in Sockeye.
# kn-pcli-#REPLACE-ME#
Example Knative PowerCLI function #REPLACE-ME#
# kn-pcli-#REPLACE-FN-NAME#
Example Knative PowerCLI function kn-pcli-#REPLACE-FN-NAME#

# Step 1 - Build

Expand All @@ -22,14 +22,14 @@ Create the container image locally to test your function logic.
Mac/Linux
```
# change the IMAGE name accordingly, example below for Docker
export IMAGE=<docker-username>/kn-pcli-#REPLACE-ME#:1.0
export IMAGE=<docker-username>/kn-pcli-#REPLACE-FN-NAME#:1.0
docker build -t ${IMAGE} .
```

Windows
```
# change the IMAGE name accordingly, example below for Docker
$IMAGE="<docker-username>/kn-pcli-#REPLACE-ME#:1.0"
$IMAGE="<docker-username>/kn-pcli-#REPLACE-FN-NAME#:1.0"
docker build -t ${IMAGE} .
```
# Step 2 - Test
Expand All @@ -54,12 +54,12 @@ If you built a custom image in Step 1, comment out the default `IMAGE` command b

Mac/Linux
```console
export IMAGE=us.gcr.io/daisy-284300/veba/kn-#REPLACE-ME#:1.0
export IMAGE=us.gcr.io/daisy-284300/veba/kn-pcli-#REPLACE-FN-NAME#:1.0
docker run -e FUNCTION_DEBUG=true -e PORT=8080 --env-file docker-test-env-variable -it --rm -p 8080:8080 ${IMAGE}
```
Windows
```console
$IMAGE="us.gcr.io/daisy-284300/veba/kn-pcli-#REPLACE-ME#:1.0"
$IMAGE="us.gcr.io/daisy-284300/veba/kn-pcli-#REPLACE-FN-NAME#:1.0"
docker run -e FUNCTION_DEBUG=true -e PORT=8080 --env-file docker-test-env-variable -it --rm -p 8080:8080 ${IMAGE}
```

Expand Down
6 changes: 3 additions & 3 deletions examples/knative/powercli/kn-pcli-template/function.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: kn-pcli-#REPLACE-ME#
name: kn-pcli-#REPLACE-FN-NAME#
labels:
app: veba-ui
spec:
Expand All @@ -12,7 +12,7 @@ spec:
autoscaling.knative.dev/minScale: "1"
spec:
containers:
- image: us.gcr.io/daisy-284300/veba/kn-pcli-#REPLACE-ME#:1.0
- image: us.gcr.io/daisy-284300/veba/kn-pcli-#REPLACE-FN-NAME#:1.0
envFrom:
- secretRef:
name: vds-secret
Expand All @@ -23,7 +23,7 @@ spec:
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
name: veba-pcli-#REPLACE-ME#-trigger
name: veba-pcli-#REPLACE-FN-NAME#-trigger
labels:
app: veba-ui
spec:
Expand Down
4 changes: 2 additions & 2 deletions examples/knative/powercli/kn-pcli-template/handler.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ Function Process-Handler {
# Write-Host "$(Get-Date) - ERROR: "

# This is the final line of your custom code.
# Replace #REPLACE-ME# with a meaningful message showing the end of your custom code
#Write-Host "$(Get-Date) - #REPLACE-ME# operation complete ...`n"
# Replace #REPLACE-FN-NAME# with a meaningful message showing the end of your custom code
#Write-Host "$(Get-Date) - #REPLACE-FN-NAME# operation complete ...`n"

Write-Host "$(Get-Date) - Handler Processing Completed ...`n"
}

0 comments on commit f2186d1

Please sign in to comment.