Skip to content

Commit 2b17787

Browse files
alai8rjeberhard
andauthored
OWLS-101608 - update scalingAction.sh for operator 3.4 to work in k8s clusters with operator 4.0 installed (#3396)
* limit domain_api_version to v8 * minor refactoring and add unit test for v9 domain apis json * Update scalingActionTest.sh Co-authored-by: Ryan Eberhard <[email protected]>
1 parent a57c9e3 commit 2b17787

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

operator/scripts/scaling/scalingAction.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright (c) 2017, 2021, Oracle and/or its affiliates.
2+
# Copyright (c) 2017, 2022, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44

55
# script parameters
@@ -135,6 +135,13 @@ for i in json.load(sys.stdin)["groups"]:
135135
INPUT
136136
domain_api_version=`echo ${APIS} | python cmds-$$.py 2>> ${log_file_name}`
137137
fi
138+
139+
# This script only supports up to version v8 of Domain resource
140+
version=$(echo "${domain_api_version}" | grep -Eo '[0-9]+$')
141+
if [ -n "${version}" ] && [ "$version" -gt 8 ]; then
142+
trace "Setting domain_api_version from $domain_api_version to v8"
143+
domain_api_version="v8"
144+
fi
138145
echo "$domain_api_version"
139146
}
140147

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"kind": "APIGroupList",
3+
"apiVersion": "v1",
4+
"groups": [
5+
{
6+
"name": "weblogic.oracle",
7+
"versions": [
8+
{
9+
"groupVersion": "weblogic.oracle/v9",
10+
"version": "v9"
11+
},
12+
{
13+
"groupVersion": "weblogic.oracle/v8",
14+
"version": "v8"
15+
},
16+
{
17+
"groupVersion": "weblogic.oracle/v1",
18+
"version": "v1"
19+
}
20+
],
21+
"preferredVersion": {
22+
"groupVersion": "weblogic.oracle/v9",
23+
"version": "v9"
24+
}
25+
}
26+
]
27+
}
28+

operator/src/test/sh/scaling/scalingActionTest.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Copyright (c) 2021, Oracle and/or its affiliates.
2+
# Copyright (c) 2021, 2022 Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44

55
TEST_OPERATOR_ROOT=/tmp/test/weblogic-operator
@@ -44,6 +44,25 @@ test_get_domain_api_version_jq() {
4444
assertEquals "Did not return expected api version" 'v8' "${result}"
4545
}
4646

47+
test_get_domain_api_version_set_to_v8() {
48+
CURL_FILE="apis3.json"
49+
50+
result=$(get_domain_api_version)
51+
52+
assertEquals "Did not return expected api version" 'v8' "${result}"
53+
}
54+
55+
test_get_domain_api_version_set_to_v8_jq() {
56+
skip_if_jq_not_installed
57+
58+
CURL_FILE="apis3.json"
59+
60+
result=$(get_domain_api_version)
61+
62+
assertEquals "Did not return expected api version" 'v8' "${result}"
63+
}
64+
65+
4766
test_get_domain_api_version_without_weblogic_group() {
4867
CURL_FILE="apis2.json"
4968

0 commit comments

Comments
 (0)