|
|
@@ -6,7 +6,7 @@ function kf {
|
|
|
compdef _kf_completion kf 2>/dev/null
|
|
|
_kf_completion_setup=1
|
|
|
fi
|
|
|
-
|
|
|
+
|
|
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
|
|
echo "Usage: kf <cluster> [service-name[:port]] [service-name[:port]] ..."
|
|
|
echo "Example: kf oc-dev-internal-eks-cluster oc-activate-web"
|
|
|
@@ -31,7 +31,7 @@ function kf {
|
|
|
fi
|
|
|
|
|
|
echo "🔌 Forwarding services (cluster: $cluster)"
|
|
|
-
|
|
|
+
|
|
|
local existing_pids
|
|
|
existing_pids=$(pgrep -f "kubectl.*port-forward" || true)
|
|
|
if [[ -n "$existing_pids" ]]; then
|
|
|
@@ -42,7 +42,7 @@ function kf {
|
|
|
sleep 0.5
|
|
|
fi
|
|
|
fi
|
|
|
-
|
|
|
+
|
|
|
local pids=()
|
|
|
|
|
|
for service_spec in "$@"; do
|
|
|
@@ -57,7 +57,7 @@ function kf {
|
|
|
|
|
|
local svc
|
|
|
svc=$(kubectl --context "$cluster" -n oc-app get svc -o name | grep "^service/$service_name$" || true)
|
|
|
-
|
|
|
+
|
|
|
if [[ -z "$svc" ]]; then
|
|
|
echo "⚠️ Service '$service_name' not found in namespace 'oc-app' - skipping"
|
|
|
echo " Available services:"
|
|
|
@@ -84,7 +84,7 @@ function kf {
|
|
|
else
|
|
|
echo "→ Forwarding $name on port $forward_port"
|
|
|
fi
|
|
|
-
|
|
|
+
|
|
|
kubectl --context "$cluster" -n oc-app port-forward "svc/$name" "$forward_port:$service_port" >/dev/null 2>&1 &
|
|
|
local pid=$!
|
|
|
|
|
|
@@ -128,5 +128,5 @@ _rmq_passwd_completion() {
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
-# Completion functions are set up when functions are first called
|
|
|
-# rmq-passwd completion will be set up if/when that function is defined elsewhere
|
|
|
+compdef _rmq_passwd_completion rmq-passwd
|
|
|
+compdef _kf_completion kf
|