Skip to content

Commit 9fa654d

Browse files
authored
Adjust java app example (#104)
Signed-off-by: Benjamin Huo <benjamin@kubesphere.io> Signed-off-by: Benjamin Huo <benjamin@kubesphere.io>
1 parent e52b813 commit 9fa654d

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

apps/buildah/java/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ Follow [this guide](https://openfunction.dev/docs/getting-started/quickstarts/pr
1414

1515
2. Create function
1616

17-
For sample function below, modify the ``spec.image`` field in ``function-buildah-java.yaml`` to your own container registry address:
17+
For sample function below, modify the ``spec.image`` field in ``sample-java-app.yaml`` to your own container registry address:
1818

1919
```yaml
2020
apiVersion: core.openfunction.io/v1beta1
2121
kind: Function
2222
metadata:
23-
name: function-buildah-java
23+
name: sample-java-app
2424
spec:
2525
image: "<your registry name>/sample-buildah-java:latest"
2626
```
2727
2828
Use the following command to create this Function:
2929
3030
```shell
31-
kubectl apply -f function-buildah-java.yaml
31+
kubectl apply -f sample-java-app.yaml
3232
```
3333

3434
3. Access function
@@ -39,21 +39,21 @@ You can observe the process of a function with the following command:
3939
kubectl get functions.core.openfunction.io
4040

4141
NAME BUILDSTATE SERVINGSTATE BUILDER SERVING ADDRESS AGE
42-
function-buildah-java Succeeded Running builder-jgnzp serving-q6wdp http://function-buildah-java.default.svc.cluster.local/ 22m
42+
sample-java-app Succeeded Running builder-jgnzp serving-q6wdp http://sample-java-app.default.svc.cluster.local/ 22m
4343
```
4444

4545
The `Function.status.addresses` field provides various methods for accessing functions.
4646
Get `Function` addresses by running following command:
4747

4848
```shell
49-
kubectl get function function-buildah-java -o=jsonpath='{.status.addresses}'
49+
kubectl get function sample-java-app -o=jsonpath='{.status.addresses}'
5050
```
5151

5252
You will get the following address:
5353

5454
```json
55-
[{"type":"External","value":"http://function-buildah-java.default.ofn.io/"},
56-
{"type":"Internal","value":"http://function-buildah-java.default.svc.cluster.local/"}]
55+
[{"type":"External","value":"http://sample-java-app.default.ofn.io/"},
56+
{"type":"Internal","value":"http://sample-java-app.default.svc.cluster.local/"}]
5757
```
5858

5959
> You can use the following command to create a pod in the cluster and access the function from the pod:
@@ -65,13 +65,13 @@ You will get the following address:
6565
Access functions by the internal address:
6666
6767
```shell
68-
curl http://function-buildah-java.default.svc.cluster.local
68+
curl http://sample-java-app.default.svc.cluster.local
6969
```
7070
7171
Access functions by the external address:
7272
> To access the function via the Address of type `External` in `Funtion.status`, you should configure local domain first, see [Configure Local Domain](https://openfunction.dev/docs/operations/networking/local-domain/).
7373
7474
```shell
75-
curl http://function-buildah-java.default.ofn.io
75+
curl http://sample-java-app.default.ofn.io
7676
```
7777

apps/buildah/java/function-buildah-java.yaml renamed to apps/buildah/java/sample-java-app.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
apiVersion: core.openfunction.io/v1beta1
22
kind: Function
33
metadata:
4-
name: function-buildah-java
4+
name: sample-java-app
55
spec:
66
version: "v1.0.0"
7-
image: "openfunctiondev/sample-buildah-java:latest"
7+
image: "openfunctiondev/sample-java-app:v1"
88
imageCredentials:
99
name: push-secret
1010
#port: 8080 # default to 8080
@@ -23,5 +23,5 @@ spec:
2323
template:
2424
containers:
2525
- name: function
26-
imagePullPolicy: Always
26+
imagePullPolicy: IfNotPresent
2727

apps/sample-apps-java-maven.yaml renamed to apps/buildpacks/java/sample-java-app-buildpacks.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
apiVersion: core.openfunction.io/v1beta1
22
kind: Function
33
metadata:
4-
name: sample-app-java-maven
4+
name: sample-java-app-buildpacks
55
spec:
66
version: "v1.0.0"
7-
image: "openfunction/buildpacks-sample-apps-java-maven:latest"
7+
image: "openfunction/sample-java-app-buildpacks:v1"
88
imageCredentials:
99
name: push-secret
1010
port: 8080 # default to 8080
@@ -19,4 +19,4 @@ spec:
1919
template:
2020
containers:
2121
- name: function
22-
imagePullPolicy: Always
22+
imagePullPolicy: IfNotPresent

0 commit comments

Comments
 (0)