Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
polskikiel committed Nov 5, 2019
1 parent 0d9ab30 commit 7b8fb29
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
26 changes: 21 additions & 5 deletions contrib/hack/migration-check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/usr/bin/env bash
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit

EXIT_CODE=0

Expand All @@ -8,7 +23,7 @@ function checkIfClassExist(){

for class in ${classesNames}
do
if [[ "${class}" -eq "${externalName}" ]]; then
if [[ "${class}" = "${externalName}" ]]; then
return 0
fi
done
Expand All @@ -25,22 +40,23 @@ function checkIfClassExistForInstance(){
type=$(echo "${className}" | cut -d'/' -f1)
externalName=$(echo "${className}" | cut -d'/' -f2)

if [[ "${type}" -eq "ClusterServiceClass" ]]; then
set +o errexit
if [[ "${type}" = "ClusterServiceClass" ]]; then
checkIfClassExist "${externalName}" "${clusterServiceClassesNames}"
if [[ $? -eq 1 ]]; then
echo "${className} not exist in the cluster for the ServiceInstance anymore"
EXIT_CODE=1
fi
fi
if [[ "${type}" -eq "ServiceClass" ]]; then
if [[ "${type}" = "ServiceClass" ]]; then
checkIfClassExist "${externalName}" "${serviceClassesNames}"
if [[ $? -eq 1 ]]; then
echo "${className} not exist in the cluster for the ServiceInstance anymore"
EXIT_CODE=1
fi
fi
done

set -o errexit
}

#
Expand Down Expand Up @@ -146,7 +162,7 @@ fi
if [[ ${EXIT_CODE} -eq 0 ]]; then
echo "Your Service Catalog resources are ready to migrate!"
else
echo "Please prepare your Service Catalog resources for migration"
echo "Please prepare your Service Catalog resources before migration. Check docs/migration-apiserver-to-crds.md#implementation-details"
fi

exit ${EXIT_CODE}
4 changes: 2 additions & 2 deletions docs/migration-apiserver-to-crds.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ To test the mutation blocking feature, execute the following commands:

>**CAUTION:** You can safely remove the migration job PVC, which contains data about your Service Catalog resources only when the migration end up successfully.

In order to make an successful migration, the Service Catalog resources can't be in the unfinished/deleted state. Otherwise our upgrade job can fail.
In order to make an successful migration, the Service Catalog resources can't be in the unfinished or deleted state. Otherwise our upgrade job can fail.
To check if your cluster is ready to migration, use the sanity check [script](https://github.com/kubernetes-sigs/service-catalog/blob/master/contrib/hack/migration-check.sh).
Expand Down Expand Up @@ -158,4 +158,4 @@ Then you can execute the rollback using this command:
helm rollback catalog 1 --cleanup-on-fail --no-hooks
```
The migration job PVC with the data about your Service Catalog resources still exists after the rollback. You can run migration again to restore them.
The migration job PVC with the data about your Service Catalog resources still exists after the rollback. You can run the upgrade again to restore them.

0 comments on commit 7b8fb29

Please sign in to comment.