-
Notifications
You must be signed in to change notification settings - Fork 7
Skewer adaptation #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nluaces
wants to merge
5
commits into
skupperproject:master
Choose a base branch
from
nluaces:skewer-adaptation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3e30630
Add Skewer submodule
nluaces 8e4aa80
Add new README file generated by Skewer.
nluaces ae39d93
Removed submodule
nluaces 6497c2f
git subrepo clone https://github.com/skupperproject/skewer subrepos/s…
nluaces 7d4f128
Updated summary
nluaces File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
title: "PostgreSQL Example" | ||
subtitle: "Sharing a PostgreSQL database across clusters" | ||
github_actions_url: "https://github.com/skupperproject/skupper-example-postgresql/actions/workflows/main.yaml" | ||
overview: | | ||
This tutorial demonstrates how to share a PostgreSQL database across multiple Kubernetes clusters that are located in | ||
different public and private cloud providers. | ||
prerequisites: !string prerequisites | ||
sites: | ||
private1: | ||
kubeconfig: ~/.kube/private1 | ||
namespace: private | ||
public1: | ||
kubeconfig: ~/.kube/public1 | ||
namespace: public1 | ||
public2: | ||
kubeconfig: ~/.kube/public2 | ||
namespace: public2 | ||
steps: | ||
- title: Access your clusters | ||
preamble: !string access_your_clusters_preamble | ||
commands: | ||
public1: | ||
- run: export KUBECONFIG=~/.kube/public1 | ||
public2: | ||
- run: export KUBECONFIG=~/.kube/public2 | ||
private1: | ||
- run: export KUBECONFIG=~/.kube/private1 | ||
- title: Set up namespaces | ||
preamble: !string set_up_your_namespaces_preamble | ||
commands: | ||
public1: | ||
- run: kubectl create namespace public1 | ||
- run: kubectl config set-context --current --namespace public1 | ||
public2: | ||
- run: kubectl create namespace public2 | ||
- run: kubectl config set-context --current --namespace public2 | ||
private1: | ||
- run: kubectl create namespace private1 | ||
- run: kubectl config set-context --current --namespace private1 | ||
- title: Deploy the Virtual Application Network | ||
preamble: !string link_your_namespaces_preamble | ||
commands: | ||
public1: | ||
- run: skupper init --site-name public1 | ||
- run: skupper token create --uses 2 ~/public1-token.yaml | ||
public2: | ||
- run: skupper init --site-name public2 | ||
- run: skupper token create ~/public2-token.yaml | ||
- run: skupper link create ~/public1-token.yaml | ||
- run: skupper link status --wait 30 | ||
private1: | ||
- run: skupper init --site-name private1 | ||
- run: skupper link create ~/public1-token.yaml | ||
- run: skupper link create ~/public2-token.yaml | ||
- run: skupper link status --wait 30 | ||
postamble: !string link_your_namespaces_postamble | ||
- title: Deploy the PostgreSQL service | ||
preamble: | | ||
After creating the application router network, deploy the PostgreSQL service. | ||
The **private1** cluster will be used to deploy the PostgreSQL server and the **public1** | ||
and **public2** clusters will be used to enable client communications to the server on | ||
the **private1** cluster. | ||
commands: | ||
private1: | ||
- run: mkdir pg-demo | ||
- run: cd pg-demo | ||
- run: git clone https://github.com/skupperproject/skupper-example-postgresql.git | ||
- run: kubectl apply -f ~/pg-demo/skupper-example-postgresql/deployment-postgresql-svc.yaml | ||
await: [deployment/postgresql] | ||
- title: Create Skupper service for the Virtual Application Network | ||
commands: | ||
private1: | ||
- run: skupper service create postgresql 5432 | ||
public1: | ||
- run: skupper service status | ||
public2: | ||
- run: skupper service status | ||
postamble: | | ||
Note that the mapping for the service address defaults to `tcp`. | ||
- title: Bind the Skupper service to the deployment target on the Virtual Application Network | ||
commands: | ||
private1: | ||
- run: skupper service bind postgresql deployment postgresql | ||
public1: | ||
- run: skupper service status | ||
public2: | ||
- run: skupper service status | ||
postamble: | | ||
Note that the **private1** is the only cluster to provide a target. | ||
- title: Create interactive pod with PostgreSQL client utilities | ||
commands: | ||
private1: | ||
- run: "kubectl run pg-shell -i --tty --image quay.io/skupper/simple-pg --env=\"PGUSER=postgres\" --env=\"PGPASSWORD=skupper\" --env=\"PGHOST=$(kubectl get service postgresql -o=jsonpath='{.spec.clusterIP}')\" -- bash" | ||
public1: | ||
- run: "kubectl run pg-shell -i --tty --image quay.io/skupper/simple-pg --env=\"PGUSER=postgres\" --env=\"PGPASSWORD=skupper\" --env=\"PGHOST=$(kubectl get service postgresql -o=jsonpath='{.spec.clusterIP}')\" -- bash" | ||
public2: | ||
- run: "kubectl run pg-shell -i --tty --image quay.io/skupper/simple-pg --env=\"PGUSER=postgres\" --env=\"PGPASSWORD=skupper\" --env=\"PGHOST=$(kubectl get service postgresql -o=jsonpath='{.spec.clusterIP}')\" -- bash" | ||
postamble: | | ||
Note that if the session is ended, it can be resumed with the following: | ||
```bash | ||
kubectl attach pg-shell -c pg-shell -i -t | ||
``` | ||
- title: Create a Database, Create a Table, Insert Values | ||
preamble: | | ||
Using the 'pg-shell' pod running on each cluster, operate on the database: | ||
commands: | ||
private1: | ||
- run: createdb -e markets | ||
public1: | ||
- run: psql -d markets | ||
- run: "create table if not exists product (id SERIAL, name VARCHAR(100) NOT NULL, sku CHAR(8));" | ||
public2: | ||
- run: psql -d markets | ||
- run: "INSERT INTO product VALUES(DEFAULT, 'Apple, Fuji', '4131');" | ||
- run: "INSERT INTO product VALUES(DEFAULT, 'Banana', '4011');" | ||
- run: "INSERT INTO product VALUES(DEFAULT, 'Pear, Bartlett', '4214');" | ||
- run: "INSERT INTO product VALUES(DEFAULT, 'Orange', '4056');" | ||
postamble: | | ||
From any cluster, access the `product` tables in the `markets` database to view contents. | ||
summary: | | ||
In this tutorial, we have seen how to create a Virtual Application Nework that enables communications | ||
across the public and private clusters. We deployed a PostgresSQL database | ||
instance into a private cluster and attached it to the Virtual Application Network. | ||
This configuration enabled the clients from different public clusters attached to the Virtual Application | ||
Network to transparently access the database without the need of additional networking setup | ||
(e.g. no vpn or firewall rules required). | ||
cleaning_up: | ||
preamble: !string cleaning_up_preamble | ||
commands: | ||
public1: | ||
- run: skupper delete | ||
- run: kubectl delete pod pg-shell | ||
public2: | ||
- run: skupper delete | ||
- run: kubectl delete pod pg-shell | ||
private1: | ||
- run: kubectl delete pod pg-shell | ||
- run: skupper unexpose deployment postgresql | ||
- run: kubectl delete -f ~/pg-demo/skupper-example-postgresql/deployment-postgresql-svc.yaml | ||
- run: skupper delete | ||
next_steps: !string next_steps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: main | ||
on: [push, pull_request] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: manusa/[email protected] | ||
with: | ||
minikube version: 'v1.22.0' | ||
kubernetes version: 'v1.21.2' | ||
github token: ${{ secrets.GITHUB_TOKEN }} | ||
- run: mkdir -p "$HOME/.local/bin" | ||
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- run: echo "SKUPPER_URL=$(curl -sL https://api.github.com/repos/skupperproject/skupper/releases/latest | jq -r '.assets[] | select(.browser_download_url | contains("linux-amd64")) | .browser_download_url')" >> $GITHUB_ENV | ||
- run: curl -sL $SKUPPER_URL | tar -C "$HOME/.local/bin" -xzf - | ||
- run: skupper version | ||
- run: ./plano test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__pycache__/ | ||
README.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
; DO NOT EDIT (unless you know what you are doing) | ||
; | ||
; This subdirectory is a git "subrepo", and this file is maintained by the | ||
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme | ||
; | ||
[subrepo] | ||
remote = https://github.com/skupperproject/skewer | ||
branch = main | ||
commit = 3c2a9559fd51f392af7f9a0a78b0e1fc0535201c | ||
parent = ae39d93b1e5a628230c89ff332974e62d70caf67 | ||
method = merge | ||
cmdver = 0.4.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from skewer import * | ||
|
||
@command | ||
def generate(app): | ||
""" | ||
Generate README.md from the data in skewer.yaml | ||
""" | ||
with working_dir("test-example"): | ||
generate_readme("skewer.yaml", "README.md") | ||
print(read("README.md")) | ||
|
||
@command | ||
def test(app): | ||
with working_dir("test-example"): | ||
generate_readme("skewer.yaml", "README.md") | ||
check_file("README.md") | ||
run_steps_on_minikube("skewer.yaml") | ||
|
||
@command | ||
def render(app): | ||
check_program("pandoc") | ||
run(f"pandoc -o README.html README.md") | ||
print(f"file:{get_real_path('README.html')}") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The summary is rendered at the end, so this text should either go back to the start (the overview) or be recast as "what you did", not what you will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Summary updated.