@@ -150,6 +150,12 @@ get_version(){
150
150
fi
151
151
}
152
152
153
+ # Return the major version, for instance if version is 4.x.y, return 4.
154
+ major_version () {
155
+ local version=" $1 "
156
+ echo " ${version%% .* } "
157
+ }
158
+
153
159
# Usage: compare_version VER_1 VER_2.
154
160
# Output: return -1 if VER_1 < VER_2, 0 if VER_1 == VER_2, and +1 if VER_1 > VER_2.
155
161
compare_version (){
@@ -926,7 +932,8 @@ get_pg_configmap(){
926
932
local wd_version=${WD_VERSION:- $(get_version)}
927
933
if [ $( compare_version " ${wd_version} " " 2.2.1" ) -le 0 ] ; then
928
934
echo $( oc get ${OC_ARGS} configmap -l tenant=${TENANT_NAME} ,app.kubernetes.io/component=postgres-cxn -o jsonpath=" {.items[0].metadata.name}" )
929
- elif [ $( compare_version " ${wd_version} " " 5.1.0" ) -lt 0 ] ; then
935
+ elif { [ $( major_version " ${wd_version} " ) -eq 4 ] && [ $( compare_version " ${wd_version} " " 4.8.8" ) -lt 0 ]; } ||
936
+ { [ $( major_version " ${wd_version} " ) -eq 5 ] && [ $( compare_version " ${wd_version} " " 5.1.0" ) -lt 0 ]; }; then
930
937
echo $( oc get ${OC_ARGS} configmap -l tenant=${TENANT_NAME} ,app=cn-postgres -o jsonpath=" {.items[0].metadata.name}" )
931
938
else
932
939
echo $( oc get ${OC_ARGS} configmap -l tenant=${TENANT_NAME} ,app=cn-postgres16 -o jsonpath=" {.items[0].metadata.name}" )
@@ -937,7 +944,8 @@ get_pg_secret(){
937
944
local wd_version=${WD_VERSION:- $(get_version)}
938
945
if [ $( compare_version " ${wd_version} " " 2.2.1" ) -le 0 ] ; then
939
946
echo $( oc ${OC_ARGS} get secret -l tenant=${TENANT_NAME} ,cr=${TENANT_NAME} -discovery-postgres -o jsonpath=" {.items[*].metadata.name}" )
940
- elif [ $( compare_version " ${wd_version} " " 5.1.0" ) -lt 0 ] ; then
947
+ elif { [ $( major_version " ${wd_version} " ) -eq 4 ] && [ $( compare_version " ${wd_version} " " 4.8.8" ) -lt 0 ]; } ||
948
+ { [ $( major_version " ${wd_version} " ) -eq 5 ] && [ $( compare_version " ${wd_version} " " 5.1.0" ) -lt 0 ]; }; then
941
949
echo $( oc ${OC_ARGS} get secret -l tenant=${TENANT_NAME} ,run=cn-postgres -o jsonpath=" {.items[*].metadata.name}" | tr ' [[:space:]]' ' \n' | grep " cn-postgres-wd" )
942
950
else
943
951
echo $( oc ${OC_ARGS} get secret -l tenant=${TENANT_NAME} ,run=cn-postgres16 -o jsonpath=" {.items[*].metadata.name}" | tr ' [[:space:]]' ' \n' | grep " cn-postgres16-wd" )
@@ -1128,7 +1136,8 @@ require_mt_mt_migration(){
1128
1136
1129
1137
get_primary_pg_pod (){
1130
1138
local wd_version=${WD_VERSION:- $(get_version)}
1131
- if [ $( compare_version " ${wd_version} " " 5.1.0" ) -ge 0 ] ; then
1139
+ if { [ $( major_version " ${wd_version} " ) -eq 4 ] && [ $( compare_version " ${wd_version} " " 4.8.8" ) -ge 0 ]; } ||
1140
+ { [ $( major_version " ${wd_version} " ) -eq 5 ] && [ $( compare_version " ${wd_version} " " 5.1.0" ) -ge 0 ]; }; then
1132
1141
echo " $( oc get pod ${OC_ARGS} -l " icpdsupport/podSelector=discovery-cn-postgres16,role=primary" -o jsonpath=' {.items[0].metadata.name}' ) "
1133
1142
elif [ $( compare_version " ${wd_version} " " 5.0.0" ) -ge 0 ] ; then
1134
1143
echo " $( oc get pod ${OC_ARGS} -l " icpdsupport/podSelector=discovery-cn-postgres,role=primary" -o jsonpath=' {.items[0].metadata.name}' ) "
0 commit comments