Bug 1467265

Summary: Logging uninstall does not remove PVC
Product: OpenShift Container Platform Reporter: Ruben Romero Montes <rromerom>
Component: LoggingAssignee: Jan Wozniak <jwozniak>
Status: CLOSED ERRATA QA Contact: Anping Li <anli>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.5.0CC: anli, aos-bugs, bmcelvee, jcantril, jwozniak, pweil, rmeggins, wsun
Target Milestone: ---   
Target Release: 3.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Feature: introduced 'openshift_logging_purge_logging' ansible variable to purge logging persistent data Reason: the 'openshift_logging_install_logging=false' will keep persistent data, there was a need for a complete uninstall. Result: no changes to 'openshift_logging_install_logging', additional variable 'openshift_logging_purge_logging' for complete uninstall
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-28 22:00:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
The host and uninstall logs none

Description Ruben Romero Montes 2017-07-03 09:30:58 UTC
Description of problem:
I would expect the PVC created by the installer to be removed when uninstalling logging using the openshift-logging playbook with the following variables:

openshift_logging_install_logging=false
openshift_logging_upgrade_logging=false
openshift_logging_es_pvc_size=1Gi

Version-Release number of selected component (if applicable):
OCP 3.5.5.26

How reproducible:
Always

Steps to Reproduce:
1. Create PV for logging
2. Install logging using openshift-logging.yml playbook
3. Remove logging using same playbook

Actual results:
$ oc get pv -n logging
NAME           CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS    CLAIM                  REASON    AGE
logging-es-1   1Gi        RWO           Retain          Bound     logging/logging-es-0             1h
logging-es-2   1Gi        RWO           Retain          Bound     logging/logging-es-1             1h
logging-es-3   1Gi        RWO           Retain          Bound     logging/logging-es-2             1h

Expected results:
I would expect the PVC to have been deleted because a new installation will create new PVC which won't be bound because of the existing ones.

Additional info:

Comment 2 Jan Wozniak 2017-08-24 08:06:19 UTC
This PR should address your comment:

https://github.com/openshift/openshift-ansible/pull/5189

Comment 3 openshift-github-bot 2017-08-31 11:55:09 UTC
Commit pushed to master at https://github.com/openshift/openshift-ansible

https://github.com/openshift/openshift-ansible/commit/51a2d9dbadea02f22168629d44ff339b3c45d6d1
Bug 1467265 - logging: add 'purge' option with uninstall

The common uninstall would keep PVC around to prevent unwanted data loss during
reinstalls. There is a scenario where the user may want complete removal of EFK
stack including PVC.

This change adds an optional `openshift_logging_purge_logging` variable to
completely remove the EFK stack. By default, this is set to 'False' and only
works if user sets `openshift_logging_install_logging` to 'False' to initiate
the uninstallation process.

Comment 4 Anping Li 2017-09-07 10:12:50 UTC
Created attachment 1323020 [details]
The host and uninstall logs

The pvc was not deleted by playbook in openshift-ansible:master

[root@host2-master ~]# oc get pvc 
NAME           STATUS    VOLUME           CAPACITY   ACCESSMODES   STORAGECLASS   AGE
logging-es-0   Bound     nfsvol5          10Gi       RWO                          3h

Comment 5 Jan Wozniak 2017-09-07 14:25:27 UTC
Could you please run following commands after you tried the uninstall? Thanks!

oc get pvc --selector=logging-infra --namespace=logging
oc describe pvc logging-es-0

Comment 6 Anping Li 2017-09-08 02:17:34 UTC
Jan,  The prior pvc [1] was incorrect. it wasn't created by installer and wasn't labelled by logging-infra.  The test pass with pvc created by installer. so move bug to verified.

[1]. The prior pvc created by manually
[root@host2-master ~]# oc describe pvc logging-es-0
Name:		logging-es-0
Namespace:	logging
StorageClass:	
Status:		Bound
Volume:		nfsvol5
Labels:		<none>
Annotations:	pv.kubernetes.io/bind-completed=yes
		pv.kubernetes.io/bound-by-controller=yes
Capacity:	10Gi
Access Modes:	RWO
Events:		<none>

[2]. The pvc created by installer.
# oc get pvc logging-es-0 -o json 
{
    "apiVersion": "v1",
    "kind": "PersistentVolumeClaim",
    "metadata": {
        "annotations": {
            "pv.kubernetes.io/bind-completed": "yes",
            "pv.kubernetes.io/bound-by-controller": "yes"
        },
        "creationTimestamp": "2017-09-08T02:02:53Z",
        "labels": {
            "logging-infra": "support"
        },
        "name": "logging-es-0",
        "namespace": "logging",
        "resourceVersion": "35379",
        "selfLink": "/api/v1/namespaces/logging/persistentvolumeclaims/logging-es-0",
        "uid": "d36c0b9d-9439-11e7-bc00-fa163e8efe63"
    },
    "spec": {
        "accessModes": [
            "ReadWriteOnce"
        ],
        "resources": {
            "requests": {
                "storage": "10G"
            }
        },
        "volumeName": "nfsvol6"
    },
    "status": {
        "accessModes": [
            "ReadWriteOnce"
        ],
        "capacity": {
            "storage": "10Gi"
        },
        "phase": "Bound"
    }
}

Comment 7 Jan Wozniak 2017-09-08 07:56:26 UTC
Great! Thanks for the update. I was already getting quite creative about what could have possibly happened there as I couldn't reproduce that at all.

Comment 9 openshift-github-bot 2017-09-28 17:13:28 UTC
Commits pushed to master at https://github.com/openshift/openshift-docs

https://github.com/openshift/openshift-docs/commit/43b15d6e39513951ea0b37fd7ca72840df01bcf5
Bug 1467265 Add 'Purge' Option with Uninstall

https://github.com/openshift/openshift-docs/commit/2b4d13b2bbc62b90e46ab5c24a24f3595102e7a9
Merge pull request #5218 from bmcelvee/BZ1467265

Bug 1467265 Add 'Purge' Option with Uninstall

Comment 12 errata-xmlrpc 2017-11-28 22:00:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:3188