Bug 1328119

Summary: router selector not obeyed
Product: OKD Reporter: Aleksandar Kostadinov <akostadi>
Component: InstallerAssignee: Andrew Butcher <abutcher>
Status: CLOSED CURRENTRELEASE QA Contact: Ma xiaoqiang <xiama>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, jialiu, mmccomas, xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 17:15:38 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:

Description Aleksandar Kostadinov 2016-04-18 13:55:44 UTC
Description of problem:
In  BYO playbook inventory I provide:

> openshift_router_selector='region=infra,zone=router'

Later in ansible log I see

> "router_selector": "region=infra,zone=router"

But at the end I see:

> TASK: [openshift_hosted | Create OpenShift router] ****************************
> changed: [ec2-52-90-203-180.compute-1.amazonaws.com] => {"changed": true, "cmd": ["/usr/local/bin/oadm", "router", "--create", "--replicas=4", "--namespace=default", "--service-account=router", "--selector=region=infra", "--credentials=/etc/origin/master/openshift-router.kubeconfig"], "delta": "0:00:04.623892", "end": "2016-04-18 12:44:12.223553", "rc": 0, "start": "2016-04-18 12:44:07.599661", "stderr": "\n================================================================================\nATTENTION: You are running oadm via a wrapper around 'docker run openshift3/ose:v3.2.0.15'.\nThis wrapper is intended only to be used to bootstrap an environment. Please\ninstall client tools on another host once you have granted cluster-admin\nprivileges to a user. \nSee https://docs.openshift.com/enterprise/latest/cli_reference/get_started_cli.html\n=================================================================================\n\nFlag --credentials has been deprecated, use --service-account to specify the service account the router will use to make API calls\ninfo: password for stats user admin has been set to 7su3ZkKZK4", "stdout": "deploymentconfig \"router\" created\nservice \"router\" created", "stdout_lines": ["deploymentconfig \"router\" created", "service \"router\" created"], "warnings": []}


Basically selector is always `region=infra`.

Version-Release number of selected component (if applicable):
openshift-origin playbook git rev 2f4689814d
openshift v3.2.0.15
installation on atomic-host

How reproducible:
always

Comment 2 Jason DeTiberus 2016-04-18 21:04:32 UTC
Looks like openshift_master_facts and the provider playbooks reference openshift_router_selector and the byo documentation and openshift_hosted readme reference openshift_hosted_router_selector.

Comment 4 Aleksandar Kostadinov 2016-04-19 13:55:07 UTC
Also we need router replicas to be set based on number of nodes with the desired selector. I will test and report back tomorrow if this is already the case.

Comment 5 Andrew Butcher 2016-04-19 14:00:20 UTC
Unless replicas are specified (openshift_hosted_router_replicas=X), the replicas will be the number of nodes matching the selector provided. It looks like the filter that counts nodes isn't returning any matches so I'm going to run the logged json through the filters and see what isn't catching.

Comment 7 Aleksandar Kostadinov 2016-04-19 14:35:46 UTC
In fact - yes, seems like somebody installed the RPMs again or I removed from another machine. I'll test it tomorrow again. Thank you.

Comment 8 Andrew Butcher 2016-04-20 16:19:38 UTC
Proposed fix: https://github.com/openshift/openshift-ansible/pull/1766

Comment 9 Andrew Butcher 2016-04-20 18:41:19 UTC
*** Bug 1328902 has been marked as a duplicate of this bug. ***

Comment 10 Johnny Liu 2016-04-21 11:18:22 UTC
Verified this bug with the latest PR, and PASS.

Inventory file:
openshift_hosted_router_selector="region=primary,zone=default"

Ansible Output:
TASK: [openshift_hosted | Collect nodes matching router selector] ************* 
ok: [x.x.x.x] => {"ansible_facts": {"openshift_hosted_router_nodes": ["qe-jialiu-node-registry-router-1"]}}

TASK: [openshift_hosted | Create OpenShift router] **************************** 
changed: [x.x.x.x] => {"changed": true, "cmd": ["oadm", "router", "--create", "--replicas=1", "--namespace=default", "--service-account=router", "--selector=region=primary,zone=default", "--credentials=/etc/origin/master/openshift-router.kubeconfig", "--images=registry.qe.openshift.com/openshift3/ose-${component}:${version}"], "delta": "0:00:00.353303", "end": "2016-04-21 07:14:59.799366", "rc": 0, "start": "2016-04-21 07:14:59.446063", "stderr": "Flag --credentials has been deprecated, use --service-account to specify the service account the router will use to make API calls\ninfo: password for stats user admin has been set to CmVu23Oaj6", "stdout": "deploymentconfig \"router\" created\nservice \"router\" created", "stdout_lines": ["deploymentconfig \"router\" created", "service \"router\" created"], "warnings": []}

Comment 11 Aleksandar Kostadinov 2016-04-21 15:12:53 UTC
confirming the above with current master (006e52034)