跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

kubectl.lima

41 行 · 1.6 KB历史下载
1#!/bin/sh
2set -eu
3
4# Environment Variables
5# LIMA_INSTANCE: Specifies the name of the Lima instance to use. Default is empty.
6
7: "${LIMA_INSTANCE:=}"
8: "${KUBECTL:=kubectl}"
9
10if [ -z "$LIMA_INSTANCE" ]; then
11 if [ "$(limactl ls -q k3s 2>/dev/null)" = "k3s" ]; then
12 LIMA_INSTANCE=k3s
13 elif [ "$(limactl ls -q k8s 2>/dev/null)" = "k8s" ]; then
14 LIMA_INSTANCE=k8s
15 else
16 echo "No k3s or k8s existing instances found. Either create one with" >&2
17 echo "limactl create --name=k3s template:k3s" >&2
18 echo "limactl create --name=k8s template:k8s" >&2
19 echo "or set LIMA_INSTANCE to the name of your Kubernetes instance" >&2
20 exit 1
21 fi
22 if [ "$(limactl ls -f '{{.Status}}' "$LIMA_INSTANCE" 2>/dev/null)" != "Running" ]; then
23 echo "instance \"$LIMA_INSTANCE\" is not running, run \`limactl start $LIMA_INSTANCE\` to start the existing instance" >&2
24 exit 1
25 fi
26elif [ "$(limactl ls -q "$LIMA_INSTANCE" 2>/dev/null)" != "$LIMA_INSTANCE" ]; then
27 echo "instance \"$LIMA_INSTANCE\" does not exist, run \`limactl create --name=$LIMA_INSTANCE\` to create a new instance" >&2
28 exit 1
29elif [ "$(limactl ls -f '{{ .Status }}' "$LIMA_INSTANCE" 2>/dev/null)" != "Running" ]; then
30 echo "instance \"$LIMA_INSTANCE\" is not running, run \`limactl start $LIMA_INSTANCE\` to start the existing instance" >&2
31 exit 1
32fi
33KUBECTL=$(command -v "$KUBECTL" || true)
34if [ -n "$KUBECTL" ]; then
35 KUBECONFIG=$(limactl list "$LIMA_INSTANCE" --format '{{.Dir}}/copied-from-guest/kubeconfig.yaml')
36 export KUBECONFIG
37 exec "$KUBECTL" "$@"
38else
39 export LIMA_INSTANCE
40 exec lima sudo kubectl "$@"
41fi