Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1441915

Summary: Failed to deploy metrics by steps in OpenShift 3.5 formal documentation
Product: OpenShift Container Platform Reporter: Xia Zhao <xiazhao>
Component: HawkularAssignee: Russell Teague <rteague>
Status: CLOSED ERRATA QA Contact: Liming Zhou <lizhou>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 3.5.0CC: anli, aos-bugs, jialiu, jokerman, juzhao, lizhou, mmccomas, pruan, rteague, wsun
Target Milestone: ---   
Target Release: 3.5.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
If this bug requires documentation, please select an appropriate Doc Type value.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-25 17:43:02 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
logs for cassandra pod failed to start. none

Description Xia Zhao 2017-04-13 05:39:37 UTC
Description of problem:
Openshift-ansible need a playbook to deployer metrics with openshift-ansible inventory file. Without this file, we can't deploy metrics following the documents [1] and [2].

The file may be similar with /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/openshift-logging.yml.

Version-Release number of selected component (if applicable):
openshift-ansible-3.5.53-1.git.0.8ade9f2.el7.noarch

How reproducible:
Always

Steps to Reproduce:
1. specify inventory file 
[OSEv3:vars]

openshift_metrics_install_metrics=true 
openshift_metrics_hawkular_hostname=<fqdn> 
openshift_metrics_cassandra_storage_type=(emptydir|pv|dynami
2. run playbook
ansible-playbook <OPENSHIFT_ANSIBLE_DIR>/common/openshift-cluster/openshift_metrics.yml \
   -e openshift_metrics_install_metrics=True \
   -e openshift_metrics_hawkular_hostname=hawkular-metrics.example.com
   
Actual results:
The metrics can't be deployed for there isn't group oo_first_master which is used in common/openshift-cluster/openshift_metrics.yml


Expected results
There should be playbook /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/openshift-matrics.yml which is similar with /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/openshift-logging.yml

Additional info:
[1]https://docs.openshift.com/container-platform/3.5/install_config/cluster_metrics.html#deploying-the-metrics-components 
[2]https://docs.openshift.com/container-platform/3.5/install_config/upgrading/manual_upgrades.html#manual-upgrading-cluster-metrics

Comment 1 Scott Dodson 2017-04-18 18:41:10 UTC
Temporary workaround that should be reverted as soon as we fix this bug :

Add a group named [oo_first_master] with your first master and then run playbooks/common/openshift-cluster/openshift_metrics.yml

Comment 2 Russell Teague 2017-04-18 18:49:30 UTC
Proposed: https://github.com/openshift/openshift-ansible/pull/3948
Will need to backport this to 3.5.

Comment 3 Russell Teague 2017-04-19 00:14:55 UTC
Merged https://github.com/openshift/openshift-ansible/pull/3948

Comment 4 Liming Zhou 2017-04-19 02:49:37 UTC
Russell,

I cloned the repo "openshift-ansible" to local test server, then use following inventory for metrics:
[root@host-8-175-224 ~]# cat inventory_metrics 
[OSEv3:children]
masters

[masters]
host-8-175-206.host.centralci.eng.rdu2.redhat.com openshift_public_hostname=host-8-175-206.host.centralci.eng.rdu2.redhat.com

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

openshift_metrics_install_metrics=true
openshift_metrics_hawkular_hostname=hawkular-metrics.0418-bzl.qe.rhcloud.com
openshift_metrics_project=openshift-infra

openshift_metrics_image_prefix=registry.ops.openshift.com/openshift3/
openshift_metrics_image_version=3.5.0

openshift_metrics_cassandra_storage_type=emptydir

Then setup metrics by:
# ansible-playbook -i /root/inventory_metrics openshift-ansible/playbooks/byo/openshift-cluster/openshift-metrics.yml

Th setup seems works well, but the cassandra pod finally failed to start with the status "CrashLoopBackOff".
You can find the detail logs "logs_1441915_CrashLoopBackOff.txt" from the attachment.
Do you know what's wrong cause the failure?

Thanks,
Nicholas

Comment 5 Liming Zhou 2017-04-19 02:51:03 UTC
Created attachment 1272461 [details]
logs for cassandra pod failed to start.

Comment 6 Liming Zhou 2017-04-19 09:23:35 UTC
Second issue I found is if I use the template mentioned in OCP 3.5 doc "https://docs.openshift.com/container-platform/3.5/install_config/cluster_metrics.html#deploying-the-metrics-components", it will failed, see:
# ansible-playbook -i /root/inventory_metrics openshift-ansible/playbooks/common/openshift-cluster/openshift_metrics.yml

PLAY [Populate config host groups] *********************************************

TASK [fail] ********************************************************************
fatal: [localhost]: FAILED! => {
    "changed": false, 
    "failed": true
}

MSG:

This playbook requires g_etcd_hosts to be set

	to retry, use: --limit @/root/openshift-ansible/playbooks/common/openshift-cluster/openshift_metrics.retry

PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1   

So should we update the doc for deploy metrics like:
FROM:
$ ansible-playbook <OPENSHIFT_ANSIBLE_DIR>/common/openshift-cluster/openshift_metrics.yml \
   -e openshift_metrics_install_metrics=True \
   -e openshift_metrics_hawkular_hostname=hawkular-metrics.example.com \
   -e openshift_metrics_cassandra_storage_type=pv
TO:
$ ansible-playbook <OPENSHIFT_ANSIBLE_DIR>/byo/openshift-cluster/openshift-metrics.yml \
   -e openshift_metrics_install_metrics=True \
   -e openshift_metrics_hawkular_hostname=hawkular-metrics.example.com \
   -e openshift_metrics_cassandra_storage_type=pv
OR TO(to keep consistency with deploy logging):
$ ansible-playbook [-i </path/to/inventory>] \
    /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/openshift-metrics.yml

If yes, I will open another PR for the doc changes.

Comment 7 Russell Teague 2017-04-19 12:30:11 UTC
Nicholas,
The first issue with Cassandra appears to be unrelated to the change in entry point playbooks.  If that problem continues open another issue.

You are correct about the second issue in the docs.  The correct playbooks to run are from playbooks/byo/openshift-cluster.

Comment 8 Russell Teague 2017-04-19 13:40:52 UTC
Proposed fix for 3.5 (release-1.5 branch) https://github.com/openshift/openshift-ansible/pull/3953
This PR is different from the commits to master due to the playbook refactoring which has happened on master for 3.6.

Comment 9 Peter Ruan 2017-04-19 18:03:06 UTC
Liming,
  FYI, the correct playbook is under the byo directory, the QE automation has this 

https://github.com/openshift/cucushift/blob/v3/features/step_definitions/logging_metrics.rb#L280

Comment 10 Peter Ruan 2017-04-19 19:32:03 UTC
Russell,
  Looks like there is an issue wit the byo playbook for metrics as it is complaining about the errors with the ansible generated cert 

 <openshift-127.lab.sjc.redhat.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="/tmp/tmp/libra.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/opt/app-root/src/.ansible/cp/ansible-ssh-%h-%p-%r -tt openshift-127.lab.sjc.redhat.com '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1492629881.83-254965767611179/command.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1492629881.83-254965767611179/" > /dev/null 2>&1 && sleep 0'"'"''
      fatal: [openshift-127.lab.sjc.redhat.com]: FAILED! => {
          "changed": true,
          "cmd": [
              "oadm",
              "ca",
              "create-server-cert",
              "--config=/tmp/openshift-metrics-ansible-HDBPf7/admin.kubeconfig",
              "--key=/tmp/openshift-metrics-ansible-HDBPf7/heapster.key",
              "--cert=/tmp/openshift-metrics-ansible-HDBPf7/heapster.cert",
              "--hostnames=heapster",
              "--signer-cert=/tmp/openshift-metrics-ansible-HDBPf7/ca.crt",
              "--signer-key=/tmp/openshift-metrics-ansible-HDBPf7/ca.key",
              "--signer-serial=/tmp/openshift-metrics-ansible-HDBPf7/ca.serial.txt"
          ],
          "delta": "0:00:00.260178",
          "end": "2017-04-19 15:24:42.338261",
          "failed": true,
          "invocation": {
              "module_args": {
                  "_raw_params": "oadm ca create-server-cert --config=/tmp/openshift-metrics-ansible-HDBPf7/admin.kubeconfig --key='/tmp/openshift-metrics-ansible-HDBPf7/heapster.key' --cert='/tmp/openshift-metrics-ansible-HDBPf7/heapster.cert' --hostnames=heapster --signer-cert='/tmp/openshift-metrics-ansible-HDBPf7/ca.crt' --signer-key='/tmp/openshift-metrics-ansible-HDBPf7/ca.key' --signer-serial='/tmp/openshift-metrics-ansible-HDBPf7/ca.serial.txt'",
                  "_uses_shell": false,
                  "chdir": null,
                  "creates": null,
                  "executable": null,
                  "removes": null,
                  "warn": true
              },
              "module_name": "command"
          },
          "rc": 1,
          "start": "2017-04-19 15:24:42.078083",
          "stderr": "error: --signer-cert, \"/tmp/openshift-metrics-ansible-HDBPf7/ca.crt\" must be a valid certificate file\nSee 'oadm ca create-server-cert -h' for help and examples.",
          "stdout": "",
          "stdout_lines": [],
          "warnings": []
      }
        to retry, use: --limit @/tmp/tmp/openshift-ansible/playbooks/byo/openshift-cluster/openshift-metrics.retry
 
      PLAY RECAP *********************************************************************
      localhost                  : ok=1    changed=0    unreachable=0    failed=0
      openshift-127.lab.sjc.redhat.com : ok=28   changed=0    unreachable=0    failed=1

Comment 11 Scott Dodson 2017-04-19 20:44:49 UTC
Peter,

What's the inventory look like? I cannot reproduce that.

Comment 12 Liming Zhou 2017-04-20 03:54:49 UTC
Russell,

Got it, thanks.
I will do test again to see if the cassandra issues exist or not, will open BUG for it if still exist.

By the way, will the openshift doc update per this bug or should I open another BUG for the doc to update?

Thanks,
Nicholas

Comment 13 Liming Zhou 2017-04-20 06:48:01 UTC
Russell,

About the first issue mentioned in this bug which the cassandra failed startup, Per the info in link "https://github.com/openshift/openshift-ansible/pull/3953", I ran "git clone https://github.com/openshift/openshift-ansible -b release-1.5" to clone to the code to local, then deploy metrics with template under byo:
# ansible-playbook -i inventory_metrics openshift-ansible/playbooks/byo/openshift-cluster/openshift-metrics.yml 
All works well.

And I compare the file under branch "master" and branch "release-1.5", confirmed the updates in "release-1.5" still not exist in branch "master", and verified use the template file in branch "master" will cause the cassandra failed to start. 
So do you know when the update will push to branch "master"?

The test env version is here:
[root@host-8-175-108 ~]# openshift version
openshift v3.5.5.5
kubernetes v1.5.2+43a9be4
etcd 3.1.0
[root@host-8-175-108 ~]# rpm -qa|grep openshift-ansible
openshift-ansible-3.5.55-1.git.0.29802ee.el7.noarch
openshift-ansible-roles-3.5.55-1.git.0.29802ee.el7.noarch
openshift-ansible-docs-3.5.55-1.git.0.29802ee.el7.noarch
openshift-ansible-lookup-plugins-3.5.55-1.git.0.29802ee.el7.noarch
openshift-ansible-callback-plugins-3.5.55-1.git.0.29802ee.el7.noarch
openshift-ansible-playbooks-3.5.55-1.git.0.29802ee.el7.noarch
openshift-ansible-filter-plugins-3.5.55-1.git.0.29802ee.el7.noarch

Thanks,
Nicholas

Comment 14 Johnny Liu 2017-04-20 07:00:39 UTC
@Russell, we should build a 3.5 openshift-ansible rpm package to include that fix, and attach the rpm to advisory, then move this bug to ON_QA, is that our work flow, right?

Comment 15 Liming Zhou 2017-04-20 07:09:20 UTC
@Russell,

I changed the status to "MODIFIED", when the rpm ready, you change to "ON_QA" so we can start to do test with rpm pkgs.

Thanks,
Nicholas

Comment 16 Peter Ruan 2017-04-20 15:44:43 UTC
@Scott,
  I've filed another bug https://bugzilla.redhat.com/show_bug.cgi?id=1443741 since it seems to be inventory file related.

Comment 17 Russell Teague 2017-04-20 17:19:55 UTC
The patch for #3953 is in 3.5.56.

$ git tag --contains 8ba61987ca972c8fbe186cd12ef04394a311c2dd
openshift-ansible-3.5.56-1
openshift-ansible-3.5.57-1

Comment 18 Liming Zhou 2017-04-24 07:01:58 UTC
Russell,

During latest OCP testing, the openshift ansible version is 3.5.57-1, the test of deploy metrics with following command:
ansible-playbook -i ./ansible_inventory_file -v /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/openshift-metrics.yml 

The deploy works well, all the services and pods are up and running.
So this can verify the fix.
So I'd like to change the status to verified. Let me know if anything more need to do per this bug.

Thanks,
Nicholas

Comment 19 Liming Zhou 2017-04-25 05:04:01 UTC
Russell,

I saw the 3.5 doc still use "playbooks/common":
https://docs.openshift.com/container-platform/3.5/install_config/cluster_metrics.html#deploying-the-metrics-components

So should I open another bug for the doc need to update to use "playbooks/byo" instead of "playbooks/common"?

Thanks,
Nicholas

Comment 20 Russell Teague 2017-04-25 15:38:17 UTC
Yep, docs should point to playbooks/byo.

Comment 22 errata-xmlrpc 2017-04-25 17:43:02 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-2017:1140