Skip to content

Commit

Permalink
Revise the hello world standard steps
Browse files Browse the repository at this point in the history
  • Loading branch information
ssorj committed Jan 17, 2024
1 parent b3e6062 commit bfd3fda
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 74 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ options:
commands:
{command}
generate Generate README.md from the data in skewer.yaml
render Render README.html from the data in skewer.yaml
render Render README.html from README.md
clean Clean up the source tree
run Run the example steps
demo Run the example steps and pause for a demo before cleaning up
test Test README generation and run the steps
test Test README generation and run the steps on Minikube
update-skewer Update the embedded Skewer repo and GitHub workflow
~~~

Expand Down Expand Up @@ -203,11 +203,22 @@ steps:
- standard: cleaning_up
~~~

Note that the `link_your_namespaces` and `test_the_application` steps
are less generic than the other steps, so check that the text and
commands they produce are doing what you need. If not, you'll need to
Note that the `link_your_namespaces` step is less generic than the
other steps (it assumes only two sites), so check that the text and
commands it produces are doing what you need. If not, you'll need to
provide a custom step.

There are also some standard steps for examples based on the Skupper
Hello World application:

~~~ yaml
steps:
- standard: hello_world/deploy_the_application
- standard: hello_world/expose_the_backend_service
- standard: hello_world/test_the_application
- standard: hello_world/cleaning_up
~~~

The step commands are separated into named groups corresponding to the
sites. Each named group contains a list of command entries. Each
command entry has a `run` field containing a shell command and other
Expand Down
65 changes: 31 additions & 34 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ across cloud providers, data centers, and edge sites.
* [Step 6: Check the status of your namespaces](#step-6-check-the-status-of-your-namespaces)
* [Step 7: Link your namespaces](#step-7-link-your-namespaces)
* [Step 8: Fail on demand](#step-8-fail-on-demand)
* [Step 9: Deploy and expose the frontend](#step-9-deploy-and-expose-the-frontend)
* [Step 10: Deploy and expose the backend](#step-10-deploy-and-expose-the-backend)
* [Step 9: Deploy the application](#step-9-deploy-the-application)
* [Step 10: Expose the backend service](#step-10-expose-the-backend-service)
* [Step 11: Test the application](#step-11-test-the-application)
* [Accessing the web console](#accessing-the-web-console)
* [Cleaning up](#cleaning-up)
Expand Down Expand Up @@ -59,8 +59,8 @@ prompts you to add the command to your path if necessary.
For Windows and other installation options, see [Installing
Skupper][install-docs].

[install-script]: https://github.com/skupperproject/skupper-website/blob/main/docs/install.sh
[install-docs]: https://skupper.io/install/index.html
[install-script]: https://github.com/skupperproject/skupper-website/blob/main/input/install.sh
[install-docs]: https://skupper.io/install/

## Step 2: Configure separate console sessions

Expand Down Expand Up @@ -245,82 +245,79 @@ if [ -n "${SKEWER_FAIL}" ]; then expr 1 / 0; fi

~~~

## Step 9: Deploy and expose the frontend
## Step 9: Deploy the application

We have established connectivity between the two namespaces and
made the backend in `east` available to the frontend in `west`.
Before we can test the application, we need external access to the
frontend.

Use `kubectl create deployment` to deploy the frontend service in
West. Use `kubectl expose` with `--type LoadBalancer` to open
network access to the frontend service.
Use `kubectl create deployment` to deploy the frontend and backend
services.

_**Console for West:**_

~~~ shell
kubectl create deployment frontend --image quay.io/skupper/hello-world-frontend
kubectl expose deployment/frontend --port 8080 --type LoadBalancer
~~~

_Sample output:_

~~~ console
$ kubectl create deployment frontend --image quay.io/skupper/hello-world-frontend
deployment.apps/frontend created
_**Console for East:**_

$ kubectl expose deployment/frontend --port 8080 --type LoadBalancer
service/frontend exposed
~~~ shell
kubectl create deployment backend --image quay.io/skupper/hello-world-backend --replicas 3
~~~

## Step 10: Deploy and expose the backend
## Step 10: Expose the backend service

We now have two namespaces linked to form a Skupper network, but
no services are exposed on it. Skupper uses the `skupper
expose` command to select a service from one namespace for
exposure on all the linked namespaces.
exposure in all the linked namespaces.

Use `kubectl create deployment` to deploy the backend service in
East. Use `skupper expose` to expose the backend service to the
frontend service.
Use `skupper expose` to expose the backend service on the Skupper
network.

_**Console for East:**_

~~~ shell
kubectl create deployment backend --image quay.io/skupper/hello-world-backend --replicas 3
skupper expose deployment/backend --port 8080
~~~

_Sample output:_

~~~ console
$ kubectl create deployment backend --image quay.io/skupper/hello-world-backend --replicas 3
deployment.apps/backend created

$ skupper expose deployment/backend --port 8080
deployment backend exposed as backend
~~~

## Step 11: Test the application

Now we're ready to try it out. Use `kubectl get service/frontend`
to look up the external IP of the frontend service. Then use
`curl` or a similar tool to request the `/api/health` endpoint at
that address.
We have established connectivity between the two namespaces and
made the backend available to the frontend. Before we can test
the application, we need external access to the frontend.

Use `kubectl expose` with `--type LoadBalancer` to open network
access to the frontend service.

Once the frontend is exposed, use `kubectl get service/frontend`
to look up the external IP of the frontend service. If the
external IP is `<pending>`, try again after a moment.

Once you have the external IP, use `curl` or a similar tool to
request the `/api/health` endpoint at that address.

**Note:** The `<external-ip>` field in the following commands is a
placeholder. The actual value is an IP address.

_**Console for West:**_

~~~ shell
kubectl expose deployment/frontend --port 8080 --type LoadBalancer
kubectl get service/frontend
curl http://<external-ip>:8080/api/health
~~~

_Sample output:_

~~~ console
$ kubectl expose deployment/frontend --port 8080 --type LoadBalancer
service/frontend exposed

$ kubectl get service/frontend
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
frontend LoadBalancer 10.103.232.28 <external-ip> 8080:30407/TCP 15s
Expand Down
4 changes: 2 additions & 2 deletions example/skewer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ steps:
west:
- run: |
if [ -n "${SKEWER_FAIL}" ]; then expr 1 / 0; fi
- standard: hello_world/deploy_and_expose_the_frontend
- standard: hello_world/deploy_and_expose_the_backend
- standard: hello_world/deploy_the_application
- standard: hello_world/expose_the_backend_service
- standard: hello_world/test_the_application
- standard: accessing_the_web_console
- standard: hello_world/cleaning_up
Expand Down
7 changes: 6 additions & 1 deletion python/skewer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,12 @@ def apply_standard_steps(model):
if "standard" not in step.data:
continue

standard_step_data = standard_steps[step.data["standard"]]
standard_step_name = step.data["standard"]

try:
standard_step_data = standard_steps[standard_step_name]
except KeyError:
fail(f"Standard step '{standard_step_name}' not found")

del step.data["standard"]

Expand Down
64 changes: 32 additions & 32 deletions python/skewer/standardsteps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ install_the_skupper_command_line_tool:
For Windows and other installation options, see [Installing
Skupper][install-docs].
[install-script]: https://github.com/skupperproject/skupper-website/blob/main/docs/install.sh
[install-docs]: https://skupper.io/install/index.html
[install-script]: https://github.com/skupperproject/skupper-website/blob/main/input/install.sh
[install-docs]: https://skupper.io/install/
configure_separate_console_sessions:
title: Configure separate console sessions
preamble: |
Expand Down Expand Up @@ -200,54 +200,54 @@ cleaning_up:
commands:
"*":
- run: skupper delete
hello_world/deploy_and_expose_the_backend:
title: Deploy and expose the backend
hello_world/deploy_the_application:
title: Deploy the application
preamble: |
Use `kubectl create deployment` to deploy the frontend and backend
services.
commands:
"0":
- run: kubectl create deployment frontend --image quay.io/skupper/hello-world-frontend
"1":
- run: kubectl create deployment backend --image quay.io/skupper/hello-world-backend --replicas 3
hello_world/expose_the_backend_service:
title: Expose the backend service
preamble: |
We now have two namespaces linked to form a Skupper network, but
no services are exposed on it. Skupper uses the `skupper
expose` command to select a service from one namespace for
exposure on all the linked namespaces.
exposure in all the linked namespaces.
Use `kubectl create deployment` to deploy the backend service in
East. Use `skupper expose` to expose the backend service to the
frontend service.
Use `skupper expose` to expose the backend service on the Skupper
network.
commands:
"1":
- run: kubectl create deployment backend --image quay.io/skupper/hello-world-backend --replicas 3
output: deployment.apps/backend created
- await_resource: deployment/backend
- run: skupper expose deployment/backend --port 8080
output: deployment backend exposed as backend
hello_world/deploy_and_expose_the_frontend:
title: Deploy and expose the frontend
preamble: |
We have established connectivity between the two namespaces and
made the backend in `east` available to the frontend in `west`.
Before we can test the application, we need external access to the
frontend.
Use `kubectl create deployment` to deploy the frontend service in
West. Use `kubectl expose` with `--type LoadBalancer` to open
network access to the frontend service.
commands:
"0":
- run: kubectl create deployment frontend --image quay.io/skupper/hello-world-frontend
output: deployment.apps/frontend created
- await_resource: deployment/frontend
- run: kubectl expose deployment/frontend --port 8080 --type LoadBalancer
output: service/frontend exposed
hello_world/test_the_application:
title: Test the application
preamble: |
Now we're ready to try it out. Use `kubectl get service/frontend`
to look up the external IP of the frontend service. Then use
`curl` or a similar tool to request the `/api/health` endpoint at
that address.
We have established connectivity between the two namespaces and
made the backend available to the frontend. Before we can test
the application, we need external access to the frontend.
Use `kubectl expose` with `--type LoadBalancer` to open network
access to the frontend service.
Once the frontend is exposed, use `kubectl get service/frontend`
to look up the external IP of the frontend service. If the
external IP is `<pending>`, try again after a moment.
Once you have the external IP, use `curl` or a similar tool to
request the `/api/health` endpoint at that address.
**Note:** The `<external-ip>` field in the following commands is a
placeholder. The actual value is an IP address.
commands:
"0":
- run: kubectl expose deployment/frontend --port 8080 --type LoadBalancer
output: service/frontend exposed
- await_resource: service/frontend
- run: kubectl get service/frontend
apply: readme
Expand Down
19 changes: 19 additions & 0 deletions python/skewer/standardtext.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

example_suite: |
This example is part of a [suite of examples][examples] showing the
different ways you can use [Skupper][website] to connect services
Expand Down

0 comments on commit bfd3fda

Please sign in to comment.