diff --git a/.delivery/project.toml b/.delivery/project.toml deleted file mode 100644 index 4066e55..0000000 --- a/.delivery/project.toml +++ /dev/null @@ -1,9 +0,0 @@ -[local_phases] -unit = 'rspec spec/' -lint = 'cookstyle --display-cop-names --extra-details' -syntax = "berks install -e integration" -provision = "echo skipping" -deploy = "echo skipping" -smoke = "echo skipping" -functional = "echo skipping" -cleanup = "echo skipping" diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d7ee44a..0000000 --- a/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.bundle/ -berks-cookbooks/ -.kitchen -.vagrant -.coverage/ -*.swp -Berksfile.lock -Vagrantfile -Gemfile.lock diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index 389f270..0000000 --- a/.rubocop.yml +++ /dev/null @@ -1,4 +0,0 @@ -Chef/Modernize/FoodcriticComments: - Enabled: true -Chef/Style/CopyrightCommentFormat: - Enabled: true diff --git a/.zuul.yaml b/.zuul.yaml deleted file mode 100644 index f578684..0000000 --- a/.zuul.yaml +++ /dev/null @@ -1,3 +0,0 @@ -- project: - templates: - - openstack-chef-jobs diff --git a/Berksfile b/Berksfile deleted file mode 100644 index 593dcbd..0000000 --- a/Berksfile +++ /dev/null @@ -1,22 +0,0 @@ -source 'https://supermarket.chef.io' - -solver :ruby, :required - -[ - %w(client dep), - %w(-common dep), - %w(-identity dep), - %w(-image integration), - %w(-integration-test integration), - %w(-network dep), - %w(-ops-database integration), - %w(-ops-messaging integration), -].each do |cookbook, group| - if Dir.exist?("../cookbook-openstack#{cookbook}") - cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: group - else - cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}", group: group - end -end - -metadata diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 68c771a..0000000 --- a/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - diff --git a/README.rst b/README.rst index 1319feb..4ee2c5f 100644 --- a/README.rst +++ b/README.rst @@ -1,139 +1,10 @@ -OpenStack Chef Cookbook - dns -============================= +This project is no longer maintained. -.. image:: https://governance.openstack.org/badges/cookbook-openstack-dns.svg - :target: https://governance.openstack.org/reference/tags/index.html +The contents of this repository are still available in the Git +source code management system. To see the contents of this +repository before it reached its end of life, please check out the +previous commit with "git checkout HEAD^1". -Description -=========== - -This cookbook installs the OpenStack DNS service **Designate** as part -of an OpenStack reference deployment Chef for OpenStack. The `OpenStack -chef-repo`_ contains documentation for using this cookbook in the -context of a full OpenStack deployment. Designate is currently installed -from packages. - -.. _OpenStack chef-repo: https://opendev.org/openstack/openstack-chef - -https://docs.openstack.org/designate/latest/ - -Requirements -============ - -- Chef 16 or higher -- Chef Workstation 21.10.640 for testing (also includes Berkshelf for - cookbook dependency resolution) - -Platform -======== - -- ubuntu -- redhat -- centos - -Cookbooks -========= - -The following cookbooks are dependencies: - -- 'openstackclient' -- 'openstack-common', '>= 20.0.0' -- 'openstack-identity', '>= 20.0.0' -- 'openstack-network', '>= 20.0.0' - -Attributes -========== - -Please see the extensive inline documentation in ``attributes/*.rb`` for -descriptions of all the settable attributes for this cookbook. - -Note that all attributes are in the ``default['openstack']`` "namespace" - -The usage of attributes to generate the ``designate.conf`` is described -in the openstack-common cookbook. - -Recipes -======= - -openstack-dns::api ------------------- - -- Configure and start designate-api service - -openstack-dns::central ----------------------- - -- Starts and enables the designate-central service - -openstack-dns::common ---------------------- - -- Installs the designate packages and setup configuration for Designate. - -openstack-dns::dashboard ------------------------- - -- Installs the designate dashboard packages. - -openstack-dns::identity_registration ------------------------------------- - -- Registers the Designate API endpoint, designate service and user - -openstack-dns::mdns -------------------- - -- Starts and enables the designate-mdns service - -openstack-dns::neutron_int --------------------------- - -- Configure the neutron external dns driver - -openstack-dns::producer ------------------------ - -- Starts and enables the designate-producer service - -openstack-dns::sink -------------------- - -- Starts and enables the designate-sink service - -openstack-dns::worker ---------------------- - -- Starts and enables the designate-worker service - -License and Author -================== - -+-----------------+-----------------------------------------+ -| **Author** | Dr. Jens Harbott (j.harbott@x-ion.de) | -+-----------------+-----------------------------------------+ -| **Author** | Jan Klare (j.klare@cloudbau.de) | -+-----------------+-----------------------------------------+ -| **Author** | Lance Albertson (lance@osuosl.org) | -+-----------------+-----------------------------------------+ - -+-----------------+--------------------------------------------------+ -| **Copyright** | Copyright (c) 2017-2019, x-ion GmbH. | -+-----------------+--------------------------------------------------+ -| **Copyright** | Copyright (c) 2017, cloudbau GmbH. | -+-----------------+--------------------------------------------------+ -| **Copyright** | Copyright (c) 2019-2021, Oregon State University | -+-----------------+--------------------------------------------------+ - -Licensed under the Apache License, Version 2.0 (the "License"); you may -not use this file except in compliance with the License. You may obtain -a copy of the License at - -:: - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +For any further questions, please email +openstack-discuss@lists.openstack.org or join #openstack-dev on +OFTC. diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 5dd6ad1..0000000 --- a/Rakefile +++ /dev/null @@ -1,39 +0,0 @@ -task default: ['test'] - -task test: [:lint, :style, :unit] - -desc 'Vendor the cookbooks in the Berksfile' -task :berks_prep do - sh %(chef exec berks vendor) -end - -desc 'Run FoodCritic (lint) tests' -task :lint do - sh %(chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .) -end - -desc 'Run RuboCop (style) tests' -task :style do - sh %(chef exec cookstyle) -end - -desc 'Run RSpec (unit) tests' -task unit: :berks_prep do - sh %(chef exec rspec --format documentation) -end - -desc 'Remove the berks-cookbooks directory and the Berksfile.lock' -task :clean do - rm_rf [ - 'berks-cookbooks', - 'Berksfile.lock', - ] -end - -desc 'All-in-One Neutron build Infra using Common task' -task :integration do - # Use the common integration task - sh %(wget -nv -t 3 -O https://opendev.org/openstack/cookbook-openstack-common/raw/branch/master/Rakefile) - load './Rakefile-Common' - Rake::Task['common_integration'].invoke -end diff --git a/TESTING.md b/TESTING.md deleted file mode 100644 index 328cc4b..0000000 --- a/TESTING.md +++ /dev/null @@ -1,31 +0,0 @@ -# Testing the Cookbook # - -This cookbook uses [chefdk](https://downloads.chef.io/chef-dk/) and [berkshelf](https://berkshelf.com/) to isolate dependencies. Make sure you have chefdk and the header files for `gecode` installed before continuing. Make sure that you're using gecode version 3. More info [here](https://github.com/opscode/dep-selector-libgecode/tree/0bad63fea305ede624c58506423ced697dd2545e#using-a-system-gecode-instead). For more detailed information on what needs to be installed, you can have a quick look into the bootstrap.sh file in this repository, which does install all the needed things to get going on ubuntu trusty. The tests defined in the Rakefile include lint, style and unit. For integration testing please refere to the [openstack-chef-repo](https://github.com/openstack/openstack-chef-repo). - -We have three test suites which you can run either, individually (there are three rake tasks): - - $ chef exec rake lint - $ chef exec rake style - $ chef exec rake unit - -or altogether: - - $ chef exec rake - -The `rake` tasks will take care of installing the needed cookbooks with `berkshelf`. - -## Rubocop ## - -[Rubocop](https://github.com/bbatsov/rubocop) is a static Ruby code analyzer, based on the community [Ruby style guide](https://github.com/bbatsov/ruby-style-guide). We are attempting to adhere to this where applicable, slowly cleaning up the cookbooks until we can turn on Rubocop for gating the commits. - -## Foodcritic ## - -[Foodcritic](https://acrmp.github.io/foodcritic/) is a lint tool for Chef cookbooks. We ignore the following rules: - -* [FC003](https://acrmp.github.io/foodcritic/#FC003) These cookbooks are not intended for Chef Solo. -* [FC023](https://acrmp.github.io/foodcritic/#FC023) Prefer conditional attributes. - -## Chefspec - -[ChefSpec](https://github.com/sethvargo/chefspec) is a unit testing framework for testing Chef cookbooks. ChefSpec makes it easy to write examples and get fast feedback on cookbook changes without the need for virtual machines or cloud servers. - diff --git a/attributes/default.rb b/attributes/default.rb deleted file mode 100644 index 563d5ce..0000000 --- a/attributes/default.rb +++ /dev/null @@ -1,93 +0,0 @@ -# -# Cookbook:: openstack-dns -# Attributes:: default -# -# Copyright:: 2017-2021, x-ion GmbH -# Copyright:: 2017-2021, cloudbau GmbH -# Copyright:: 2019-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -%w(public internal).each do |ep_type| - # openstack dns-api service endpoints (used by users and services) - default['openstack']['endpoints'][ep_type]['dns-api']['host'] = '127.0.0.1' - default['openstack']['endpoints'][ep_type]['dns-api']['scheme'] = 'http' - default['openstack']['endpoints'][ep_type]['dns-api']['port'] = 9001 -end -default['openstack']['bind_service']['all']['dns-api']['host'] = '127.0.0.1' -default['openstack']['bind_service']['all']['dns-api']['port'] = 9001 - -# Set to some text value if you want templated config files -# to contain a custom banner at the top of the written file -default['openstack']['dns']['custom_template_banner'] = ' -# This file was autogenerated by Chef -# Do not edit, changes will be overwritten -' - -default['openstack']['dns']['service_role'] = 'service' -default['openstack']['dns']['syslog']['use'] = false - -# Settings for the default pool -default['openstack']['dns']['pool']['ns_hostnames'] = ['ns1.example.org.'] -default['openstack']['dns']['pool']['ns_addresses'] = ['127.0.0.1'] -default['openstack']['dns']['pool']['masters'] = ['127.0.0.1'] -default['openstack']['dns']['pool']['bind_hosts'] = ['127.0.0.1'] -default['openstack']['dns']['pool']['rndc_key'] = '/etc/designate/rndc.key' - -# platform-specific settings -default['openstack']['dns']['user'] = 'designate' -default['openstack']['dns']['group'] = 'designate' -case node['platform_family'] -when 'rhel' - default['openstack']['dns']['platform'] = { - 'designate_packages' => - %w( - openstack-designate-api - openstack-designate-central - openstack-designate-mdns - openstack-designate-producer - openstack-designate-worker - openstack-designate-sink - ), - 'designate_api_service' => 'designate-api', - 'designate_central_service' => 'designate-central', - 'designate_mdns_service' => 'designate-mdns', - 'designate_producer_service' => 'designate-producer', - 'designate_worker_service' => 'designate-worker', - 'designate_sink_service' => 'designate-sink', - 'package_overrides' => '', - } -when 'debian' - default['openstack']['dns']['platform'] = { - 'designate_packages' => - %w( - python3-designate - designate-api - designate-central - designate-mdns - designate-producer - designate-worker - bind9utils - designate-sink - ), - 'designate_dashboard_packages' => %w(python3-designate-dashboard), - 'designate_api_service' => 'designate-api', - 'designate_central_service' => 'designate-central', - 'designate_mdns_service' => 'designate-mdns', - 'designate_producer_service' => 'designate-producer', - 'designate_worker_service' => 'designate-worker', - 'designate_sink_service' => 'designate-sink', - 'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'", - } -end diff --git a/attributes/designate_conf.rb b/attributes/designate_conf.rb deleted file mode 100644 index 4308046..0000000 --- a/attributes/designate_conf.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Cookbook:: openstack-dns -# Attributes:: default -# -# Copyright:: 2017-2021, x-ion GmbH -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -default['openstack']['dns']['conf']['DEFAULT']['log_dir'] = '/var/log/designate' -default['openstack']['dns']['conf']['service:api']['auth_strategy'] = 'keystone' -default['openstack']['dns']['conf']['service:api']['enable_api_v1'] = 'True' -default['openstack']['dns']['conf']['service:api']['enabled_extensions_v1'] = 'quotas, reports' -default['openstack']['dns']['conf']['service:api']['enable_api_v2'] = 'True' -default['openstack']['dns']['conf']['service:worker']['enabled'] = 'True' -default['openstack']['dns']['conf']['service:worker']['notify'] = 'True' -default['openstack']['dns']['conf']['keystone_authtoken']['auth_type'] = 'password' -default['openstack']['dns']['conf']['keystone_authtoken']['username'] = 'designate' -default['openstack']['dns']['conf']['keystone_authtoken']['project_name'] = 'service' -default['openstack']['dns']['conf']['keystone_authtoken']['project_domain_name'] = 'Default' -default['openstack']['dns']['conf']['keystone_authtoken']['user_domain_name'] = 'Default' -default['openstack']['dns']['conf']['keystone_authtoken']['service_token_roles_required'] = 'True' diff --git a/metadata.rb b/metadata.rb deleted file mode 100644 index 3935845..0000000 --- a/metadata.rb +++ /dev/null @@ -1,18 +0,0 @@ -name 'openstack-dns' -maintainer 'openstack-chef' -maintainer_email 'openstack-discuss@lists.openstack.org' -issues_url 'https://launchpad.net/openstack-chef' -source_url 'https://opendev.org/openstack/cookbook-openstack-dns' -license 'Apache-2.0' -description 'Installs and configures the Designate Service' -chef_version '>= 16.0' -version '20.0.0' - -%w(ubuntu redhat centos).each do |os| - supports os -end - -depends 'openstackclient' -depends 'openstack-common', '>= 20.0.0' -depends 'openstack-identity', '>= 20.0.0' -depends 'openstack-network', '>= 20.0.0' diff --git a/recipes/api.rb b/recipes/api.rb deleted file mode 100644 index 78dd2e6..0000000 --- a/recipes/api.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Cookbook:: openstack-dns -# Recipe:: api -# -# Copyright:: 2017-2021, x-ion GmbH -# Copyright:: 2019-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_recipe 'openstack-dns::common' - -platform_options = node['openstack']['dns']['platform'] - -service 'designate-api' do - service_name platform_options['designate_api_service'] - supports status: true, restart: true - action [:enable, :start] - subscribes :restart, 'template[/etc/designate/designate.conf]' -end diff --git a/recipes/central.rb b/recipes/central.rb deleted file mode 100644 index 351979c..0000000 --- a/recipes/central.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Cookbook:: openstack-dns -# Recipe:: central -# -# Copyright:: 2017-2021, x-ion GmbH -# Copyright:: 2019-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_recipe 'openstack-dns::common' - -platform_options = node['openstack']['dns']['platform'] - -service 'designate_central' do - service_name platform_options['designate_central_service'] - supports status: true, restart: true - action [:enable, :start] - subscribes :restart, 'template[/etc/designate/designate.conf]' -end diff --git a/recipes/common.rb b/recipes/common.rb deleted file mode 100644 index 6ba2613..0000000 --- a/recipes/common.rb +++ /dev/null @@ -1,142 +0,0 @@ -# -# Cookbook:: openstack-dns -# Recipe:: common -# -# Copyright:: 2017-2021, x-ion Gmbh -# Copyright:: 2019-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -class ::Chef::Recipe - include ::Openstack -end - -include_recipe 'openstack-common' - -if node['openstack']['dns']['syslog']['use'] - include_recipe 'openstack-common::logging' -end - -platform_options = node['openstack']['dns']['platform'] - -package platform_options['designate_packages'] do - options platform_options['package_overrides'] - action :upgrade -end - -db_type = node['openstack']['db']['dns']['service_type'] -package node['openstack']['db']['python_packages'][db_type] do - action :upgrade -end - -if node['openstack']['mq']['service_type'] == 'rabbit' - node.default['openstack']['dns']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'dns' -end - -db_user = node['openstack']['db']['dns']['username'] -db_pass = get_password 'db', 'designate' - -bind_services = node['openstack']['bind_service']['all'] -api_bind = bind_services['dns-api'] -api_bind_str = "#{bind_address api_bind}:#{api_bind['port']}" - -identity_endpoint = internal_endpoint 'identity' - -# define attributes that are needed in designate.conf -node.default['openstack']['dns']['conf'].tap do |conf| - conf['service:api']['listen'] = api_bind_str - conf['keystone_authtoken']['auth_url'] = identity_endpoint.to_s - conf['keystone_authtoken']['www_authenticate_uri'] = identity_endpoint.to_s -end - -# define secrets that are needed in designate.conf -node.default['openstack']['dns']['conf_secrets'].tap do |conf_secrets| - conf_secrets['storage:sqlalchemy']['connection'] = - db_uri('dns', db_user, db_pass) - conf_secrets['keystone_authtoken']['password'] = - get_password 'service', 'openstack-dns' -end - -# merge all config options and secrets to be used in designate.conf -designate_conf_options = merge_config_options 'dns' - -directory '/etc/designate' do - owner node['openstack']['dns']['user'] - group node['openstack']['dns']['group'] - mode '750' -end - -template '/etc/designate/designate.conf' do - source 'openstack-service.conf.erb' - cookbook 'openstack-common' - owner node['openstack']['dns']['user'] - group node['openstack']['dns']['group'] - mode '640' - sensitive true - variables( - service_config: designate_conf_options - ) -end - -# delete all secrets saved in the attribute -# node['openstack']['dns']['conf_secrets'] after creating the config file -ruby_block "delete all attributes in node['openstack']['dns']['conf_secrets']" do - block do - node.rm(:openstack, :dns, :conf_secrets) - end -end - -rndc_secret = get_password 'token', 'designate_rndc' -pool_config = node['openstack']['dns']['pool'] - -template pool_config['rndc_key'] do - source 'rndc.key.erb' - owner node['openstack']['dns']['user'] - group node['openstack']['dns']['group'] - sensitive true - mode '440' - variables( - secret: rndc_secret - ) -end - -template '/etc/designate/pools.yaml' do - source 'pools.yaml.erb' - owner node['openstack']['dns']['user'] - group node['openstack']['dns']['group'] - mode '644' - variables( - banner: node['openstack']['dns']['custom_template_banner'], - bind_hosts: pool_config['bind_hosts'], - masters: pool_config['masters'], - ns_addresses: pool_config['ns_addresses'], - ns_hostnames: pool_config['ns_hostnames'], - rndc_key: pool_config['rndc_key'] - ) -end - -execute 'designate-manage database sync' do - user node['openstack']['dns']['user'] - group node['openstack']['dns']['group'] - command 'designate-manage database sync' - action :run -end - -execute 'designate-manage pool update' do - user node['openstack']['dns']['user'] - group node['openstack']['dns']['group'] - command 'designate-manage pool update' - action :nothing - subscribes :run, 'template[/etc/designate/pools.yaml]' -end diff --git a/recipes/dashboard.rb b/recipes/dashboard.rb deleted file mode 100644 index 93b380b..0000000 --- a/recipes/dashboard.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Cookbook:: openstack-dns -# Recipe:: dashboard -# -# Copyright:: 2017-2021, x-ion Gmbh -# Copyright:: 2020-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -class ::Chef::Recipe - include ::Openstack -end - -platform_options = node['openstack']['dns']['platform'] - -package platform_options['designate_dashboard_packages'] do - options platform_options['package_overrides'] - action :upgrade -end diff --git a/recipes/identity_registration.rb b/recipes/identity_registration.rb deleted file mode 100644 index 9dd4852..0000000 --- a/recipes/identity_registration.rb +++ /dev/null @@ -1,89 +0,0 @@ -# -# Cookbook:: openstack-dns -# Recipe:: identity_registration -# -# Copyright:: 2017-2021, x-ion GmbH -# Copyright:: 2019-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -class ::Chef::Recipe - include ::Openstack -end - -identity_endpoint = internal_endpoint 'identity' -auth_url = identity_endpoint.to_s - -internal_designate_endpoint = internal_endpoint 'dns-api' -public_designate_endpoint = public_endpoint 'dns-api' - -service_pass = get_password 'service', 'openstack-dns' -service_project_name = node['openstack']['dns']['conf']['keystone_authtoken']['project_name'] -service_user = node['openstack']['dns']['conf']['keystone_authtoken']['username'] -service_role = node['openstack']['dns']['service_role'] -service_type = 'dns' -service_name = 'designate' -service_domain_name = node['openstack']['dns']['conf']['keystone_authtoken']['user_domain_name'] -admin_user = node['openstack']['identity']['admin_user'] -admin_pass = get_password 'user', node['openstack']['identity']['admin_user'] -admin_project = node['openstack']['identity']['admin_project'] -admin_domain = node['openstack']['identity']['admin_domain_name'] -region = node['openstack']['region'] - -connection_params = { - openstack_auth_url: auth_url, - openstack_username: admin_user, - openstack_api_key: admin_pass, - openstack_project_name: admin_project, - openstack_domain_name: admin_domain, -} - -# Register DNS Service -openstack_service service_name do - type service_type - connection_params connection_params -end - -# Register DNS Public-Endpoint -openstack_endpoint service_type do - service_name service_name - interface 'public' - url public_designate_endpoint.to_s - region region - connection_params connection_params -end - -# Register DNS Internal-Endpoint -openstack_endpoint service_type do - service_name service_name - interface 'internal' - url internal_designate_endpoint.to_s - region region - connection_params connection_params -end - -# Register Service Project -openstack_project service_project_name do - connection_params connection_params -end - -# Register Service User -openstack_user service_user do - role_name service_role - project_name service_project_name - domain_name service_domain_name - password service_pass - connection_params connection_params - action [:create, :grant_role] -end diff --git a/recipes/mdns.rb b/recipes/mdns.rb deleted file mode 100644 index d7810e7..0000000 --- a/recipes/mdns.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Cookbook:: openstack-dns -# Recipe:: mdns -# -# Copyright:: 2017-2021, x-ion GmbH -# Copyright:: 2020-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_recipe 'openstack-dns::common' - -platform_options = node['openstack']['dns']['platform'] - -service 'designate_mdns' do - service_name platform_options['designate_mdns_service'] - supports status: true, restart: true - action [:enable, :start] - subscribes :restart, 'template[/etc/designate/designate.conf]' -end diff --git a/recipes/neutron_int.rb b/recipes/neutron_int.rb deleted file mode 100644 index 3acb471..0000000 --- a/recipes/neutron_int.rb +++ /dev/null @@ -1,44 +0,0 @@ -# -# Cookbook:: openstack-dns -# Recipe:: neutron_int -# -# Copyright:: 2017-2021, x-ion GmbH -# Copyright:: 2020-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -class ::Chef::Recipe - include ::Openstack -end - -dns_endpoint = internal_endpoint 'dns-api' -dns_url = dns_endpoint.to_s + '/v2' - -identity_endpoint = internal_endpoint 'identity' -auth_url = identity_endpoint.to_s - -node.default['openstack']['network']['conf'].tap do |conf| - conf['DEFAULT']['external_dns_driver'] = 'designate' - conf['designate']['url'] = dns_url - conf['designate']['auth_type'] = 'password' - conf['designate']['auth_url'] = auth_url - conf['designate']['username'] = 'designate' - conf['designate']['project_name'] = 'service' - conf['designate']['project_domain_name'] = 'Default' - conf['designate']['user_domain_name'] = 'Default' -end - -node.default['openstack']['network']['conf_secrets'].tap do |conf_secrets| - conf_secrets['designate']['password'] = get_password 'service', 'openstack-dns' -end diff --git a/recipes/producer.rb b/recipes/producer.rb deleted file mode 100644 index 0a4d6bb..0000000 --- a/recipes/producer.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Cookbook:: openstack-dns -# Recipe:: producer -# -# Copyright:: 2017-2021, x-ion GmbH -# Copyright:: 2020-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_recipe 'openstack-dns::common' - -platform_options = node['openstack']['dns']['platform'] - -service 'designate_producer' do - service_name platform_options['designate_producer_service'] - supports status: true, restart: true - action [:enable, :start] - subscribes :restart, 'template[/etc/designate/designate.conf]' -end diff --git a/recipes/sink.rb b/recipes/sink.rb deleted file mode 100644 index 0279462..0000000 --- a/recipes/sink.rb +++ /dev/null @@ -1,29 +0,0 @@ -# -# Cookbook:: openstack-dns -# Recipe:: producer -# -# Copyright:: 2020-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_recipe 'openstack-dns::common' - -platform_options = node['openstack']['dns']['platform'] - -service 'designate_sink' do - service_name platform_options['designate_sink_service'] - supports status: true, restart: true - action [:enable, :start] - subscribes :restart, 'template[/etc/designate/designate.conf]' -end diff --git a/recipes/worker.rb b/recipes/worker.rb deleted file mode 100644 index 6c1415c..0000000 --- a/recipes/worker.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Cookbook:: openstack-dns -# Recipe:: worker -# -# Copyright:: 2017-2021, x-ion GmbH -# Copyright:: 2020-2021, Oregon State University -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include_recipe 'openstack-dns::common' - -platform_options = node['openstack']['dns']['platform'] - -service 'designate_worker' do - service_name platform_options['designate_worker_service'] - supports status: true, restart: true - action [:enable, :start] - subscribes :restart, 'template[/etc/designate/designate.conf]' -end diff --git a/spec/api-rhel_spec.rb b/spec/api-rhel_spec.rb deleted file mode 100644 index ab7d880..0000000 --- a/spec/api-rhel_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::api' do - ALL_RHEL.each do |p| - context "redhat #{p[:version]}" do - let(:runner) { ChefSpec::SoloRunner.new(p) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate-api').with( - service_name: 'designate-api', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate-api') - end - it do - expect(chef_run.service('designate-api')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end - end -end diff --git a/spec/api_spec.rb b/spec/api_spec.rb deleted file mode 100644 index e458259..0000000 --- a/spec/api_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::api' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate-api').with( - service_name: 'designate-api', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate-api') - end - it do - expect(chef_run.service('designate-api')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end -end diff --git a/spec/central-rhel_spec.rb b/spec/central-rhel_spec.rb deleted file mode 100644 index 562cb4b..0000000 --- a/spec/central-rhel_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::central' do - ALL_RHEL.each do |p| - context "redhat #{p[:version]}" do - let(:runner) { ChefSpec::SoloRunner.new(p) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate_central').with( - service_name: 'designate-central', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate_central') - end - it do - expect(chef_run.service('designate_central')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end - end -end diff --git a/spec/central_spec.rb b/spec/central_spec.rb deleted file mode 100644 index 666232e..0000000 --- a/spec/central_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::central' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate_central').with( - service_name: 'designate-central', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate_central') - end - it do - expect(chef_run.service('designate_central')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end -end diff --git a/spec/common-rhel_spec.rb b/spec/common-rhel_spec.rb deleted file mode 100644 index 4c00d04..0000000 --- a/spec/common-rhel_spec.rb +++ /dev/null @@ -1,52 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::common' do - ALL_RHEL.each do |p| - context "redhat #{p[:version]}" do - let(:runner) { ChefSpec::SoloRunner.new(p) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to_not include_recipe('openstack-common::logging') - end - it 'install designate packages' do - expect(chef_run).to upgrade_package %w(openstack-designate-api openstack-designate-central openstack-designate-mdns openstack-designate-producer openstack-designate-worker openstack-designate-sink) - end - - case p - when REDHAT_7 - it do - expect(chef_run).to upgrade_package('MySQL-python') - end - when REDHAT_8 - it do - expect(chef_run).to upgrade_package('python3-PyMySQL') - end - end - it do - expect(chef_run).to create_template('/etc/designate/pools.yaml').with( - source: 'pools.yaml.erb', - owner: 'designate', - group: 'designate', - mode: '644', - variables: { - banner: "\n# This file was autogenerated by Chef\n# Do not edit, changes will be overwritten\n", - bind_hosts: %w(127.0.0.1), - masters: %w(127.0.0.1), - ns_addresses: %w(127.0.0.1), - ns_hostnames: %w(ns1.example.org.), - rndc_key: '/etc/designate/rndc.key', - } - ) - end - end - end -end diff --git a/spec/common_spec.rb b/spec/common_spec.rb deleted file mode 100644 index 7ccdcc3..0000000 --- a/spec/common_spec.rb +++ /dev/null @@ -1,142 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::common' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to_not include_recipe('openstack-common::logging') - end - it 'install designate packages' do - expect(chef_run).to upgrade_package %w(python3-designate designate-api designate-central designate-mdns designate-producer designate-worker bind9utils designate-sink) - end - it do - expect(chef_run).to upgrade_package('python3-mysqldb') - end - it do - expect(chef_run).to create_directory('/etc/designate').with( - owner: 'designate', - group: 'designate', - mode: '750' - ) - end - describe 'designate.conf' do - let(:file) { chef_run.template('/etc/designate/designate.conf') } - it do - expect(chef_run).to create_template(file.name).with( - source: 'openstack-service.conf.erb', - cookbook: 'openstack-common', - owner: 'designate', - group: 'designate', - mode: '640', - sensitive: true - ) - end - it 'section: DEFAULT' do - [ - %r{^log_dir = /var/log/designate$}, - %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$}, - ].each do |line| - expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line) - end - end - it 'section: service:api' do - [ - /^auth_strategy = keystone$/, - /^enable_api_v1 = True$/, - /^enabled_extensions_v1 = quotas, reports$/, - /^enable_api_v2 = True$/, - /^listen = 127.0.0.1:9001$/, - ].each do |line| - expect(chef_run).to render_config_file(file.name).with_section_content('service:api', line) - end - end - it 'section: service:worker' do - [ - /^enabled = True$/, - /^notify = True$/, - ].each do |line| - expect(chef_run).to render_config_file(file.name).with_section_content('service:worker', line) - end - end - it 'section: keystone_authtoken' do - [ - /^auth_type = password$/, - /^username = designate$/, - /^project_name = service$/, - /^project_domain_name = Default$/, - /^user_domain_name = Default$/, - /^service_token_roles_required = True$/, - %r{^www_authenticate_uri = http://127.0.0.1:5000/v3$}, - /^password = designate-pass$/, - ].each do |line| - expect(chef_run).to render_config_file(file.name).with_section_content('keystone_authtoken', line) - end - end - it 'section: storage:sqlalchemy' do - [ - %r{^connection = mysql\+pymysql://designate:db-pass@127.0.0.1:3306/designate\?charset=utf8$}, - ].each do |line| - expect(chef_run).to render_config_file(file.name).with_section_content('storage:sqlalchemy', line) - end - end - end - - it do - expect(chef_run).to create_template('/etc/designate/rndc.key').with( - source: 'rndc.key.erb', - owner: 'designate', - group: 'designate', - mode: '440', - sensitive: true, - variables: { - secret: 'rndc-key', - } - ) - end - - it do - expect(chef_run).to create_template('/etc/designate/pools.yaml').with( - source: 'pools.yaml.erb', - owner: 'designate', - group: 'designate', - mode: '644', - variables: { - banner: "\n# This file was autogenerated by Chef\n# Do not edit, changes will be overwritten\n", - bind_hosts: %w(127.0.0.1), - masters: %w(127.0.0.1), - ns_addresses: %w(127.0.0.1), - ns_hostnames: %w(ns1.example.org.), - rndc_key: '/etc/designate/rndc.key', - } - ) - end - it do - expect(chef_run).to run_execute('designate-manage database sync').with( - user: 'designate', - group: 'designate', - command: 'designate-manage database sync' - ) - end - it do - expect(chef_run).to nothing_execute('designate-manage pool update').with( - user: 'designate', - group: 'designate', - command: 'designate-manage pool update' - ) - end - it do - expect(chef_run.execute('designate-manage pool update')).to \ - subscribe_to('template[/etc/designate/pools.yaml]').on(:run) - end - end -end diff --git a/spec/dashboard_spec.rb b/spec/dashboard_spec.rb deleted file mode 100644 index 7d4d030..0000000 --- a/spec/dashboard_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::dashboard' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to upgrade_package('python3-designate-dashboard') - end - end -end diff --git a/spec/identity_registration_spec.rb b/spec/identity_registration_spec.rb deleted file mode 100644 index 2a017de..0000000 --- a/spec/identity_registration_spec.rb +++ /dev/null @@ -1,58 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::identity_registration' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - - connection_params = { - openstack_api_key: 'admin', - openstack_auth_url: 'http://127.0.0.1:5000/v3', - openstack_domain_name: 'default', - openstack_project_name: 'admin', - openstack_username: 'admin', - } - - it do - expect(chef_run).to create_openstack_service('designate').with( - type: 'dns', - connection_params: connection_params - ) - end - - it do - expect(chef_run).to create_openstack_endpoint('dns').with( - service_name: 'designate', - interface: 'internal', - url: 'http://127.0.0.1:9001', - region: 'RegionOne', - connection_params: connection_params - ) - end - - it do - expect(chef_run).to create_openstack_project('service').with( - connection_params: connection_params - ) - end - - it do - expect(chef_run).to create_openstack_user('designate').with( - role_name: 'service', - project_name: 'service', - domain_name: 'Default', - password: 'designate-pass', - connection_params: connection_params - ) - end - end -end diff --git a/spec/mdns-rhel_spec.rb b/spec/mdns-rhel_spec.rb deleted file mode 100644 index c8e4c76..0000000 --- a/spec/mdns-rhel_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::mdns' do - ALL_RHEL.each do |p| - context "redhat #{p[:version]}" do - let(:runner) { ChefSpec::SoloRunner.new(p) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate_mdns').with( - service_name: 'designate-mdns', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate_mdns') - end - it do - expect(chef_run.service('designate_mdns')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end - end -end diff --git a/spec/mdns_spec.rb b/spec/mdns_spec.rb deleted file mode 100644 index eb8ac61..0000000 --- a/spec/mdns_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::mdns' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate_mdns').with( - service_name: 'designate-mdns', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate_mdns') - end - it do - expect(chef_run.service('designate_mdns')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end -end diff --git a/spec/neutron_int_spec.rb b/spec/neutron_int_spec.rb deleted file mode 100644 index 905bdf6..0000000 --- a/spec/neutron_int_spec.rb +++ /dev/null @@ -1,42 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::neutron_int' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe, 'openstack-network') - end - - include_context 'dns-stubs' - include_context 'neutron-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - - describe '/etc/neutron/neutron.conf' do - it 'section: DEFAULT' do - [ - /^external_dns_driver = designate$/, - ].each do |line| - expect(chef_run).to render_config_file('/etc/neutron/neutron.conf').with_section_content('DEFAULT', line) - end - end - it 'section: designate' do - [ - %r{^url = http://127.0.0.1:9001/v2$}, - /^auth_type = password$/, - %r{^auth_url = http://127.0.0.1:5000/v3$}, - /^username = designate$/, - /^project_name = service$/, - /^project_domain_name = Default$/, - /^user_domain_name = Default$/, - /^password = designate-pass$/, - ].each do |line| - expect(chef_run).to render_config_file('/etc/neutron/neutron.conf').with_section_content('designate', line) - end - end - end - end -end diff --git a/spec/producer-rhel_spec.rb b/spec/producer-rhel_spec.rb deleted file mode 100644 index f10079a..0000000 --- a/spec/producer-rhel_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::producer' do - ALL_RHEL.each do |p| - context "redhat #{p[:version]}" do - let(:runner) { ChefSpec::SoloRunner.new(p) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate_producer').with( - service_name: 'designate-producer', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate_producer') - end - it do - expect(chef_run.service('designate_producer')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end - end -end diff --git a/spec/producer_spec.rb b/spec/producer_spec.rb deleted file mode 100644 index 3ccf9f3..0000000 --- a/spec/producer_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::producer' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate_producer').with( - service_name: 'designate-producer', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate_producer') - end - it do - expect(chef_run.service('designate_producer')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end -end diff --git a/spec/sink-rhel_spec.rb b/spec/sink-rhel_spec.rb deleted file mode 100644 index 8bf049b..0000000 --- a/spec/sink-rhel_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::sink' do - ALL_RHEL.each do |p| - context "redhat #{p[:version]}" do - let(:runner) { ChefSpec::SoloRunner.new(p) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate_sink').with( - service_name: 'designate-sink', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate_sink') - end - it do - expect(chef_run.service('designate_sink')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end - end -end diff --git a/spec/sink_spec.rb b/spec/sink_spec.rb deleted file mode 100644 index 564d56c..0000000 --- a/spec/sink_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::sink' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate_sink').with( - service_name: 'designate-sink', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate_sink') - end - it do - expect(chef_run.service('designate_sink')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index 503c415..0000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -1,83 +0,0 @@ -require 'chefspec' -require 'chefspec/berkshelf' -require 'chef/application' -require 'securerandom' - -RSpec.configure do |config| - config.color = true - config.formatter = :documentation - config.log_level = :warn - config.file_cache_path = '/var/chef/cache' -end - -REDHAT_7 = { - platform: 'redhat', - version: '7', -}.freeze - -REDHAT_8 = { - platform: 'redhat', - version: '8', -}.freeze - -ALL_RHEL = [ - REDHAT_7, - REDHAT_8, -].freeze - -UBUNTU_OPTS = { - platform: 'ubuntu', - version: '18.04', -}.freeze - -shared_context 'dns-stubs' do - before do - allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url) - .with('dns') - .and_return('rabbit://guest:mypass@127.0.0.1:5672') - allow_any_instance_of(Chef::Recipe).to receive(:rabbit_servers) - .and_return '1.1.1.1:5672,2.2.2.2:5672' - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('db', 'designate') - .and_return('db-pass') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('service', 'openstack-dns') - .and_return('designate-pass') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('token', 'designate_rndc') - .and_return('rndc-key') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('user', 'admin') - .and_return('admin') - end -end - -shared_context 'neutron-stubs' do - before do - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('token', 'openstack_identity_bootstrap_token') - .and_return('bootstrap-token') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('token', 'neutron_metadata_secret') - .and_return('metadata-secret') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('db', anything) - .and_return('neutron') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('service', 'openstack-network') - .and_return('neutron-pass') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('user', 'guest') - .and_return('mq-pass') - allow(Chef::Application).to receive(:fatal!) - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('service', 'openstack-compute') - .and_return('nova-pass') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('user', 'admin') - .and_return('admin-pass') - allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url) - .with('network') - .and_return('rabbit://guest:mypass@127.0.0.1:5672') - end -end diff --git a/spec/worker-rhel_spec.rb b/spec/worker-rhel_spec.rb deleted file mode 100644 index a1ab187..0000000 --- a/spec/worker-rhel_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::worker' do - ALL_RHEL.each do |p| - context "redhat #{p[:version]}" do - let(:runner) { ChefSpec::SoloRunner.new(p) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate_worker').with( - service_name: 'designate-worker', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate_worker') - end - it do - expect(chef_run.service('designate_worker')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end - end -end diff --git a/spec/worker_spec.rb b/spec/worker_spec.rb deleted file mode 100644 index 6225c98..0000000 --- a/spec/worker_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-dns::worker' do - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - runner.converge(described_recipe) - end - - include_context 'dns-stubs' - - it 'converges successfully' do - expect { :chef_run }.to_not raise_error - end - it do - expect(chef_run).to enable_service('designate_worker').with( - service_name: 'designate-worker', - supports: { restart: true, status: true } - ) - expect(chef_run).to start_service('designate_worker') - end - it do - expect(chef_run.service('designate_worker')).to \ - subscribe_to('template[/etc/designate/designate.conf]').on(:restart) - end - end -end diff --git a/templates/default/named.designate.erb b/templates/default/named.designate.erb deleted file mode 100644 index 772deef..0000000 --- a/templates/default/named.designate.erb +++ /dev/null @@ -1,6 +0,0 @@ -include "<%= @bind_sysconfig %>/rndc.key"; - -controls { - inet 127.0.0.1 port 953 - allow { 127.0.0.1; } keys { "designate"; }; -}; diff --git a/templates/default/pools.yaml.erb b/templates/default/pools.yaml.erb deleted file mode 100644 index 02d228f..0000000 --- a/templates/default/pools.yaml.erb +++ /dev/null @@ -1,47 +0,0 @@ -<%= @banner %> -- name: default - # The name is immutable. There will be no option to change the name after - # creation and the only way will to change it will be to delete it - # (and all zones associated with it) and recreate it. - description: Default Pool - - attributes: {} - - # List out the NS records for zones hosted within this pool - # This should be a record that is created outside of designate, that - # points to the public IP of the controller node. - ns_records: -<% @ns_hostnames.each do |ns_hostname| %> - - hostname: <%= ns_hostname %> - priority: 1 -<% end %> - - # List out the nameservers for this pool. These are the actual BIND servers. - # We use these to verify changes have propagated to all nameservers. - nameservers: -<% @ns_addresses.each do |ns_address| %> - - host: <%= ns_address %> - port: 53 -<% end %> - - # List out the targets for this pool. For BIND there will be one - # entry for each BIND server, as we have to run rndc command on each server - targets: -<% @bind_hosts.each do |bind_host| %> - - type: bind9 - description: BIND9 Server <%= bind_host %> - - masters: -<% @masters.each do |host| %> - - host: <%= host %> - port: 5354 -<% end %> - - # BIND Configuration options - options: - host: <%= bind_host %> - port: 53 - rndc_host: <%= bind_host %> - rndc_port: 953 - rndc_key_file: <%= @rndc_key %> -<% end %> diff --git a/templates/default/rndc.key.erb b/templates/default/rndc.key.erb deleted file mode 100644 index 2540f30..0000000 --- a/templates/default/rndc.key.erb +++ /dev/null @@ -1,4 +0,0 @@ -key "designate" { - algorithm hmac-md5; - secret "<%= @secret %>"; -};