-
Notifications
You must be signed in to change notification settings - Fork 69
User/jguionnet/kubecon25 demo #143
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
jguionnet
wants to merge
5
commits into
kubevela:master
Choose a base branch
from
jguionnet:user/jguionnet/kubecon25-demo
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 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3800470
V1 of demo notebooks and configuration for KubeCon NA 2025
jguionnet 33ba2ef
Refactor KubeCon NA 2025 Demo Notebooks
jguionnet 3886e3d
Refactor KubeCon NA 2025 Demo Notebooks
jguionnet a60cfa6
Add V1 of TF+GHA+K8S vs Kubevela for a sample Product Catalog App
jguionnet 29ac983
Add .gitignore and update DEMO_PLAN.md for KubeVela demo
jguionnet 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
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,35 @@ | ||
| # AWS Credentials | ||
| .env.aws | ||
|
|
||
| # Python virtual environment | ||
| .venv/ | ||
| venv/ | ||
| env/ | ||
|
|
||
| # Jupyter Notebook checkpoints | ||
| .ipynb_checkpoints/ | ||
|
|
||
| # Environment variables | ||
| .env | ||
| .env.sh | ||
|
|
||
| # Generated files from notebooks | ||
| crossplane/ | ||
| kubevela/ | ||
| test/ | ||
| setup/ | ||
|
|
||
| # Python cache | ||
| __pycache__/ | ||
| *.pyc | ||
| *.pyo | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # IDE files | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo |
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,352 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "# KubeCon NA 2025 Demo - Cleanup\n", | ||
| "\n", | ||
| "This notebook tears down the demo environment and cleans up all resources.\n", | ||
| "\n", | ||
| "## What will be cleaned up:\n", | ||
| "- k3d cluster (including all deployments and data)\n", | ||
| "- Local cluster configuration\n", | ||
| "- Any running containers from the cluster\n", | ||
| "\n", | ||
| "**Warning:** This operation is destructive and cannot be undone. Make sure you have saved any important data before proceeding." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 1, | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "Configuration loaded: Will delete cluster 'kubecon-demo'\n", | ||
| "\n", | ||
| "⚠️ WARNING: This will delete all cluster data!\n", | ||
| "Cluster to be deleted: kubecon-demo\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "import yaml\n", | ||
| "import os\n", | ||
| "\n", | ||
| "# Load configuration\n", | ||
| "config_file = 'config.yaml'\n", | ||
| "\n", | ||
| "if os.path.exists(config_file):\n", | ||
| " with open(config_file, 'r') as f:\n", | ||
| " config = yaml.safe_load(f)\n", | ||
| " cluster_name = config['cluster']['name']\n", | ||
| " print(f\"Configuration loaded: Will delete cluster '{cluster_name}'\")\n", | ||
| "else:\n", | ||
| " cluster_name = 'kubecon-demo'\n", | ||
| " print(f\"Config file not found, using default cluster name: '{cluster_name}'\")\n", | ||
| "\n", | ||
| "print(\"\\n⚠️ WARNING: This will delete all cluster data!\")\n", | ||
| "print(f\"Cluster to be deleted: {cluster_name}\")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "### Step 1: Check Current Cluster Status\n", | ||
| "\n", | ||
| "Let's verify what clusters currently exist before deletion." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 2, | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "=== Current k3d Clusters ===\n", | ||
| "NAME SERVERS AGENTS LOADBALANCER\n", | ||
| "kubecon-demo 1/1 0/0 true\n", | ||
| "\n", | ||
| "=== Current kubectl context ===\n", | ||
| "k3d-kubecon-demo\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "%%bash\n", | ||
| "echo \"=== Current k3d Clusters ===\"\n", | ||
| "k3d cluster list\n", | ||
| "\n", | ||
| "echo \"\"\n", | ||
| "echo \"=== Current kubectl context ===\"\n", | ||
| "kubectl config current-context 2>/dev/null || echo \"No active context\"" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "### Step 2: Optional - Export Resources\n", | ||
| "\n", | ||
| "If you want to save any configurations before deletion, run this cell to export key resources." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 3, | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "Resource export is disabled by default. Uncomment the code above to enable.\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "%%bash\n", | ||
| "# Uncomment the following lines if you want to export resources\n", | ||
| "\n", | ||
| "# EXPORT_DIR=\"exports/$(date +%Y%m%d_%H%M%S)\"\n", | ||
| "# mkdir -p \"$EXPORT_DIR\"\n", | ||
| "#\n", | ||
| "# echo \"Exporting resources to $EXPORT_DIR...\"\n", | ||
| "#\n", | ||
| "# # Export Crossplane resources\n", | ||
| "# kubectl get providers -o yaml > \"$EXPORT_DIR/providers.yaml\" 2>/dev/null || true\n", | ||
| "# kubectl get compositions -o yaml > \"$EXPORT_DIR/compositions.yaml\" 2>/dev/null || true\n", | ||
| "# kubectl get xrds -o yaml > \"$EXPORT_DIR/xrds.yaml\" 2>/dev/null || true\n", | ||
| "#\n", | ||
| "# echo \"✓ Resources exported to $EXPORT_DIR\"\n", | ||
| "\n", | ||
| "echo \"Resource export is disabled by default. Uncomment the code above to enable.\"" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "### Step 3: Delete the k3d Cluster\n", | ||
| "\n", | ||
| "This will remove the entire cluster and all its resources." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 4, | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "=== Deleting k3d Cluster: kubecon-demo ===\n", | ||
| "Found cluster 'kubecon-demo', deleting...\n", | ||
| "\u001b[36mINFO\u001b[0m[0000] Deleting cluster 'kubecon-demo' \n", | ||
| "\u001b[36mINFO\u001b[0m[0002] Deleting cluster network 'k3d-kubecon-demo' \n", | ||
| "\u001b[36mINFO\u001b[0m[0003] Deleting 1 attached volumes... \n", | ||
| "\u001b[36mINFO\u001b[0m[0003] Removing cluster details from default kubeconfig... \n", | ||
| "\u001b[36mINFO\u001b[0m[0003] Removing standalone kubeconfig file (if there is one)... \n", | ||
| "\u001b[36mINFO\u001b[0m[0003] Successfully deleted cluster kubecon-demo! \n", | ||
| "✓ Cluster 'kubecon-demo' deleted successfully\n", | ||
| "\n", | ||
| "Remaining k3d clusters:\n", | ||
| "NAME SERVERS AGENTS LOADBALANCER\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "%%bash\n", | ||
| "set -e\n", | ||
| "\n", | ||
| "CLUSTER_NAME=\"kubecon-demo\"\n", | ||
| "\n", | ||
| "echo \"=== Deleting k3d Cluster: $CLUSTER_NAME ===\"\n", | ||
| "\n", | ||
| "# Check if cluster exists\n", | ||
| "if k3d cluster list | grep -q \"$CLUSTER_NAME\"; then\n", | ||
| " echo \"Found cluster '$CLUSTER_NAME', deleting...\"\n", | ||
| " \n", | ||
| " if k3d cluster delete \"$CLUSTER_NAME\"; then\n", | ||
| " echo \"✓ Cluster '$CLUSTER_NAME' deleted successfully\"\n", | ||
| " else\n", | ||
| " echo \"✗ Failed to delete cluster\"\n", | ||
| " exit 1\n", | ||
| " fi\n", | ||
| "else\n", | ||
| " echo \"⚠ Cluster '$CLUSTER_NAME' not found (may already be deleted)\"\n", | ||
| "fi\n", | ||
| "\n", | ||
| "echo \"\"\n", | ||
| "echo \"Remaining k3d clusters:\"\n", | ||
| "k3d cluster list" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "### Step 4: Clean Up kubectl Context\n", | ||
| "\n", | ||
| "Remove the cluster context from kubectl configuration." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 5, | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "=== Cleaning up kubectl context ===\n", | ||
| "⚠ Context 'k3d-kubecon-demo' not found\n", | ||
| "\n", | ||
| "Current kubectl contexts:\n", | ||
| "CURRENT NAME CLUSTER AUTHINFO NAMESPACE\n", | ||
| " k3d-k3s-default k3d-k3s-default admin@k3d-k3s-default \n", | ||
| " loft-vcluster_vcluster1_tenantproject loft-vcluster_vcluster1_tenantproject loft-vcluster_vcluster1_tenantproject \n", | ||
| "* loft-vcluster_vclustera_default loft-vcluster_vclustera_default loft-vcluster_vclustera_default \n", | ||
| " rancher-desktop rancher-desktop rancher-desktop \n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "%%bash\n", | ||
| "CLUSTER_NAME=\"kubecon-demo\"\n", | ||
| "CONTEXT_NAME=\"k3d-$CLUSTER_NAME\"\n", | ||
| "\n", | ||
| "echo \"=== Cleaning up kubectl context ===\"\n", | ||
| "\n", | ||
| "# Delete context if it exists\n", | ||
| "if kubectl config get-contexts \"$CONTEXT_NAME\" &>/dev/null; then\n", | ||
| " kubectl config delete-context \"$CONTEXT_NAME\" 2>/dev/null || true\n", | ||
| " echo \"✓ Context '$CONTEXT_NAME' removed\"\n", | ||
| "else\n", | ||
| " echo \"⚠ Context '$CONTEXT_NAME' not found\"\n", | ||
| "fi\n", | ||
| "\n", | ||
| "# Delete cluster entry if it exists\n", | ||
| "if kubectl config get-clusters | grep -q \"$CONTEXT_NAME\"; then\n", | ||
| " kubectl config delete-cluster \"$CONTEXT_NAME\" 2>/dev/null || true\n", | ||
| " echo \"✓ Cluster entry '$CONTEXT_NAME' removed\"\n", | ||
| "fi\n", | ||
| "\n", | ||
| "echo \"\"\n", | ||
| "echo \"Current kubectl contexts:\"\n", | ||
| "kubectl config get-contexts || echo \"No contexts available\"" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "### Step 5: Verification\n", | ||
| "\n", | ||
| "Verify that cleanup was successful." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 6, | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "=== Cleanup Verification ===\n", | ||
| "\n", | ||
| "k3d clusters:\n", | ||
| "NAME SERVERS AGENTS LOADBALANCER\n", | ||
| "\n", | ||
| "kubectl contexts:\n", | ||
| "CURRENT NAME CLUSTER AUTHINFO NAMESPACE\n", | ||
| " k3d-k3s-default k3d-k3s-default admin@k3d-k3s-default \n", | ||
| " loft-vcluster_vcluster1_tenantproject loft-vcluster_vcluster1_tenantproject loft-vcluster_vcluster1_tenantproject \n", | ||
| "* loft-vcluster_vclustera_default loft-vcluster_vclustera_default loft-vcluster_vclustera_default \n", | ||
| " rancher-desktop rancher-desktop rancher-desktop \n", | ||
| "\n", | ||
| "Docker containers (k3d related):\n", | ||
| "NAMES STATUS\n", | ||
| "\n", | ||
| "✓ Cleanup verification complete\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "%%bash\n", | ||
| "echo \"=== Cleanup Verification ===\"\n", | ||
| "echo \"\"\n", | ||
| "\n", | ||
| "echo \"k3d clusters:\"\n", | ||
| "k3d cluster list\n", | ||
| "echo \"\"\n", | ||
| "\n", | ||
| "echo \"kubectl contexts:\"\n", | ||
| "kubectl config get-contexts 2>/dev/null || echo \"No contexts\"\n", | ||
| "echo \"\"\n", | ||
| "\n", | ||
| "echo \"Docker containers (k3d related):\"\n", | ||
| "docker ps -a --filter \"name=k3d\" --format \"table {{.Names}}\\t{{.Status}}\" 2>/dev/null || echo \"No k3d containers\"\n", | ||
| "echo \"\"\n", | ||
| "\n", | ||
| "echo \"✓ Cleanup verification complete\"" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## Cleanup Complete!\n", | ||
| "\n", | ||
| "The demo environment has been successfully torn down.\n", | ||
| "\n", | ||
| "### What was cleaned up:\n", | ||
| "- ✓ k3d cluster deleted\n", | ||
| "- ✓ kubectl context removed\n", | ||
| "- ✓ Docker containers stopped and removed\n", | ||
| "\n", | ||
| "### To start fresh:\n", | ||
| "Run the `00_Env-setup.ipynb` notebook again to recreate the environment.\n", | ||
| "\n", | ||
| "### Remaining artifacts:\n", | ||
| "- Configuration files (config.yaml) - kept for reuse\n", | ||
| "- Setup manifests (setup/ directory) - kept for reuse\n", | ||
| "- Python environment and packages - kept for reuse\n", | ||
| "\n", | ||
| "If you want to remove these as well, you can manually delete them from the file system." | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": ".venv", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 3 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython3", | ||
| "version": "3.13.3" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 4 | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.
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 cleanup cells hardcode
CLUSTER_NAME="kubecon-demo", so if someone changescluster.namein config.yaml the teardown will skip the actual cluster/context and leave resources running. Please feed the configured name into these bash cells instead of the literal string.Prompt for AI agents