File tree 4 files changed +34
-2
lines changed
addons/rook/template/base
4 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,20 @@ function rook_operator_crds_deploy() {
156
156
# replace the CRDs if they already exist otherwise create them
157
157
# replace or create rather than apply to avoid the error "metadata.annotations: Too long"
158
158
if ! kubectl replace -f " $dst /crds.yaml" 2> /dev/null ; then
159
+
160
+ if kubectl get ns rook-ceph > /dev/null 2>&1 ; then
161
+ # Rook 1.12 introduced a new CRD "cephcosidrivers.ceph.rook.io" which will cause
162
+ # `kubectl create` to fail on upgrades. The following logic will extract the new CRD yaml and create it.
163
+ semverParse " $ROOK_VERSION "
164
+ local rook_major_version=" $major "
165
+ local rook_minor_version=" $minor "
166
+ if [ " $rook_major_version " = " 1" ] && [ " $rook_minor_version " -ge " 12" ]; then
167
+ get_yaml_from_multidoc_yaml " $dst /crds.yaml" " cephcosidrivers.ceph.rook.io" | kubectl create -f -
168
+ fi
169
+
170
+ return
171
+ fi
172
+
159
173
kubectl create -f " $dst /crds.yaml"
160
174
fi
161
175
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ KURL_BIN_UTILS_FILE=
11
11
# STEP_VERSIONS array is generated by the server and injected at runtime based on supported k8s versions
12
12
STEP_VERSIONS=(0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 1.16.4 1.17.13 1.18.20 1.19.16 1.20.15 1.21.14 1.22.17 1.23.17 1.24.16 1.25.12 1.26.7 1.27.4)
13
13
# ROOK_STEP_VERSIONS array is generated by the server and injected at runtime based on supported rook versions
14
- ROOK_STEP_VERSIONS=(1.0.4-14.2.21 0.0.0 0.0.0 0.0.0 1.4.9 1.5.12 1.6.11 1.7.11 1.8.10 1.9.12 1.10.11 1.11.8)
14
+ ROOK_STEP_VERSIONS=(1.0.4-14.2.21 0.0.0 0.0.0 0.0.0 1.4.9 1.5.12 1.6.11 1.7.11 1.8.10 1.9.12 1.10.11 1.11.8 1.12.0 )
15
15
# CONTAINERD_STEP_VERSIONS array is generated by the server and injected at runtime based on supported containerd versions
16
16
CONTAINERD_STEP_VERSIONS=(1.2.13 1.3.9 1.4.13 1.5.11 1.6.21)
17
17
INSTALLER_YAML=
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ KURL_BIN_UTILS_FILE=
11
11
# STEP_VERSIONS array is generated by the server and injected at runtime based on supported k8s versions
12
12
STEP_VERSIONS=(0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 0.0.0 1.16.4 1.17.13 1.18.20 1.19.16 1.20.15 1.21.14 1.22.17 1.23.17 1.24.16 1.25.12 1.26.7 1.27.4)
13
13
# ROOK_STEP_VERSIONS array is generated by the server and injected at runtime based on supported rook versions
14
- ROOK_STEP_VERSIONS=(1.0.4-14.2.21 0.0.0 0.0.0 0.0.0 1.4.9 1.5.12 1.6.11 1.7.11 1.8.10 1.9.12 1.10.11 1.11.8)
14
+ ROOK_STEP_VERSIONS=(1.0.4-14.2.21 0.0.0 0.0.0 0.0.0 1.4.9 1.5.12 1.6.11 1.7.11 1.8.10 1.9.12 1.10.11 1.11.8 1.12.0 )
15
15
# CONTAINERD_STEP_VERSIONS array is generated by the server and injected at runtime based on supported containerd versions
16
16
CONTAINERD_STEP_VERSIONS=(1.2.13 1.3.9 1.4.13 1.5.11 1.6.21)
17
17
INSTALLER_YAML=
Original file line number Diff line number Diff line change @@ -242,3 +242,21 @@ function yaml_escape_string_quotes() {
242
242
function yaml_newline_to_literal() {
243
243
sed -e ' :a' -e ' N' -e ' $!ba' -e ' s/\n/\\n/g'
244
244
}
245
+
246
+ # get_yaml_from_multidoc_yaml reads a single file multi-doc yaml and finds a particular embedded yaml doc
247
+ # based on the `name:` field and outputs the doc to stdout.
248
+ function get_yaml_from_multidoc_yaml() {
249
+ local multidoc_yaml=" $1 "
250
+ local resource_name=" $2 "
251
+
252
+ # use awk to split the multidoc file using `---`separator
253
+ awk -v RS=' ---\n' -v ORS=' ---\n' -v RESOURCE_NAME=" $resource_name " '
254
+ $0 ~ ("name: " RESOURCE_NAME) {
255
+ found = 1
256
+ print $0
257
+ }
258
+ END {
259
+ exit !found
260
+ }
261
+ ' " $multidoc_yaml "
262
+ }
You can’t perform that action at this time.
0 commit comments