Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1508310

Summary: There is ansible error "Error from server (NotFound): serviceaccounts \"prometheus\" not found" when uninstall prometheus
Product: OpenShift Container Platform Reporter: Junqi Zhao <juzhao>
Component: InstallerAssignee: Zohar Gal-Or <zgalor>
Status: CLOSED ERRATA QA Contact: Junqi Zhao <juzhao>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.7.0CC: aos-bugs, jcantril, jokerman, mmccomas, pruan
Target Milestone: ---   
Target Release: 3.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-28 14:08:55 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:
Attachments:
Description Flags
uninstall prometheus log none

Description Junqi Zhao 2017-11-01 06:37:52 UTC
Created attachment 1346333 [details]
uninstall prometheus log

Description of problem:
Uninstall prometheus, there is ansible error: "Error from server (NotFound): serviceaccounts \"prometheus\" not found".

Actually prometheus namespace is already deleted, no return result for the following command
# oc get project | grep prometheus

fatal: [host-8-241-66.host.centralci.eng.rdu2.redhat.com]: FAILED! => {
    "changed": true, 
    "cmd": [
        "oc", 
        "annotate", 
        "--overwrite", 
        "-n", 
        "prometheus", 
        "serviceaccount", 
        "prometheus", 
        "serviceaccounts.openshift.io/oauth-redirectreference.prom={\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"prometheus\"}}", 
        "serviceaccounts.openshift.io/oauth-redirectreference.alerts={\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"alerts\"}}"
    ], 
    "delta": "0:00:00.206803", 
    "end": "2017-11-01 02:19:37.016069", 
    "failed": true, 
    "invocation": {
        "module_args": {
            "_raw_params": "oc annotate --overwrite -n prometheus serviceaccount prometheus serviceaccounts.openshift.io/oauth-redirectreference.prom='{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"prometheus\"}}' serviceaccounts.openshift.io/oauth-redirectreference.alerts='{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"alerts\"}}'", 
            "_uses_shell": false, 
            "chdir": null, 
            "creates": null, 
            "executable": null, 
            "removes": null, 
            "stdin": null, 
            "warn": true
        }
    }, 
    "msg": "non-zero return code", 
    "rc": 1, 
    "start": "2017-11-01 02:19:36.809266", 
    "stderr": "Error from server (NotFound): serviceaccounts \"prometheus\" not found", 
    "stderr_lines": [
        "Error from server (NotFound): serviceaccounts \"prometheus\" not found"
    ], 
    "stdout": "", 
    "stdout_lines": []
}
	to retry, use: --limit @/usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/openshift-prometheus.retry

actually prometheus is already deleted, no return result for the following command
# oc get project | grep prometheus

Version-Release number of the following components:
# rpm -qa | grep openshift-ansible
openshift-ansible-callback-plugins-3.7.0-0.184.0.git.0.d407445.el7.noarch
openshift-ansible-3.7.0-0.184.0.git.0.d407445.el7.noarch
openshift-ansible-filter-plugins-3.7.0-0.184.0.git.0.d407445.el7.noarch
openshift-ansible-playbooks-3.7.0-0.184.0.git.0.d407445.el7.noarch
openshift-ansible-docs-3.7.0-0.184.0.git.0.d407445.el7.noarch
openshift-ansible-lookup-plugins-3.7.0-0.184.0.git.0.d407445.el7.noarch
openshift-ansible-roles-3.7.0-0.184.0.git.0.d407445.el7.noarch

Images:
oauth-proxy/images/v3.7.0-54
prometheus/images/v3.7.0-54
prometheus-alertmanager/images/v3.7.0-54
prometheus-alert-buffer/images/v3.7.0-51

How reproducible:
Always

Steps to Reproduce:
1. Uninstall prometheus, inventory file see the [Additional info] part
2.
3.

Actual results:
Ansible error "Error from server (NotFound): serviceaccounts \"prometheus\" not found" when uninstall prometheus

Expected results:
There should not be error throw out.

Additional info:
[OSEv3:children]
masters
etcd
nfs
[masters]
${MASTER} openshift_public_hostname=${MASTER}

[etcd]
${ETCD} openshift_public_hostname=${ETCD}

[OSEv3:vars]
ansible_ssh_user=root
ansible_ssh_private_key_file="~/libra.pem"
deployment_type=openshift-enterprise

# prometheus
openshift_prometheus_state=absent
openshift_prometheus_namespace=prometheus

Comment 1 Peter Ruan 2017-11-14 00:55:23 UTC
*** Bug 1512723 has been marked as a duplicate of this bug. ***

Comment 2 Zohar Gal-Or 2017-11-22 08:54:41 UTC
*** Bug 1492544 has been marked as a duplicate of this bug. ***

Comment 3 Zohar Gal-Or 2017-11-22 15:02:03 UTC
Fixed in https://github.com/openshift/openshift-ansible/pull/6180

Comment 4 Junqi Zhao 2017-12-08 08:59:15 UTC
Tested with openshift-ansible-playbooks-3.8.11-1.git.0.4f5b128.el7.noarch
, issue is fixed. prometheus could be undeployed successfully now.

Please change to ON_QA

Comment 5 Junqi Zhao 2017-12-11 00:15:47 UTC
Set to VERIFIED as per Comment 4

Comment 8 errata-xmlrpc 2018-03-28 14:08:55 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/RHBA-2018:0489