Skip to content

Commit

Permalink
Update for v2 preview 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ssorj committed Dec 19, 2024
1 parent 6ebaecd commit 5de621d
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 69 deletions.
38 changes: 15 additions & 23 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ On Linux or Mac, you can use the install script (inspect it
[here][install-script]) to download and extract the command:

~~~ shell
curl https://skupper.io/install.sh | sh -s -- --version 2.0.0-preview-1
curl https://skupper.io/install.sh | sh -s -- --version 2.0.0-preview-2
~~~

The script installs the command under your home directory. It
Expand All @@ -143,20 +143,20 @@ installation YAML to install the CRDs and controller.
_**West:**_

~~~ shell
kubectl apply -f https://skupper.io/v2/install.yaml
kubectl apply -f https://github.com/skupperproject/skupper/releases/download/2.0.0-preview-2/skupper-setup-cluster-scope.yaml
~~~

_**East:**_

~~~ shell
kubectl apply -f https://skupper.io/v2/install.yaml
kubectl apply -f https://github.com/skupperproject/skupper/releases/download/2.0.0-preview-2/skupper-setup-cluster-scope.yaml
~~~

## Step 5: Create your sites

A Skupper _site_ is a location where components of your
application are running. Sites are linked together to form a
network for your application.
A Skupper _site_ is a location where your application workloads
are running. Sites are linked together to form a network for your
application.

For each namespace, use `skupper site create` with a site name of
your choice. This creates the site resource and deploys the
Expand All @@ -172,26 +172,21 @@ tunnel][minikube-tunnel] before you run `skupper site create`.
_**West:**_

~~~ shell
skupper site create west --enable-link-access
kubectl wait --for condition=Ready --timeout=60s site/west # Required with preview 1 - to be removed!
skupper site create west --enable-link-access --timeout 2m
~~~

_Sample output:_

~~~ console
$ skupper site create west --enable-link-access
$ skupper site create west --enable-link-access --timeout 2m
Waiting for status...
Site "west" is configured. Check the status to see when it is ready

$ kubectl wait --for condition=Ready --timeout=60s site/west # Required with preview 1 - to be removed!
site.skupper.io/west condition met
~~~

_**East:**_

~~~ shell
skupper site create east
kubectl wait --for condition=Ready --timeout=60s site/east # Required with preview 1 - to be removed!
~~~

_Sample output:_
Expand All @@ -200,9 +195,6 @@ _Sample output:_
$ skupper site create east
Waiting for status...
Site "east" is configured. Check the status to see when it is ready

$ kubectl wait --for condition=Ready --timeout=60s site/east # Required with preview 1 - to be removed!
site.skupper.io/east condition met
~~~

You can use `skupper site status` at any time to check the status
Expand All @@ -214,14 +206,12 @@ A Skupper _link_ is a channel for communication between two sites.
Links serve as a transport for application connections and
requests.

Creating a link requires use of two Skupper commands in
conjunction, `skupper token issue` and `skupper token redeem`.

Creating a link requires the use of two Skupper commands in
conjunction: `skupper token issue` and `skupper token redeem`.
The `skupper token issue` command generates a secret token that
signifies permission to create a link. The token also carries the
link details. Then, in a remote site, The `skupper token redeem`
command uses the token to create a link to the site that generated
it.
can be transferred to a remote site and redeemed for a link to the
issuing site. The `skupper token redeem` command uses the token
to create the link.

**Note:** The link token is truly a *secret*. Anyone who has the
token can link to your site. Make sure that only those you trust
Expand Down Expand Up @@ -338,6 +328,8 @@ The commands shown above use the name argument, `backend`, to also
set the default routing key and pod selector. You can use the
`--routing-key` and `--selector` options to set specific values.

<!-- You can also use `--workload` -- more convenient! -->

## Step 10: Access the frontend service

In order to use and test the application, we need external access
Expand Down
67 changes: 66 additions & 1 deletion external/plano/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ Python functions for writing shell-style system scripts.

## Installation

To install plano globally for the current user:
Install the dependencies if you need to:

~~~
sudo dnf -y install python-build python-pip python-pyyaml
~~~

Install plano globally for the current user:

~~~
make install
Expand Down Expand Up @@ -88,3 +94,62 @@ for message in "hi", "lo", "in between":
* The plano command accepts command sequences in the form "this,that"
(no spaces). The command arguments are applied to the last command
only.

## Dependencies

PyYAML:

~~~
pip install pyyaml
~~~

## Setting up Plano as an embedded dependency

Change directory to the root of your project:

~~~ console
cd <project-dir>/
~~~

Add the Plano code as a subdirectory:

~~~ shell
mkdir -p external
curl -sfL https://github.com/ssorj/plano/archive/main.tar.gz | tar -C external -xz
mv external/plano-main external/plano
~~~

Symlink the Plano library into your `python` directory:

~~~ shell
mkdir -p python
ln -s ../external/plano/src/plano python/plano
~~~

Copy the `plano` command into the root of your project:

~~~ shell
cp external/plano/bin/plano plano
~~~

Optionally, add a command to `.plano.py` to update the embedded Plano:

~~~ python
from plano.github import *

@command
def update_plano():
"""
Update the embedded Plano repo
"""
update_external_from_github("external/plano", "ssorj", "plano")
~~~

## Extending an existing command

~~~ python
@command(parent=blammo)
def blammo(*args, **kwargs):
parent(*args, **kwargs)
# Do child stuff
~~~
71 changes: 54 additions & 17 deletions external/plano/src/plano/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,9 @@ def print_json(data, **kwargs):

## HTTP operations

def _run_curl(method, url, content=None, content_file=None, content_type=None, output_file=None, insecure=False,
user=None, password=None, quiet=False):
def _run_curl(method, url, content=None, content_file=None, content_type=None, output_file=None,
insecure=False, user=None, password=None, client_cert=None, client_key=None, server_cert=None,
quiet=False):
check_program("curl")

_notice(quiet, f"Sending {method} request to '{url}'")
Expand Down Expand Up @@ -794,6 +795,15 @@ def _run_curl(method, url, content=None, content_file=None, content_type=None, o
assert password is not None
args.extend(["--user", f"{user}:{password}"])

if client_cert is not None:
args.extend(["--cert", client_cert])

if client_key is not None:
args.extend(["--key", client_key])

if server_cert is not None:
args.extend(["--cacert", server_cert])

args.append(url)

if output_file is not None:
Expand All @@ -808,37 +818,64 @@ def _run_curl(method, url, content=None, content_file=None, content_type=None, o
if output_file is None:
return proc.stdout_result

def http_get(url, output_file=None, insecure=False, user=None, password=None, quiet=False):
return _run_curl("GET", url, output_file=output_file, insecure=insecure, user=user, password=password, quiet=quiet)

def http_get_json(url, insecure=False, user=None, password=None, quiet=False):
return parse_json(http_get(url, insecure=insecure, user=user, password=password, quiet=quiet))

def http_put(url, content, content_type=None, insecure=False, user=None, password=None, quiet=False):
def http_get(url, output_file=None, insecure=False, user=None, password=None,
client_cert=None, client_key=None, server_cert=None,
quiet=False):
return _run_curl("GET", url, output_file=output_file, insecure=insecure, user=user, password=password,
client_cert=client_cert, client_key=client_key, server_cert=server_cert,
quiet=quiet)

def http_get_json(url,
insecure=False, user=None, password=None,
client_cert=None, client_key=None, server_cert=None, quiet=False):
return parse_json(http_get(url, insecure=insecure, user=user, password=password,
client_cert=client_cert, client_key=client_key, server_cert=server_cert,
quiet=quiet))

def http_put(url, content, content_type=None, insecure=False, user=None, password=None,
client_cert=None, client_key=None, server_cert=None,
quiet=False):
_run_curl("PUT", url, content=content, content_type=content_type, insecure=insecure, user=user, password=password,
client_cert=client_cert, client_key=client_key, server_cert=server_cert,
quiet=quiet)

def http_put_file(url, content_file, content_type=None, insecure=False, user=None, password=None, quiet=False):
def http_put_file(url, content_file, content_type=None, insecure=False, user=None, password=None,
client_cert=None, client_key=None, server_cert=None,
quiet=False):
_run_curl("PUT", url, content_file=content_file, content_type=content_type, insecure=insecure, user=user,
password=password, quiet=quiet)
password=password, client_cert=client_cert, client_key=client_key, server_cert=server_cert,
quiet=quiet)

def http_put_json(url, data, insecure=False, user=None, password=None, quiet=False):
def http_put_json(url, data, insecure=False, user=None, password=None,
client_cert=None, client_key=None, server_cert=None,
quiet=False):
http_put(url, emit_json(data), content_type="application/json", insecure=insecure, user=user, password=password,
client_cert=client_cert, client_key=client_key, server_cert=server_cert,
quiet=quiet)

def http_post(url, content, content_type=None, output_file=None, insecure=False, user=None, password=None,
client_cert=None, client_key=None, server_cert=None,
quiet=False):
return _run_curl("POST", url, content=content, content_type=content_type, output_file=output_file,
insecure=insecure, user=user, password=password, quiet=quiet)
insecure=insecure, user=user, password=password,
client_cert=client_cert, client_key=client_key, server_cert=server_cert,
quiet=quiet)

def http_post_file(url, content_file, content_type=None, output_file=None, insecure=False, user=None, password=None,
client_cert=None, client_key=None, server_cert=None,
quiet=False):
return _run_curl("POST", url, content_file=content_file, content_type=content_type, output_file=output_file,
insecure=insecure, user=user, password=password, quiet=quiet)
insecure=insecure, user=user, password=password,
client_cert=client_cert, client_key=client_key, server_cert=server_cert,
quiet=quiet)

def http_post_json(url, data, insecure=False, user=None, password=None, quiet=False):
return parse_json(http_post(url, emit_json(data), content_type="application/json", insecure=insecure, user=user,
password=password, quiet=quiet))
def http_post_json(url, data, insecure=False, user=None, password=None,
client_cert=None, client_key=None, server_cert=None,
quiet=False):
return parse_json(http_post(url, emit_json(data), content_type="application/json",
insecure=insecure, user=user, password=password,
client_cert=client_cert, client_key=client_key, server_cert=server_cert,
quiet=quiet))

## Link operations

Expand Down
9 changes: 4 additions & 5 deletions python/skewer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,14 @@ def print_debug_output(model):
run("kubectl get events", check=False)

run("skupper version", check=False)
run("skupper status", check=False)
run("skupper site status", check=False)
run("skupper link status", check=False)
run("skupper service status", check=False)
run("skupper network status", check=False)
run("skupper debug events", check=False)
run("skupper listener status", check=False)
run("skupper connector status", check=False)

if site.platform == "kubernetes":
run("kubectl logs deployment/skupper-router", check=False)
run("kubectl logs deployment/skupper-service-controller", check=False)
# run("kubectl logs deployment/skupper-service-controller", check=False)

print("-- End of debug output")

Expand Down
Loading

0 comments on commit 5de621d

Please sign in to comment.