diff options
-rw-r--r-- | .tito/packages/openshift-ansible | 2 | ||||
-rw-r--r-- | openshift-ansible.spec | 67 | ||||
-rw-r--r-- | roles/lib_zabbix/library/zbx_usergroup.py | 64 | ||||
-rw-r--r-- | roles/os_zabbix/vars/template_openshift_master.yml | 82 | ||||
-rw-r--r-- | utils/src/ooinstall/cli_installer.py | 7 | ||||
-rw-r--r-- | utils/src/ooinstall/variants.py | 6 | ||||
-rw-r--r-- | utils/test/cli_installer_tests.py | 12 |
7 files changed, 208 insertions, 32 deletions
diff --git a/.tito/packages/openshift-ansible b/.tito/packages/openshift-ansible index d0cca83a2..51ee78d34 100644 --- a/.tito/packages/openshift-ansible +++ b/.tito/packages/openshift-ansible @@ -1 +1 @@ -3.0.13-1 ./ +3.0.14-1 ./ diff --git a/openshift-ansible.spec b/openshift-ansible.spec index a005320af..fef7aab79 100644 --- a/openshift-ansible.spec +++ b/openshift-ansible.spec @@ -5,7 +5,7 @@ } Name: openshift-ansible -Version: 3.0.13 +Version: 3.0.14 Release: 1%{?dist} Summary: Openshift and Atomic Enterprise Ansible License: ASL 2.0 @@ -258,6 +258,71 @@ Atomic OpenShift Utilities includes %changelog +* Thu Nov 19 2015 Brenton Leanhardt <bleanhar@redhat.com> 3.0.14-1 +- added metric items to zabbix for openshift online (mwoodson@redhat.com) +- Updating usergroups to accept users (kwoodson@redhat.com) +- Differentiate machine types on GCE (master and nodes) + (romain.dossin@amadeus.com) +- Uninstall - Remove systemd wants file for node (jdetiber@redhat.com) +- ec2 - force !requiretty for ssh_user (jdetiber@redhat.com) +- small tweaks for adding docker volume for aws master hosts + (jdetiber@redhat.com) +- Created role to deploy ops host monitoring (jdiaz@redhat.com) +- Update certificate paths when 'names' key is provided. (abutcher@redhat.com) +- add a volume on master host, in AWS provisioning (chengcheng.mu@amadeus.com) +- First attempt at adding web scenarios (kwoodson@redhat.com) +- Use field numbers for all formats in bin/cluster for python 2.6 + (abutcher@redhat.com) +- atomic-openshift-installer: Correct single master case (smunilla@redhat.com) +- added copr-openshift-ansible releaser, removed old rel-eng stuff. + (twiest@redhat.com) +- changed counter -> count (mwoodson@redhat.com) +- Updating zbx_item classes to support data types for bool. + (kwoodson@redhat.com) +- Fix ec2 instance type override (jdetiber@redhat.com) +- updated my check to support the boolean data type (mwoodson@redhat.com) +- Add additive_facts_to_overwrite instead of overwriting all additive_facts + (abutcher@redhat.com) +- added healthz check and more pod count checks (mwoodson@redhat.com) +- updating to the latest ec2.py (and re-patching with our changes). + (twiest@redhat.com) +- atomic-openshift-installer: Temporarily restrict to single master + (smunilla@redhat.com) +- openshift-ansible: Correct variable (smunilla@redhat.com) +- Refactor named certificates. (abutcher@redhat.com) +- atomic-openshift-utils: Version lock playbooks (smunilla@redhat.com) +- Add the native ha services and configs to uninstall (jdetiber@redhat.com) +- Bug 1282336 - Add additional seboolean for gluster (jdetiber@redhat.com) +- Raise lifetime to 2 weeks for dynamic AWS items (jdiaz@redhat.com) +- bin/cluster fix python 2.6 issue (jdetiber@redhat.com) +- cluster list: break host types by subtype (lhuard@amadeus.com) +- README_AWS: Add needed dependency (c.witt.1900@gmail.com) +- Fix invalid sudo command test (takayoshi@gmail.com) +- Docs: Fedora: Add missing dependencies and update to dnf. (public@omeid.me) +- Gate upgrade steps for 3.0 to 3.1 upgrade (jdetiber@redhat.com) +- added the tito and copr_cli roles (twiest@redhat.com) +- pylint openshift_facts (jdetiber@redhat.com) +- Update etcd default facts setting (jdetiber@redhat.com) +- Update master facts prior to upgrading incase facts are missing. + (abutcher@redhat.com) +- pre-upgrade-check: differentiates between port and targetPort in output + (smilner@redhat.com) +- Better structure the output of the list playbook (lhuard@amadeus.com) +- Add the sub-host-type tag to the libvirt VMs (lhuard@amadeus.com) +- atomic-openshift-installer: Update nopwd sudo test (smunilla@redhat.com) +- Fix pylint import errors for utils/test/. (dgoodwin@redhat.com) +- atomic-openshift-installer: Update prompts and help messages + (smunilla@redhat.com) +- Dependencies need to be added when a create occurs on SLA object. + (kwoodson@redhat.com) +- Test additions for cli_installer:get_hosts_to_install_on + (bleanhar@redhat.com) +- adding itservice (kwoodson@redhat.com) +- remove netaddr dependency (tob@butter.sh) +- Add pyOpenSSL to dependencies for Fedora. (public@omeid.me) +- Vagrant RHEL registration cleanup (pep@redhat.com) +- RH subscription: optional satellite and pkg update (pep@redhat.com) + * Tue Nov 17 2015 Brenton Leanhardt <bleanhar@redhat.com> 3.0.13-1 - The aep3 images changed locations. (bleanhar@redhat.com) - atomic-openshift-installer: Correct single master case (smunilla@redhat.com) diff --git a/roles/lib_zabbix/library/zbx_usergroup.py b/roles/lib_zabbix/library/zbx_usergroup.py index 297d8ef91..3fd44d80c 100644 --- a/roles/lib_zabbix/library/zbx_usergroup.py +++ b/roles/lib_zabbix/library/zbx_usergroup.py @@ -27,6 +27,10 @@ zabbix ansible module for usergroups # but different for each zabbix class. # pylint: disable=duplicate-code +# Disabling too-many-branches as we need the error checking and the if-statements +# to determine the proper state +# pylint: disable=too-many-branches + # pylint: disable=import-error from openshift_tools.monitoring.zbxapi import ZabbixAPI, ZabbixConnection @@ -92,26 +96,24 @@ def get_user_status(status): return 1 -#def get_userids(zapi, users): -# ''' Get userids from user aliases -# ''' -# if not users: -# return None -# -# userids = [] -# for alias in users: -# content = zapi.get_content('user', 'get', {'search': {'alias': alias}}) -# if content['result']: -# userids.append(content['result'][0]['userid']) -# -# return userids +def get_userids(zapi, users): + ''' Get userids from user aliases + ''' + if not users: + return None + + userids = [] + for alias in users: + content = zapi.get_content('user', 'get', {'search': {'alias': alias}}) + if content['result']: + userids.append(content['result'][0]['userid']) + + return userids def main(): ''' Ansible module for usergroup ''' - ##def usergroup(self, name, rights=None, users=None, state='present', params=None): - module = AnsibleModule( argument_spec=dict( zbx_server=dict(default='https://localhost/zabbix/api_jsonrpc.php', type='str'), @@ -123,7 +125,7 @@ def main(): status=dict(default='enabled', type='str'), name=dict(default=None, type='str', required=True), rights=dict(default=None, type='list'), - #users=dict(default=None, type='list'), + users=dict(default=None, type='list'), state=dict(default='present', type='str'), ), #supports_check_mode=True @@ -144,9 +146,15 @@ def main(): {'search': {'name': uname}, 'selectUsers': 'userid', }) + #******# + # GET + #******# if state == 'list': module.exit_json(changed=False, results=content['result'], state="list") + #******# + # DELETE + #******# if state == 'absent': if not exists(content): module.exit_json(changed=False, state="absent") @@ -157,6 +165,7 @@ def main(): content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]]) module.exit_json(changed=True, results=content['result'], state="absent") + # Create and Update if state == 'present': params = {'name': uname, @@ -164,26 +173,37 @@ def main(): 'users_status': get_user_status(module.params['status']), 'gui_access': get_gui_access(module.params['gui_access']), 'debug_mode': get_debug_mode(module.params['debug_mode']), - #'userids': get_userids(zapi, module.params['users']), + 'userids': get_userids(zapi, module.params['users']), } + # Remove any None valued params _ = [params.pop(key, None) for key in params.keys() if params[key] == None] + #******# + # CREATE + #******# if not exists(content): # if we didn't find it, create it content = zapi.get_content(zbx_class_name, 'create', params) + + if content.has_key('error'): + module.exit_json(failed=True, changed=True, results=content['error'], state="present") + module.exit_json(changed=True, results=content['result'], state='present') - # already exists, we need to update it - # let's compare properties + + + ######## + # UPDATE + ######## differences = {} zab_results = content['result'][0] for key, value in params.items(): if key == 'rights': differences['rights'] = value - #elif key == 'userids' and zab_results.has_key('users'): - #if zab_results['users'] != value: - #differences['userids'] = value + elif key == 'userids' and zab_results.has_key('users'): + if zab_results['users'] != value: + differences['userids'] = value elif zab_results[key] != value and zab_results[key] != str(value): differences[key] = value diff --git a/roles/os_zabbix/vars/template_openshift_master.yml b/roles/os_zabbix/vars/template_openshift_master.yml index 174486e15..512adad4c 100644 --- a/roles/os_zabbix/vars/template_openshift_master.yml +++ b/roles/os_zabbix/vars/template_openshift_master.yml @@ -13,6 +13,12 @@ g_template_openshift_master: applications: - Openshift Master + - key: openshift.master.api.ping + description: "Verify that the Openshift API is up" + type: int + applications: + - Openshift Master + - key: openshift.master.api.healthz description: "Checks the healthz check of the master's api: https://master_host/healthz" type: int @@ -44,6 +50,12 @@ g_template_openshift_master: applications: - Openshift Master + - key: openshift.master.node.count + description: Shows the total number of nodes found in the Openshift Cluster + type: int + applications: + - Openshift Master + - key: openshift.project.count description: Shows number of projects on a cluster type: int @@ -122,6 +134,66 @@ g_template_openshift_master: applications: - Openshift Etcd + - key: openshift.master.metric.ping + description: "This check verifies that the https://master/metrics check is alive and communicating properly." + type: int + applications: + - Openshift Master Metrics + + - key: openshift.master.apiserver.latency.summary.pods.quantile.list.5 + description: "Value from https://master/metrics. This is the time, in miliseconds, that 50% of the pod operations have taken to completed." + type: int + applications: + - Openshift Master Metrics + + - key: openshift.master.apiserver.latency.summary.pods.quantile.list.9 + description: "Value from https://master/metrics. This is the time, in miliseconds, that 90% of the pod operations have taken to completed." + type: int + applications: + - Openshift Master Metrics + + - key: openshift.master.apiserver.latency.summary.pods.quantile.list.99 + description: "Value from https://master/metrics. This is the time, in miliseconds, that 99% of the pod operations have taken to completed." + type: int + applications: + - Openshift Master Metrics + + - key: openshift.master.apiserver.latency.summary.pods.quantile.watchlist.5 + description: "Value from https://master/metrics. This is the time, in miliseconds, that 50% of the pod operations have taken to completed." + type: int + applications: + - Openshift Master Metrics + + - key: openshift.master.apiserver.latency.summary.pods.quantile.watchlist.9 + description: "Value from https://master/metrics. This is the time, in miliseconds, that 90% of the pod operations have taken to completed." + type: int + applications: + - Openshift Master Metrics + + - key: openshift.master.apiserver.latency.summary.pods.quantile.watchlist.99 + description: "Value from https://master/metrics. This is the time, in miliseconds, that 99% of the pod operations have taken to completed." + type: int + applications: + - Openshift Master Metrics + + - key: openshift.master.scheduler.e2e.scheduling.latency.quantile.5 + description: "Value from https://master/metrics. This is the time, in miliseconds, that 50% of the end to end scheduling operations have taken to completed." + type: int + applications: + - Openshift Master Metrics + + - key: openshift.master.scheduler.e2e.scheduling.latency.quantile.9 + description: "Value from https://master/metrics. This is the time, in miliseconds, that 90% of the end to end scheduling operations have taken to completed." + type: int + applications: + - Openshift Master Metrics + + - key: openshift.master.scheduler.e2e.scheduling.latency.quantile.99 + description: "Value from https://master/metrics. This is the time, in miliseconds, that 99% of the end to end scheduling operations have taken to completed." + type: int + applications: + - Openshift Master Metrics + ztriggers: - name: 'Application creation has failed on {HOST.NAME}' expression: '{Template Openshift Master:create_app.last(#1)}=1 and {Template Openshift Master:create_app.last(#2)}=1' @@ -133,6 +205,16 @@ g_template_openshift_master: url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' priority: high + - name: 'Openshift Master API PING check is failing on {HOST.NAME}' + expression: '{Template Openshift Master:openshift.master.api.ping.max(#3)}<1' + url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' + priority: high + + - name: 'Openshift Master metric PING check is failing on {HOST.NAME}' + expression: '{Template Openshift Master:openshift.master.metric.ping.max(#3)}<1' + url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' + priority: avg + - name: 'Openshift Master process not running on {HOST.NAME}' expression: '{Template Openshift Master:openshift.master.process.count.max(#3)}<1' url: 'https://github.com/openshift/ops-sop/blob/master/V3/Alerts/openshift_master.asciidoc' diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index f34255234..a1632ed0c 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -207,6 +207,7 @@ def get_variant_and_version(): message = "%s\n(%s) %s %s" % (message, i, variant.description, version.name) i = i + 1 + message = "%s\n" % message click.echo(message) response = click.prompt("Choose a variant from above: ", default=1) @@ -433,7 +434,8 @@ def get_hosts_to_run_on(oo_cfg, callback_facts, unattended, force, verbose): # Main CLI entrypoint, not much we can do about too many arguments. def cli(ctx, unattended, configuration, ansible_playbook_directory, ansible_config, ansible_log_path, verbose): """ - atomic-openshift-installer makes the process for installing OSE or AEP easier by interactively gathering the data needed to run on each host. + atomic-openshift-installer makes the process for installing OSE or AEP + easier by interactively gathering the data needed to run on each host. It can also be run in unattended mode if provided with a configuration file. Further reading: https://docs.openshift.com/enterprise/latest/install_config/install/quick_install.html @@ -460,7 +462,8 @@ def cli(ctx, unattended, configuration, ansible_playbook_directory, ansible_conf if ctx.obj['ansible_config']: oo_cfg.settings['ansible_config'] = ctx.obj['ansible_config'] - elif os.path.exists(DEFAULT_ANSIBLE_CONFIG): + elif 'ansible_config' not in oo_cfg.settings and \ + os.path.exists(DEFAULT_ANSIBLE_CONFIG): # If we're installed by RPM this file should exist and we can use it as our default: oo_cfg.settings['ansible_config'] = DEFAULT_ANSIBLE_CONFIG diff --git a/utils/src/ooinstall/variants.py b/utils/src/ooinstall/variants.py index 3bb61dddb..571025543 100644 --- a/utils/src/ooinstall/variants.py +++ b/utils/src/ooinstall/variants.py @@ -30,14 +30,14 @@ class Variant(object): self.versions = versions def latest_version(self): - return self.versions[-1] + return self.versions[0] # WARNING: Keep the versions ordered, most recent last: OSE = Variant('openshift-enterprise', 'OpenShift Enterprise', [ - Version('3.0', 'enterprise'), - Version('3.1', 'openshift-enterprise') + Version('3.1', 'openshift-enterprise'), + Version('3.0', 'enterprise') ] ) diff --git a/utils/test/cli_installer_tests.py b/utils/test/cli_installer_tests.py index fc16d9ceb..baadad358 100644 --- a/utils/test/cli_installer_tests.py +++ b/utils/test/cli_installer_tests.py @@ -284,7 +284,9 @@ class UnattendedCliTests(OOCliFixture): '.ansible/callback_facts.yaml'), env_vars['OO_INSTALL_CALLBACK_FACTS_YAML']) self.assertEqual('/tmp/ansible.log', env_vars['ANSIBLE_LOG_PATH']) - self.assertTrue('ANSIBLE_CONFIG' not in env_vars) + # If user running test has rpm installed, this might be set to default: + self.assertTrue('ANSIBLE_CONFIG' not in env_vars or + env_vars['ANSIBLE_CONFIG'] == cli.DEFAULT_ANSIBLE_CONFIG) # Make sure we ran on the expected masters and nodes: hosts = run_playbook_mock.call_args[0][0] @@ -450,14 +452,18 @@ class UnattendedCliTests(OOCliFixture): if expected_result: self.assertEquals(expected_result, facts_env_vars['ANSIBLE_CONFIG']) else: - self.assertFalse('ANSIBLE_CONFIG' in facts_env_vars) + # If user running test has rpm installed, this might be set to default: + self.assertTrue('ANSIBLE_CONFIG' not in facts_env_vars or + facts_env_vars['ANSIBLE_CONFIG'] == cli.DEFAULT_ANSIBLE_CONFIG) # Test the env vars for main playbook: env_vars = run_ansible_mock.call_args[0][2] if expected_result: self.assertEquals(expected_result, env_vars['ANSIBLE_CONFIG']) else: - self.assertFalse('ANSIBLE_CONFIG' in env_vars) + # If user running test has rpm installed, this might be set to default: + self.assertTrue('ANSIBLE_CONFIG' not in env_vars or + env_vars['ANSIBLE_CONFIG'] == cli.DEFAULT_ANSIBLE_CONFIG) class AttendedCliTests(OOCliFixture): |