From 2cb2550aca41ec7f66c77234400e0b054078d081 Mon Sep 17 00:00:00 2001 From: Samuel Beaulieu Date: Fri, 31 Dec 2021 09:54:46 -0600 Subject: [PATCH] refactor dns_zone to be renamed domain to match the global parameter being overwritten in the upstream vmpooler code, we use the global domain parameter, so naming that parameter the same in GCE. This parameter can be optionally set in the provider config, and overwrites the global parameter. It is used to infer the FQDN as . --- lib/vmpooler/providers/gce.rb | 6 +++--- spec/spec_helper.rb | 2 -- spec/unit/providers/gce_spec.rb | 2 +- vmpooler.yaml.example | 9 ++++++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/vmpooler/providers/gce.rb b/lib/vmpooler/providers/gce.rb index 3da189f..f8ccafd 100644 --- a/lib/vmpooler/providers/gce.rb +++ b/lib/vmpooler/providers/gce.rb @@ -86,8 +86,8 @@ module Vmpooler return provider_config['machine_type'] if provider_config['machine_type'] end - def dns_zone - provider_config['dns_zone'] + def domain + provider_config['domain'] end def dns_zone_resource_name @@ -459,7 +459,7 @@ module Vmpooler def vm_ready?(_pool_name, vm_name) begin # TODO: we could use a healthcheck resource attached to instance - open_socket(vm_name, dns_zone || global_config[:config]['domain']) + open_socket(vm_name, domain || global_config[:config]['domain']) rescue StandardError => _e return false end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 14ab878..6cd4447 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,11 +1,9 @@ # frozen_string_literal: true require 'simplecov' -=begin SimpleCov.start do add_filter '/spec/' end -=end require 'helpers' require 'rspec' require 'vmpooler' diff --git a/spec/unit/providers/gce_spec.rb b/spec/unit/providers/gce_spec.rb index 3075f8a..550e3bf 100644 --- a/spec/unit/providers/gce_spec.rb +++ b/spec/unit/providers/gce_spec.rb @@ -75,7 +75,7 @@ EOT zone: '#{zone}' network_name: 'projects/itsysopsnetworking/global/networks/shared1' dns_zone_resource_name: 'test-vmpooler-puppet-net' - dns_zone: 'test.vmpooler.puppet.net' + domain: 'test.vmpooler.puppet.net' :pools: - name: '#{poolname}' alias: [ 'mockpool' ] diff --git a/vmpooler.yaml.example b/vmpooler.yaml.example index b784c19..c51265d 100644 --- a/vmpooler.yaml.example +++ b/vmpooler.yaml.example @@ -75,10 +75,11 @@ # - dns_zone_resource_name # The name given to the DNS zone ressource. This is not the domain, but the name identifier of a zone eg example-com # (optional) when not set, the dns setup / teardown is skipped -# - dns_zone -# The dns zone domain set for the dns_zone_resource_name. This becomes the domain part of the FQDN ie $vm_name.$dns_zone +# - domain +# Overwrites the global domain parameter. This should match the dns zone domain set for the dns_zone_resource_name. +# It is used to infer the domain part of the FQDN ie $vm_name.$domain # When setting multiple providers at the same time, this value should be set for each GCE pools. -# default to: global config:domain. if dns_zone is set, it overwrites the top-level domain when checking vm_ready? +# (optional) If not explicitely set, the FQDN is inferred using the global 'domain' config parameter # Example: :gce: @@ -86,6 +87,8 @@ zone: 'us-central1-f' machine_type: '' network_name: '' + dns_zone_resource_name: 'subdomain-example-com' + domain: 'subdomain.example.com' # :pools: #