@@ -45,14 +45,14 @@ The unit of deployment in Boson Functions is an [OCI](https://opencontainers.org
45
45
container image, typically referred to as a Docker container image.
46
46
47
47
In order for the ` func ` CLI to manage these containers, you'll need to be
48
- logged in to a container registry. For example, ` docker.io/lanceball `
48
+ logged in to a container registry. For example, ` docker.io/developer `
49
49
50
50
51
51
``` bash
52
52
# Typically, this will log you in to docker hub if you
53
53
# omit <registry.url>. If you are using a registry
54
54
# other than Docker hub, provide that for <registry.url>
55
- docker login -u lanceball -p [redacted] < registry.url>
55
+ docker login -u developer -p [redacted] < registry.url>
56
56
```
57
57
58
58
> Note: many of the ` func ` CLI commands take a ` --registry ` argument.
@@ -62,20 +62,21 @@ docker login -u lanceball -p [redacted] <registry.url>
62
62
``` bash
63
63
# This should be set to a registry that you have write permission
64
64
# on and you have logged into in the previous step.
65
- export FUNC_REGISTRY=docker.io/lanceball
65
+ export FUNC_REGISTRY=docker.io/developer
66
66
```
67
67
68
68
## Creating a Project
69
69
70
70
With your Knative enabled cluster up and running, you can now create a new
71
- Function Project. Let's start by creating a project directory. Function names
72
- in ` func ` correspond to URLs at the moment, and there are some finicky cases
73
- at the moment. To ensure that everything works as it should, create a project
74
- directory consisting of three URL parts. Here is a good one.
71
+ Function Project. Let's start by creating a project directory. Function name
72
+ must consist of lower case alphanumeric characters or '-',
73
+ and must start and end with an alphanumeric character
74
+ (e.g. 'my-name', or '123-abc', regex used for validation is ` [a-z0-9]([-a-z0-9]*[a-z0-9])? ` ).
75
+
75
76
76
77
``` bash
77
- mkdir fn. example. io
78
- cd fn. example. io
78
+ mkdir fn- example- io
79
+ cd fn- example- io
79
80
```
80
81
81
82
Now, we will create the project files, build a container, and
@@ -84,7 +85,6 @@ deploy the function as a Knative service.
84
85
85
86
``` bash
86
87
func create -l node
87
- func build
88
88
func deploy
89
89
```
90
90
@@ -93,9 +93,15 @@ all of the defaults inferred from your environment, for example`$FUNC_REGISTRY`.
93
93
When the command has completed, you can see the deployed function.
94
94
95
95
``` bash
96
- kn service list
97
- NAME URL LATEST AGE CONDITIONS READY REASON
98
- fn-example-io http://fn-example-io.func.127.0.0.1.nip.io fn-example-io-ngswh-1 24s 3 OK / 3 True
96
+ func describe
97
+ Function name:
98
+ fn-example-io
99
+ Function is built in image:
100
+ docker.io/developer/fn-example-io:latest
101
+ Function is deployed in namespace:
102
+ default
103
+ Routes:
104
+ http://fn-example-io-default.apps.functions.my-cluster.com
99
105
```
100
106
101
107
Clicking on the URL will take you to the running function in your cluster. You
@@ -108,7 +114,7 @@ should see a simple response.
108
114
You can add query parameters to the request to see those echoed in return.
109
115
110
116
``` console
111
- curl "http://fn-example-io.func.127.0.0.1.nip.io ?name=tiger"
117
+ curl "http://fn-example-io-default.apps.functions.my-cluster.com ?name=tiger"
112
118
{"query":{"name":"tiger"},"name":"tiger"}
113
119
```
114
120
@@ -150,7 +156,7 @@ You might see a message such as this.
150
156
Error: remover failed to delete the service: timeout: service ' fn-example-io' not ready after 30 seconds.
151
157
```
152
158
153
- If you do, just run ` kn service list` to see if the function is still deployed.
159
+ If you do, just run ` func list` to see if the function is still deployed.
154
160
It might just take a little time for it to be removed.
155
161
156
162
Now, let's clean up the current directory.
@@ -168,9 +174,9 @@ cluster, use the `create` command.
168
174
func create -l node -t http
169
175
```
170
176
171
- You can also create a Quarkus or a Golang project by providing ` quarkus ` or ` go `
172
- respectively to the ` -l ` flag. To create a project with a template for
173
- CloudEvents, provide ` events ` to the ` -t ` flag.
177
+ You can also create a Quarkus, SpringBoot, Python or a Golang project by providing
178
+ ` quarkus ` , ` springboot ` , ` python ` or ` go ` respectively to the ` -l ` flag.
179
+ To create a project with a template for CloudEvents, provide ` events ` to the ` -t ` flag.
174
180
175
181
### ` func build `
176
182
0 commit comments