

#!/bin/bash

# 指定命名空间
export NAMESPACE="uavcloud-demo"

# 输出表头
printf "%-30s %-50s\n" "Deployment" "CUST_JAVA_OPTS"

# 获取所有 Deployment 的名称
deployments=$(kubectl get deployments -n $NAMESPACE -o jsonpath='{.items[*].metadata.name}')

# 遍历每个 Deployment
for deployment in $deployments; do
    # 获取 CUST_JAVA_OPTS 的值
    cust_java_opts=$(kubectl get deployment $deployment -n $NAMESPACE -o jsonpath='{.spec.template.spec.containers[*].env[?(@.name=="CUST_JAVA_OPTS")].value}')

    # 输出结果
    printf "%-30s %-50s\n" "$deployment" "$cust_java_opts"
done

