Prechádzať zdrojové kódy

Merge pull request #11195 from mtnbikenc/rm-sanitize

Deprecate openshift_sanitize_inventory
Russell Teague 6 rokov pred
rodič
commit
0dff4358f7

+ 2 - 4
playbooks/init/basic_facts.yml

@@ -11,10 +11,6 @@
   roles:
   - role: openshift_facts
   tasks:
-  # TODO: Should this role be refactored into health_checks??
-  - name: Run openshift_sanitize_inventory to set variables
-    import_role:
-      name: openshift_sanitize_inventory
 
   - name: Detect OS Variant from /etc/os-release
     fail:
@@ -32,6 +28,8 @@
 
 - name: Read API URL from infra config
   hosts: "{{ l_init_fact_hosts | default('nodes') }}"
+  roles:
+  - lib_openshift
   tasks:
   - oc_obj:
       name: cluster

+ 0 - 37
roles/openshift_sanitize_inventory/README.md

@@ -1,37 +0,0 @@
-OpenShift Inventory
-===================
-
-Provides a role to validate and normalize the variables the user has
-provided. This role should run before pretty much everything else so that
-this kind of logic only has to be in one place. However, complicated
-business logic should usually be left to other roles.
-
-Requirements
-------------
-
-None
-
-Role Variables
---------------
-
-None
-
-Dependencies
-------------
-
-None
-
-Example Playbook
-----------------
-
-TODO
-
-License
--------
-
-Apache License, Version 2.0
-
-Author Information
-------------------
-
-OpenShift dev (dev@lists.openshift.redhat.com)

+ 0 - 36
roles/openshift_sanitize_inventory/action_plugins/check_deprecated.py

@@ -1,36 +0,0 @@
-"""
-Ansible action plugin to check for usage of deprecated variables in Openshift Ansible inventory files.
-"""
-
-from ansible.plugins.action import ActionBase
-
-
-# pylint: disable=too-few-public-methods
-class ActionModule(ActionBase):
-    """Action plugin to execute deprecated var checks."""
-
-    def run(self, tmp=None, task_vars=None):
-        result = super(ActionModule, self).run(tmp, task_vars)
-
-        # pylint: disable=line-too-long
-        deprecation_header = "[DEPRECATION WARNING]: The following are deprecated variables and will be no longer be used in the next minor release. Please update your inventory accordingly."
-
-        facts = self._task.args.get('facts', [])
-        dep_var_list = self._task.args.get('vars', [])
-        dep_header = self._task.args.get('header', deprecation_header)
-
-        deprecation_message = "No deprecations found"
-        is_changed = False
-
-        for param in dep_var_list:
-            if param in facts:
-                if not is_changed:
-                    deprecation_message = dep_header
-                    is_changed = True
-
-                deprecation_message = deprecation_message + "\n\t" + param
-
-        result['changed'] = is_changed
-        result['msg'] = deprecation_message
-
-        return result

+ 0 - 34
roles/openshift_sanitize_inventory/filter_plugins/openshift_sanitize_inventory.py

@@ -1,34 +0,0 @@
-'''
- Openshift Sanitize inventory class that provides useful filters used in Logging.
-'''
-
-
-import re
-
-
-def vars_with_pattern(source, pattern=""):
-    ''' Returns a list of variables whose name matches the given pattern '''
-    if source == '':
-        return list()
-
-    var_list = list()
-
-    var_pattern = re.compile(pattern)
-
-    for item in source:
-        if var_pattern.match(item):
-            var_list.append(item)
-
-    return var_list
-
-
-# pylint: disable=too-few-public-methods
-class FilterModule(object):
-    ''' OpenShift Logging Filters '''
-
-    # pylint: disable=no-self-use, too-few-public-methods
-    def filters(self):
-        ''' Returns the names of the filters provided by this class '''
-        return {
-            'vars_with_pattern': vars_with_pattern
-        }

+ 0 - 18
roles/openshift_sanitize_inventory/meta/main.yml

@@ -1,18 +0,0 @@
----
-galaxy_info:
-  author: OpenShift dev
-  description:
-  company: Red Hat, Inc.
-  license: Apache License, Version 2.0
-  min_ansible_version: 1.8
-  platforms:
-  - name: EL
-    versions:
-    - 7
-  categories:
-  - cloud
-  - system
-dependencies:
-- role: lib_utils
-- role: lib_openshift
-- role: openshift_facts

+ 0 - 16
roles/openshift_sanitize_inventory/tasks/__deprecations_logging.yml

@@ -1,16 +0,0 @@
----
-# this is used to set the logging variables from deprecated values to the current variables names
-# this file should be deleted once variables are no longer honored
-
-# - conditional_set_fact:
-#     facts: "{{ hostvars[inventory_hostname] }}"
-#     vars:
-#       new: old
-
-- set_fact:
-    openshift_logging_elasticsearch_pvc_dynamic: "{{ 'true' if openshift_logging_storage_kind | default(none) == 'dynamic' else omit if openshift_logging_storage_kind | default(none) == 'nfs' else '' }}"
-    openshift_logging_elasticsearch_pvc_size: "{{ openshift_logging_storage_volume_size | default('10Gi') if openshift_logging_storage_kind | default(none) in ['dynamic','nfs'] else ''  }}"
-    openshift_logging_elasticsearch_pvc_prefix: "{{ 'logging-es' if openshift_logging_storage_kind | default(none) == 'dynamic' else '' }}"
-    openshift_logging_elasticsearch_ops_pvc_dynamic: "{{ 'true' if openshift_loggingops_storage_kind | default(none) == 'dynamic' else '' }}"
-    openshift_logging_elasticsearch_ops_pvc_size: "{{ openshift_loggingops_storage_volume_size | default('10Gi') if openshift_loggingops_storage_kind | default(none) in ['dynamic','nfs'] else ''  }}"
-    openshift_logging_elasticsearch_ops_pvc_prefix: "{{ 'logging-es-ops' if openshift_loggingops_storage_kind | default(none) == 'dynamic' else '' }}"

+ 0 - 22
roles/openshift_sanitize_inventory/tasks/deprecations.yml

@@ -1,22 +0,0 @@
----
-# Since this task scrapes all inventory variables which may contain sensitive bits
-# mark it no_log
-- name: Check for usage of deprecated variables
-  check_deprecated:
-    facts: "{{ hostvars[inventory_hostname] }}"
-    vars: "{{ __warn_deprecated_vars }}"
-    header: "{{ __deprecation_header }}"
-  register: dep_check
-  no_log: true
-
-- block:
-  - debug: msg="{{ dep_check.msg }}"
-  - set_stats:
-      data:
-        installer_phase_initialize:
-          message: "{{ dep_check.msg }}"
-  when:
-  - dep_check.changed
-
-- name: Assign deprecated variables to correct counterparts
-  import_tasks: __deprecations_logging.yml

+ 0 - 129
roles/openshift_sanitize_inventory/tasks/main.yml

@@ -1,129 +0,0 @@
----
-# We should print out deprecations prior to any failures so that if a play does fail for other reasons
-# the user would also be aware of any deprecated variables they should note to adjust
-- include_tasks: deprecations.yml
-  when: not ( openshift_skip_deprecation_check | default(false) ) | bool
-
-- name: Standardize on latest variable names
-  set_fact:
-    deployment_subtype: "{{ openshift_deployment_subtype | default(deployment_subtype) | default('basic') | string }}"
-    openshift_deployment_subtype: "{{ openshift_deployment_subtype | default(deployment_subtype) | default('basic') | string }}"
-
-- name: Normalize openshift_release
-  set_fact:
-    # Normalize release if provided, e.g. "v3.5" => "3.5"
-    # Currently this is not required to be defined for all installs, and the
-    # `openshift_version` role can generally figure out the specific version
-    # that gets installed (e.g. 3.5.0.1). So consider this the user's expressed
-    # intent (if any), not the authoritative version that will be installed.
-    openshift_release: "{{ openshift_release | string | regex_replace('^v', '') }}"
-  when: openshift_release is defined
-
-- name: Abort when openshift_release is invalid
-  when:
-    - openshift_release is defined
-    - not (openshift_release is match('^\d+(\.\d+){1,3}$'))
-  fail:
-    msg: |-
-      openshift_release is "{{ openshift_release }}" which is not a valid version string.
-      Please set openshift_release to a version string and ensure that the value is quoted, ex: openshift_release="3.4".
-
-- include_tasks: unsupported.yml
-  when:
-    - not openshift_enable_unsupported_configurations | default(false) | bool
-
-- name: Ensure clusterid is set along with the cloudprovider
-  fail:
-    msg: >
-      Ensure that the openshift_clusterid is set and that all infrastructure has the required tags.
-
-      For dynamic provisioning when using multiple clusters in different zones, tag each node with Key=kubernetes.io/cluster/xxxx,Value=clusterid where xxxx and clusterid are unique per cluster. In versions prior to 3.6, this was Key=KubernetesCluster,Value=clusterid.
-
-      https://github.com/openshift/openshift-docs/blob/master/install_config/persistent_storage/dynamically_provisioning_pvs.adoc#available-dynamically-provisioned-plug-ins
-  when:
-    - openshift_clusterid is not defined
-    - openshift_cloudprovider_kind is defined
-    - openshift_cloudprovider_kind == 'aws'
-
-- name: Ensure ansible_service_broker_remove and ansible_service_broker_install are mutually exclusive
-  fail:
-    msg: >
-      Ensure ansible_service_broker_remove and ansible_service_broker_install are mutually exclusive,
-      do not set both to true. ansible_service_broker_install defaults to true.
-  when:
-    - ansible_service_broker_remove | default(false) | bool
-    - ansible_service_broker_install | default(true) | bool
-
-- name: Ensure template_service_broker_remove and template_service_broker_install are mutually exclusive
-  fail:
-    msg: >
-      Ensure that template_service_broker_remove and template_service_broker_install are mutually exclusive,
-      do not set both to true. template_service_broker_remove defaults to true.
-  when:
-    - template_service_broker_remove | default(false) | bool
-    - template_service_broker_install | default(true) | bool
-
-- name: Ensure that all requires vsphere configuration variables are set
-  fail:
-    msg: >
-      When the vSphere cloud provider is configured you must define all of these variables:
-      openshift_cloudprovider_vsphere_username, openshift_cloudprovider_vsphere_password,
-      openshift_cloudprovider_vsphere_host, openshift_cloudprovider_vsphere_datacenter,
-      openshift_cloudprovider_vsphere_datastore
-  when:
-    - openshift_cloudprovider_kind is defined
-    - openshift_cloudprovider_kind == 'vsphere'
-    - ( openshift_cloudprovider_vsphere_username is undefined or openshift_cloudprovider_vsphere_password is undefined or
-        openshift_cloudprovider_vsphere_host is undefined or openshift_cloudprovider_vsphere_datacenter is undefined or
-        openshift_cloudprovider_vsphere_datastore is undefined )
-
-- name: Ensure azure configuration variables are defined
-  when: openshift_cloudprovider_kind | default('none') == 'azure'
-  block:
-    - name: ensure provider configuration variables are defined
-      fail:
-        msg: >
-          Required variable(s) for azure provider not defined. Refer to documentation
-          for more information on configuring for azure provider.
-
-          https://github.com/openshift/openshift-docs/blob/master/install_config/configuring_azure.adoc
-      when: >
-        openshift_cloudprovider_azure_client_id is not defined
-        or openshift_cloudprovider_azure_client_secret is not defined
-        or openshift_cloudprovider_azure_tenant_id is not defined
-        or openshift_cloudprovider_azure_subscription_id is not defined
-        or openshift_cloudprovider_azure_resource_group is not defined
-        or openshift_cloudprovider_azure_location is not defined
-
-- name: Ensure removed web console extension variables are not set
-  fail:
-    msg: >
-      The OpenShift web console extensions must now be served as URLs. You can
-      add extensions using the openshift_web_console_extension_script_urls
-      and openshift_web_console_extension_stylesheet_urls variables. The
-      following variables are no longer used: openshift_master_extension_scripts,
-      openshift_master_extension_stylesheets, openshift_master_extensions
-  when:
-    - openshift_master_extension_scripts is defined or openshift_master_extension_stylesheets is defined or openshift_master_extensions is defined
-
-- name: Ensure that web console port matches API server port
-  fail:
-    msg: >
-      The OpenShift web console port must now match the API server port. If you
-      were previoiusly running the web console on a different port than the API
-      server, please open a support ticket.
-  when:
-    - openshift_master_console_port is defined
-    - openshift_master_console_port != openshift_master_api_port
-
-- name: At least one master is schedulable
-  fail:
-    msg: >
-      No schedulable masters found, please remove 'openshift_schedulable=False' from all of your masters.
-  when:
-    - l_master_schedulable | length > 0
-    - false in l_master_schedulable
-  vars:
-    l_masters: "{{ groups['oo_masters_to_config'] | default([]) }}"
-    l_openshift_schedulable: "{{ l_masters | map('extract', hostvars, 'openshift_schedulable') | select('defined') | list }}"
-    l_master_schedulable: "{{ l_openshift_schedulable | map('bool') | list }}"

+ 0 - 60
roles/openshift_sanitize_inventory/tasks/unsupported.yml

@@ -1,60 +0,0 @@
----
-# This task list checks for unsupported configurations. Values here should yield
-# a partially functioning cluster but would not be supported for production use.
-
-- set_fact:
-    __using_dynamic: True
-  when:
-  - hostvars[inventory_hostname][item] in ['dynamic']
-  with_items:
-  - "{{ hostvars[inventory_hostname] | vars_with_pattern(pattern='openshift_.*_storage_kind') }}"
-
-- name: Ensure that dynamic provisioning is set if using dynamic storage
-  when:
-  - dynamic_volumes_check | default(true) | bool
-  - not openshift_master_dynamic_provisioning_enabled | default(false) | bool
-  - not openshift_cloudprovider_kind is defined
-  - __using_dynamic is defined and __using_dynamic | bool
-  fail:
-    msg: |-
-      Using a storage kind of 'dynamic' without enabling dynamic provisioning nor
-      setting a cloud provider will cause generated PVCs to not be able to bind as
-      intended. Either update to not use a dynamic storage or set
-      openshift_master_dynamic_provisioning_enabled to True and set an
-      openshift_cloudprovider_kind. You can disable this check with
-      'dynamic_volumes_check=False'.
-
-#if we have registry backend as glusterfs, and we have clashing configuration.
-- name: Ensure the hosted registry's GlusterFS storage is configured correctly
-  when:
-  - openshift_hosted_registry_storage_kind | default(none) in ['glusterfs']
-  - openshift_hosted_registry_storage_glusterfs_ips is defined
-  - openshift_hosted_registry_storage_glusterfs_ips != []
-  - "'glusterfs_registry' in groups | default([])"
-  fail:
-    msg: |-
-      Configuring a value for openshift_hosted_registry_storage_glusterfs_ips and with a glusterfs_registry host group is not allowed.
-      Specifying a glusterfs_registry host group indicates that a new GlusterFS cluster should be configured, whereas
-      specifying openshift_hosted_registry_storage_glusterfs_ips indicates wanting to use a pre-configured GlusterFS cluster for the registry storage.
-
-#if we have registry backend as glusterfs and no gluster specified.
-- name: Ensure the hosted registry's GlusterFS storage is configured correctly
-  when:
-  - openshift_hosted_registry_storage_kind | default(none) in ['glusterfs']
-  - not openshift_hosted_registry_storage_glusterfs_ips is defined
-  - not 'glusterfs_registry' in groups | default([])
-  - not 'glusterfs' in groups | default([])
-  fail:
-    msg: |-
-      Configuring a value for openshift_hosted_registry_storage_kind=glusterfs without a any glusterfs option is not allowed.
-      Specify either openshift_hosted_registry_storage_glusterfs_ips variable or glusterfs, glusterfs_registry host groups.
-
-#if the user is trying to install the deprecated prometheus stack
-- name: Check for deprecated prometheus/grafana install
-  when:
-  - (openshift_hosted_prometheus_deploy | default(false) | bool) or
-    (openshift_hosted_grafana_deploy | default(false) | bool)
-  fail:
-    msg: |-
-      The inventory variables 'openshift_hosted_prometheus_deploy' and 'openshift_hosted_grafana_deploy' are no longer used.
-      See roles/openshift_cluster_monitoring_operator/README.md for information about installing Prometheus and related monitoring components.

+ 0 - 8
roles/openshift_sanitize_inventory/vars/main.yml

@@ -1,8 +0,0 @@
----
-
-__deprecation_header: "[DEPRECATION WARNING]: The following are deprecated variables and will be no longer be used in the next minor release. Please update your inventory accordingly."
-
-# this is a list of variables that we will be deprecating within the next minor release, this list should be expected to change from release to release
-__warn_deprecated_vars:
-  # logging
-  - 'openshift_logging_namespace'