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

Delete operator service on plugin delete and skip existing items on c… #486

Merged
merged 1 commit into from
Feb 22, 2021

Conversation

cesnietor
Copy link
Contributor

@cesnietor cesnietor commented Feb 20, 2021

…reation

Fixes #473

Operator service was not being deleted on kubectl-minio delete also change to not returning the error
when resource already exist on init command.

Also on deletion, skip if item was not found since it is not there already.

Note:
This also brings the discussion if whether we should just logg instead of returning any other type of errors on deletion
as well as if we should have a defer function during creation to delete items created if something failed during init command.

Test:
To test:

  1. Build operator locally like :
 make build TAG="minio/operator:test" &&  kind load docker-image minio/operator:test
  1. Build plugin locally like
cd kubectl-minio && go build

3.and run :

 kubectl create ns minio-operator && ./kubectl-minio init -n minio-operator --image=minio/operator:test
  1. delete plugin:
./kubectl-minio delete

By then all resources including Service operator should be deleted.
5. Create again:

./kubectl-minio init -n minio-operator --image=minio/operator:test

Plugin should be generated with no errors
6. Create again2:

./kubectl-minio init -n minio-operator --image=minio/operator:test

plugin should just return skipped items during creation:

MinIO Operator Namespace minio-operator: created
CustomResourceDefinition tenants.minio.min.io: already present, skipped
ClusterRole minio-operator-role: already present, skipped
ServiceAccount minio-operator: already present, skipped
ClusterRoleBinding minio-operator-binding: already present, skipped
MinIO Operator Service operator: already present, skipped
MinIO Operator Deployment minio-operator: already present, skipped
serviceaccounts "console-sa" already exists, skipped
clusterroles.rbac.authorization.k8s.io "console-sa-role" already exists, skipped
clusterrolebindings.rbac.authorization.k8s.io "console-sa-binding" already exists, skipped
configmaps "console-env" already exists, skipped
services "console" already exists, skipped
deployments.apps "console" already exists, skipped
MinIO Console Deployment: created
-----------------

To open Operator UI, start a port forward using this command:

kubectl minio proxy

-----------------

nitisht
nitisht previously approved these changes Feb 22, 2021
Copy link
Contributor

@nitisht nitisht left a comment

Choose a reason for hiding this comment

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

LGTM

…reation

Operator service was not being deleted on `kubectl-minio delete` also change to not returning the error
when resource already exists on `init` command.

Also on deletion, skip if item was not found since it is not there already.
@cesnietor cesnietor force-pushed the delete-improvements-plugin branch from b8b67c6 to 3d84775 Compare February 22, 2021 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubectl minio plugin doesn't properly cleanup after operator 3.0.29
4 participants