-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathenv.sh
More file actions
executable file
·92 lines (84 loc) · 5.31 KB
/
env.sh
File metadata and controls
executable file
·92 lines (84 loc) · 5.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
. ./config.sh
. ./commands.sh
k8s_context_name=`${kubectl_cmd} config get-contexts | grep "*" | awk '{print $2}'`
k8s_context_cluster=`${kubectl_cmd} config get-contexts | grep "*" | awk '{print $3}'`
k8s_context_namespace=`${kubectl_cmd} config get-contexts | grep "*" | awk '{print $5}'`
k8s_cpu_pods_count=`count_cpu_pods`
k8s_cpu_nodes_count=`count_cpu_nodes`
k8s_nodes_count=$(total_nodes)
# If total pod cpus is greater than node cpus
if (( $(echo "$k8s_cpu_pods_count < $k8s_cpu_nodes_count" | bc -l) )); then
k8s_cpu_pods_count_label="${green}${k8s_cpu_pods_count}"
else
k8s_cpu_count_label="${red}${k8s_cpu_count}"
fi
if [[ "$k8s_context_namespace" != "$namespace" ]]; then
print_error "===================================================================================\n"
print_error " Kubernetes current context namespace is not the same that demo namespace.\n"
print_error "\n"
print_error " ├ Context current namespace : ${yellow}${k8s_context_namespace}\n"
print_error " └ Demo Namespace : ${yellow}${namespace}\n"
print_error "\n"
print_error " ${underline}Description of the problem:${reset}\n"
print_error "\n"
print_error " ├ Your default Kubernetes context namespace is different of your test namesapace.\n"
print_error " ├ Please, before to continue, change it to match both namespace names.\n"
print_error " └ You can use the command ./set_context.sh\n"
print_error "==================================================================================\n"
exit 1
fi
print_info "----------------------------------------------------------------------------------------------\n"
print_info "⎈ Kubernetes environment ⎈\n"
print_info "----------------------------------------------------------------------------------------------\n"
print_info "Context\n"
print_info "├─ Current name : ${yellow}${k8s_context_name}\n"
print_info "├─ Current cluster : ${yellow}${k8s_context_cluster}\n"
print_info "└─ Current namespace : ${yellow}${k8s_context_namespace}\n"
print_info "Pods\n"
print_info "└─ Sum of pod CPU's : ${k8s_cpu_pods_count_label} / ${k8s_cpu_nodes_count}\n"
print_info "Nodes\n"
print_info "├─ Total K8s nodes : ${yellow}${k8s_nodes_count}\n"
print_info "└─ Total of CPU's (workers): ${yellow}${k8s_cpu_nodes_count}\n"
print_info "Kubernetes Namespace : ${yellow}${namespace}\n"
print_info "\n"
print_info "----------------------------------------------------------------------------------------------\n"
print_info "PostgreSQL Cluster configuration\n"
print_info "----------------------------------------------------------------------------------------------\n"
print_info "Postgres Cluster Name : ${yellow}${cluster_name}\n"
print_info "Postgres Instances : ${yellow}${postgres_instances}\n"
print_info "Postgres CPU's : ${yellow}${postgres_cpu}\n"
print_info "Postgres Memory : ${yellow}${postgres_memory}\n"
print_info "Postgres storage : ${yellow}${postgres_storage}\n"
print_info "Postgres WAL storage : ${yellow}${postgres_wal_storage}\n"
print_info "\n"
print_info "----------------------------------------------------------------------------------------------\n"
print_info "Object Storage\n"
print_info "----------------------------------------------------------------------------------------------\n"
if [ "$object_storage_type" = "minio" ]; then
print_info "Object Storage type : ${yellow}${object_storage_type}\n"
print_info "Object Storage bucket : ${yellow}${object_storage_bucket}\n"
print_info "Destination path : ${yellow}${s3_destination_path}\n"
print_info "Endpoint : ${yellow}${s3_endpoint_url}\n"
elif [ "$object_storage_type" = "aws" ]; then
print_info "Object Storage type : ${yellow}${object_storage_type}\n"
print_info "Object Storage bucket : ${yellow}${object_storage_bucket}\n"
print_info "Destination path : ${yellow}${s3_destination_path}\n"
print_info "Endpoint : ${yellow}${s3_endpoint_url}\n"
elif [ "$object_storage_type" = "azure" ]; then
print_info "Object Storage type : ${yellow}${object_storage_type}\n"
print_info "Container name : ${yellow}${CONTAINER_NAME}\n"
print_info "Resource Group : ${yellow}${RESOURCE_GROUP}\n"
print_info "Azure connection string : ${yellow}$( [ -n "${AZURE_CONNECTION_STRING}" ] && echo "***" || echo "MISSING" )${nc}\n"
print_info "Azure Storage Account : ${yellow}$( [ -n "${AZURE_STORAGE_ACCOUNT}" ] && echo "***" || echo "MISSING" )${nc}\n"
print_info "Azure Storage Key : ${yellow}$( [ -n "${AZURE_STORAGE_KEY}" ] && echo "***" || echo "MISSING" )${nc}\n"
print_info "Azure Storage Sas Token : ${yellow}$( [ -n "${AZURE_STORAGE_SAS_TOKEN}" ] && echo "***" || echo "MISSING" )${nc}\n"
fi
print_info "\n"
print_info "----------------------------------------------------------------------------------------------\n"
print_info "Transparent Data Encryption (TDE)\n"
print_info "----------------------------------------------------------------------------------------------\n"
print_info "Using TDE (in progress) : ${yellow}${use_tde}\n"
print_info "\n"
#print_info "================================================================================================\n"
print_info ""