Skip to content

Instantly share code, notes, and snippets.

@haarchri
Last active April 28, 2024 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haarchri/6526d1738611cc79c04e88091dfe074a to your computer and use it in GitHub Desktop.
Save haarchri/6526d1738611cc79c04e88091dfe074a to your computer and use it in GitHub Desktop.
crossplane-debug-vscode
#!/bin/bash
NAMESPACE=crossplane-system
# Define secret names
SERVER_SECRET="crossplane-tls-server"
CLIENT_SECRET="crossplane-tls-client"
# Define directory to store extracted files
SERVER_DIR="/tmp/crossplane-tls-server"
CLIENT_DIR="/tmp/crossplane-tls-client"
# Ensure directories exist
mkdir -p "$SERVER_DIR"
mkdir -p "$CLIENT_DIR"
# Extract, decode, and save tls.crt, tls.key, and ca.crt for the server secret
kubectl get secret "$SERVER_SECRET" -n $NAMESPACE -o jsonpath="{.data.tls\.crt}" | base64 --decode > "$SERVER_DIR/tls.crt"
kubectl get secret "$SERVER_SECRET" -n $NAMESPACE -o jsonpath="{.data.tls\.key}" | base64 --decode > "$SERVER_DIR/tls.key"
kubectl get secret "$SERVER_SECRET" -n $NAMESPACE -o jsonpath="{.data.ca\.crt}" | base64 --decode > "$SERVER_DIR/ca.crt"
# Extract, decode, and save tls.crt, tls.key, and ca.crt for the client secret
kubectl get secret "$CLIENT_SECRET" -n $NAMESPACE -o jsonpath="{.data.tls\.crt}" | base64 --decode > "$CLIENT_DIR/tls.crt"
kubectl get secret "$CLIENT_SECRET" -n $NAMESPACE -o jsonpath="{.data.tls\.key}" | base64 --decode > "$CLIENT_DIR/tls.key"
kubectl get secret "$CLIENT_SECRET" -n $NAMESPACE -o jsonpath="{.data.ca\.crt}" | base64 --decode > "$CLIENT_DIR/ca.crt"
echo "Files extracted and saved successfully."
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/crossplane/main.go",
"args": [
"core",
"start",
"--debug"
],
"env":{
"TLS_SERVER_CERTS_DIR": "/tmp/crossplane-tls-server",
"TLS_CLIENT_CERTS_DIR": "/tmp/crossplane-tls-client",
"POD_NAMESPACE": "crossplane-system",
"CACHE_DIR": "/tmp/crossplane-cache",
"WEBHOOK_ENABLED": "false",
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment