Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add service catalog remover job #68

Merged
merged 29 commits into from Mar 31, 2020

Conversation

jmrodri
Copy link
Contributor

@jmrodri jmrodri commented Jan 21, 2020

No description provided.

@openshift-ci-robot openshift-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jan 21, 2020
@jmrodri
Copy link
Contributor Author

jmrodri commented Jan 21, 2020

Running it against a cluster

[jesusr@transam cluster-svcat-controller-manager-operator{remove-svcat-add-job}]$ ./cluster-svcat-controller-manager-remover 
INFO[0000] Starting openshift-service-catalog-controller-manager-remover job 
INFO[0000] ServiceCatalogControllerManager managementState is 'Removed' 
INFO[0000] Removing target namespace openshift-service-catalog-controller-manager-operator 
INFO[0000] Removing the ServiceCatalogControllerManager CR 
INFO[0000] ServiceCatalogControllerManager cr removed successfully. 

See that the openshift-service-catalog-controller-manager-operator namespace is now gone.

[jesusr@transam 0718]$ oc get namespaces | grep service-catalog
openshift-service-catalog-apiserver-operator           Active   3h59m
openshift-service-catalog-controller-manager-remover   Active   137m

CR is gone

[jesusr@transam 0718]$ oc get ServiceCatalogControllerManager
No resources found in default namespace.

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 21, 2020
cmd/cluster-svcat-controller-manager-remover/main.go Outdated Show resolved Hide resolved
cmd/cluster-svcat-controller-manager-remover/main.go Outdated Show resolved Hide resolved
manifests/08_remover_job.yaml Outdated Show resolved Hide resolved
@shawn-hurley
Copy link

/retest

@jmrodri
Copy link
Contributor Author

jmrodri commented Jan 24, 2020

This PR is currently blocked by https://bugzilla.redhat.com/show_bug.cgi?id=1794823

@jmrodri
Copy link
Contributor Author

jmrodri commented Jan 25, 2020

TEST With the CR's managementState in Managed

[jesusr@transam 0718]$ oc get ServiceCatalogControllerManager -o yaml | grep managementState
    managementState: Managed

You can see the Service Catalog Controller Manager is running

[jesusr@transam 0718]$ oc get namespaces | grep service-catalog
openshift-service-catalog-apiserver                     Active   22m
openshift-service-catalog-controller-manager            Active   18s
openshift-service-catalog-controller-manager-operator   Active   34h
openshift-service-catalog-removed                       Active   35h

In the event we see a Managed CR we abort and don't do anything, this is not a condition we were expected to handle.

[jesusr@transam 0718]$ /tmp/cluster-svcat-controller-manager-remover 
INFO[0000] Starting openshift-service-catalog-controller-manager-remover job 
WARN[0000] We found a cluster-svcat-controller-manager-operator in Managed state. Aborting 

As you can see nothing was touched

[jesusr@transam 0718]$ oc get namespaces | grep service-catalog
openshift-service-catalog-apiserver                     Active   23m
openshift-service-catalog-controller-manager            Active   115s
openshift-service-catalog-controller-manager-operator   Active   34h
openshift-service-catalog-removed                       Active   35h

The CR is still in Managed state.

[jesusr@transam 0718]$ oc get ServiceCatalogControllerManager -o yaml | grep managementState
    managementState: Managed

@jmrodri
Copy link
Contributor Author

jmrodri commented Jan 25, 2020

TEST With the CR's managementState in Removed

[jesusr@transam 0718]$ oc get ServiceCatalogControllerManager -o yaml | grep managementState
    managementState: Removed

With the managementState in Removed, the ServiceCatalog is not running, but the operator is.

[jesusr@transam 0718]$ oc get namespaces | grep service-catalog
openshift-service-catalog-apiserver-operator            Active   4m21s
openshift-service-catalog-controller-manager-operator   Active   4m21s
openshift-service-catalog-removed                       Active   35h

Running the job executable

[jesusr@transam 0718]$ /tmp/cluster-svcat-controller-manager-remover 
INFO[0000] Starting openshift-service-catalog-controller-manager-remover job 
INFO[0000] ServiceCatalogControllerManager managementState is 'Removed' 
INFO[0000] Removing target namespace openshift-service-catalog-controller-manager-operator 
INFO[0000] Removing the ServiceCatalogControllerManager CR 
INFO[0000] ServiceCatalogControllerManager cr removed successfully. 
INFO[0000] Removing the service-catalog-controller-manager clusteroperator 
INFO[0000] Removing ClusterRoleBinding: openshift-service-catalog-controller-manager-operator 
INFO[0000] Removing ClusterRole: openshift-service-catalog-controller-manager-operator 

We can see the controller-manager-operator pod is Terminating, remember this job is only for the controller-manager

[jesusr@transam 0718]$ oc get namespaces | grep service-catalog
openshift-service-catalog-apiserver-operator            Active        5m4s
openshift-service-catalog-controller-manager-operator   Terminating   5m4s
openshift-service-catalog-removed                       Active        35h

The namespace is now gone

[jesusr@transam 0718]$ oc get namespaces | grep service-catalog
openshift-service-catalog-apiserver-operator       Active   5m12s
openshift-service-catalog-removed                  Active   35h

The CR is also gone

[jesusr@transam 0718]$ oc get ServiceCatalogControllerManager -o yaml | grep managementState
[jesusr@transam 0718]$ oc get ServiceCatalogControllerManager 
No resources found in openshift-service-catalog-apiserver-operator namespace.

@jmrodri
Copy link
Contributor Author

jmrodri commented Jan 25, 2020

TEST With the CR's managementState in Unmanaged

[jesusr@transam 0718]$ oc get ServiceCatalogControllerManager -o yaml | grep managementState
    managementState: Unmanaged

Here we have a running controller-manager and a CR in Unmanaged state:

[jesusr@transam 0718]$ oc get namespaces | grep service-catalog
openshift-service-catalog-apiserver                     Active   26m
openshift-service-catalog-controller-manager            Active   4m27s
openshift-service-catalog-controller-manager-operator   Active   34h
openshift-service-catalog-removed                       Active   35h
[jesusr@transam 0718]$ oc get pods -n openshift-service-catalog-controller-manager
NAME                       READY   STATUS    RESTARTS   AGE
controller-manager-46gpw   0/1     Running   0          4m25s
controller-manager-9kd5m   0/1     Running   3          4m27s
controller-manager-gpftj   0/1     Running   0          4m25s

Running the controller-manager job remover executable

[jesusr@transam 0718]$ /tmp/cluster-svcat-controller-manager-remover 
INFO[0000] Starting openshift-service-catalog-controller-manager-remover job 
INFO[0000] ServiceCatalogControllerManager managementState is 'Unmanaged' 
INFO[0000] Removing target namespace openshift-service-catalog-controller-manager-operator 
INFO[0000] Removing the ServiceCatalogControllerManager CR 
INFO[0000] ServiceCatalogControllerManager cr removed successfully. 
INFO[0000] Removing the service-catalog-controller-manager clusteroperator 
INFO[0000] Removing ClusterRoleBinding: openshift-service-catalog-controller-manager-operator 
INFO[0000] Removing ClusterRole: openshift-service-catalog-controller-manager-operator 

We see the controller-manager-operator namespace was removed, but the openshift-service-catalog-controller-manager was untouched.

[jesusr@transam 0718]$ oc get namespaces | grep service-catalog
openshift-service-catalog-apiserver                Active   27m
openshift-service-catalog-controller-manager       Active   6m5s
openshift-service-catalog-removed                  Active   35h
[jesusr@transam 0718]$ oc get pods -n openshift-service-catalog-controller-manager
NAME                       READY   STATUS    RESTARTS   AGE
controller-manager-46gpw   0/1     Running   0          6m1s
controller-manager-9kd5m   0/1     Running   3          6m3s
controller-manager-gpftj   0/1     Running   2          6m1s

The CR is removed

[jesusr@transam 0718]$ oc get ServiceCatalogControllerManager -o yaml | grep managementState
[jesusr@transam 0718]$ oc get ServiceCatalogControllerManager
No resources found in openshift-service-catalog-apiserver-operator namespace.

@jmrodri
Copy link
Contributor Author

jmrodri commented Jan 27, 2020

/test e2e-aws

2 similar comments
@camilamacedo86
Copy link

/test e2e-aws

@jmrodri
Copy link
Contributor Author

jmrodri commented Feb 20, 2020

/test e2e-aws

@jmrodri
Copy link
Contributor Author

jmrodri commented Feb 27, 2020

Switched to go 1.13 and go modules.

@jmrodri
Copy link
Contributor Author

jmrodri commented Mar 9, 2020

/retest

github.com/openshift/client-go v0.0.0-20200116152001-92a2713fa240
github.com/sirupsen/logrus v1.4.2
k8s.io/apimachinery v0.17.3-beta.0
k8s.io/client-go v0.17.2

Choose a reason for hiding this comment

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

Are we using these versions in SDK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@camilamacedo86 not that I know of. But this operator doesn't use or require the SDK. So there should be no conflict between the two.

@jmrodri
Copy link
Contributor Author

jmrodri commented Mar 30, 2020

/retest

@@ -1,10 +1,9 @@
FROM registry.svc.ci.openshift.org/ocp/builder:golang-1.12 AS builder
FROM registry.svc.ci.openshift.org/ocp/builder:golang-1.13 AS builder

Choose a reason for hiding this comment

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

Just fixing the image built 👍

t.Fatalf("%s namespace was not removed", operatorNamespaceName)
}
}

Choose a reason for hiding this comment

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

@shawn-hurley
Copy link

/test all

@shawn-hurley
Copy link

/lgtm

Passed upgrades and is flaking for something else. Manually tested a 4.4.0-rc.4 upgrade with this PR.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 31, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jmrodri, shawn-hurley

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:
  • OWNERS [jmrodri,shawn-hurley]

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

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 0881e2f into openshift:master Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants