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

Create sanity check script for migration #2743

Merged
merged 11 commits into from
Nov 19, 2019

Conversation

polskikiel
Copy link
Contributor

@polskikiel polskikiel commented Nov 5, 2019

This PR is a

  • Feature Implementation
  • Bug Fix
  • Documentation

What this PR does / why we need it:

  • Created sanity check script for migration
  • Updated documentation for the migration process

Please leave this checklist in the PR comment so that maintainers can ensure a good PR.

Merge Checklist:

  • New feature
    • Tests
    • Documentation
  • SVCat CLI flag
  • Server Flag for config
    • Chart changes
    • removing a flag by marking deprecated and hiding to avoid
      breaking the chart release and existing clients who provide a
      flag that will get an error when they try to update

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 5, 2019
@k8s-ci-robot
Copy link
Contributor

Welcome @polskikiel!

It looks like this is your first PR to kubernetes-sigs/service-catalog 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/service-catalog has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @polskikiel. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 5, 2019
@mszostok
Copy link
Contributor

mszostok commented Nov 5, 2019

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 5, 2019
@polskikiel polskikiel force-pushed the sc-migration-script branch 2 times, most recently from 7676324 to e1f66d5 Compare November 5, 2019 13:10
CSC=$(kubectl get clusterserviceclasses -ojsonpath="{.items[*].metadata.deletionTimestamp}")
if [[ -n ${CSC} ]]; then
echo "There are ClusterServiceClasses with deletionTimestamp set"
EXIT_CODE=1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please print which resources are being deleted, the same for other checks

@@ -151,3 +159,5 @@ 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 perform the migration again to restore your resources.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide information how to apply those resources, e.g. build a binary or run some docker image? copy data from PVC to local host and execute binary to restore them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if [[ ${EXIT_CODE} -eq 0 ]]; then
echo "Your Service Catalog resources are ready to migrate!"
else
echo "Please prepare your Service Catalog resources before migration. Check docs/migration-apiserver-to-crds.md#implementation-details"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how reading the implementation details will help you in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to preparation section which actually exists


SP=$(kubectl get serviceplans --all-namespaces -ojsonpath="{.items[*].metadata.deletionTimestamp}")
if [[ -n ${SP} ]]; then
echo "There are ServicePlans with deletionTimestamp set"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make it consistent
in the case of service brokers you are saying:
"There are being deleted ServiceBrokers"

so please have always the same message, and better will be described what is going on instead of saying that you have deletionTimestamp set becasue it is an implementation details and service catalog users may not know that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@polskikiel
Copy link
Contributor Author

/test pull-service-catalog-test-e2e

@piotrmiskiewicz
Copy link
Contributor

/test pull-service-catalog-test-e2e

do
if [[ -n "${status}" ]] && ${status}; then
echo "There are ServiceClasses removed from broker's catalog:"
kubectl get serviceclasses -o custom-columns=NAME:.metadata.name,NAMESPACE:.metadata.namespace,REMOVED:.status.removedFromBrokerCatalog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add --all-namespaces flag (the same comment for other not cluster-wide resoruces)

@mszostok
Copy link
Contributor

unfortunately this script is not working at all it spams me with such entries:

ServiceClass/bestmatch-api-2871d not exist in the cluster for the ServiceInstances:

ServiceClass/bestmatch-api-2f6cb not exist in the cluster for the ServiceInstances:

ServiceClass/bestmatch-api-43def not exist in the cluster for the ServiceInstances:

ServiceClass/bestmatch-api-4a5c3 not exist in the cluster for the ServiceInstances:

ServiceClass/dispatch-api-08c72 not exist in the cluster for the ServiceInstances:

ServiceClass/dispatch-api-4d6d4 not exist in the cluster for the ServiceInstances:

ServiceClass/dispatch-api-772e4 not exist in the cluster for the ServiceInstances:

ServiceClass/dispatch-api-d3821 not exist in the cluster for the ServiceInstances:

ServiceClass/dispatch-api-dec18 not exist in the cluster for the ServiceInstances:

ServiceClass/bestmatch-api-176b1 not exist in the cluster for the ServiceInstances:

ServiceClass/cc-events-v1-4adab not exist in the cluster for the ServiceInstances:

ServiceClass/cc-occ-commerce-webservices-v2-3da74 not exist in the cluster for the ServiceInstances:

ServiceClass/data-api-276ab not exist in the cluster for the ServiceInstances:

ServiceClass/dispatch-api-d3340 not exist in the cluster for the ServiceInstances:

ServiceClass/dispatch-api-d3340 not exist in the cluster for the ServiceInstances:

ServiceClass/query-api-f41b5 not exist in the cluster for the ServiceInstances:

ServiceClass/service-api-414d9 not exist in the cluster for the ServiceInstances:

ServiceClass/data-api-5d88b not exist in the cluster for the ServiceInstances:

ServiceClass/dispatch-api-b8b70 not exist in the cluster for the ServiceInstances:

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

There are ServicePlans removed from broker's catalog:
NAME   NAMESPACE   REMOVED

Please prepare your Service Catalog resources before migration. Check docs/migration-apiserver-to-crds.md#preparation

@mszostok
Copy link
Contributor

the script at the end points to Preparation section and this section points to running the sanity checks script.

As a client I'm expecting that there will be guideline what to do in case you have deletion in progress with error that reference not existing service class etc.

e.g. for service instance in with error that reference not existing service class user should use the svcat, svcat deprovision foobar-mysql --abandon

source: https://github.com/kubernetes-sigs/service-catalog/blob/master/docs/tasks/stuck_instance.md

test also that each described solution is working.

@mszostok
Copy link
Contributor

(Cluster)ServicePlans/ServiceClasses can be marked as removed from the broker and client does not have to clean them up before the upgrade.

We have only problems with outgoing operations and object that are marked as deleted, but they are either in error state or still in deprovisioning process

@polskikiel
Copy link
Contributor Author

@mszostok I've aligned my PR to your comments

@polskikiel polskikiel force-pushed the sc-migration-script branch 3 times, most recently from 3dd4fcf to 9ce4b9e Compare November 19, 2019 12:39
@piotrmiskiewicz
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: piotrmiskiewicz, polskikiel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 19, 2019
@piotrmiskiewicz
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2019
@k8s-ci-robot k8s-ci-robot merged commit b5a5c4b into kubernetes-retired:master Nov 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants