Skip to content

Commit

Permalink
refactor dns_zone to be renamed domain to match the global parameter …
Browse files Browse the repository at this point in the history
…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 .
  • Loading branch information
Samuel Beaulieu committed Dec 31, 2021
1 parent b66218d commit 2cb2550
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/vmpooler/providers/gce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def machine_type(pool_name)
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
Expand Down Expand Up @@ -459,7 +459,7 @@ def destroy_vm(pool_name, vm_name)
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
Expand Down
2 changes: 0 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/providers/gce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
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' ]
Expand Down
9 changes: 6 additions & 3 deletions vmpooler.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,20 @@
# - 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:
project: 'myproject'
zone: 'us-central1-f'
machine_type: ''
network_name: ''
dns_zone_resource_name: 'subdomain-example-com'
domain: 'subdomain.example.com'

# :pools:
#
Expand Down

0 comments on commit 2cb2550

Please sign in to comment.