Browse Source

Merge "Support winrm hosts in static driver"

changes/55/535555/11
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
badb7e48ad
  1. 12
      doc/source/configuration.rst
  2. 8
      nodepool/driver/static/config.py
  3. 4
      nodepool/driver/static/handler.py
  4. 4
      nodepool/driver/static/provider.py
  5. 2
      nodepool/tests/fixtures/config_validate/good.yaml
  6. 9
      nodepool/tests/fixtures/static.yaml
  7. 10
      releasenotes/notes/static-driver-windows-cf80096636dbb428.yaml

12
doc/source/configuration.rst

@ -714,7 +714,7 @@ Example::
labels: trusty-static
host-key: fake-key
timeout: 13
ssh-port: 22022
connection-port: 22022
username: zuul
max-parallel-jobs: 1
@ -747,8 +747,14 @@ corresponding label.
``host-key``
The ssh host key of the node.
``ssh-port``
The ssh port, default to *22*
``connection-type`` (string)
The connection type that a consumer should use when connecting to the
node. Should be set to either 'ssh' or 'winrm'. Defaults to 'ssh'.
``connection-port`` (int)
The port that a consumer should use when connecting to the node.
For most nodes this is not necessary. This defaults to 22 when
``connection-type`` is 'ssh' and 5986 when it is 'winrm'.
``max-parallel-jobs``
The number of jobs that can run in parallel on this node, default to *1*.

8
nodepool/driver/static/config.py

@ -57,7 +57,10 @@ class StaticProviderConfig(ProviderConfig):
'labels': as_list(node['labels']),
'host-key': as_list(node.get('host-key', [])),
'timeout': int(node.get('timeout', 5)),
'ssh-port': int(node.get('ssh-port', 22)),
# Read ssh-port values for backward compat, but prefer port
'connection-port': int(
node.get('port', node.get('ssh-port', 22))),
'connection-type': node.get('connection-type', 'ssh'),
'username': node.get('username', 'zuul'),
'max-parallel-jobs': int(node.get('max-parallel-jobs', 1)),
})
@ -72,7 +75,8 @@ class StaticProviderConfig(ProviderConfig):
'username': str,
'timeout': int,
'host-key': v.Any(str, [str]),
'ssh-port': int,
'connection-port': int,
'connection-type': str,
'max-parallel-jobs': int,
}
pool = {

4
nodepool/driver/static/handler.py

@ -64,8 +64,8 @@ class StaticNodeRequestHandler(NodeRequestHandler):
node.hostname = static_node["name"]
node.username = static_node["username"]
node.interface_ip = static_node["name"]
node.connection_port = static_node["ssh-port"]
node.connection_type = "ssh"
node.connection_port = static_node["connection-port"]
node.connection_type = static_node["connection-type"]
nodeutils.set_node_ip(node)
node.host_keys = self.manager.nodes_keys[static_node["name"]]
self.zk.storeNode(node)

4
nodepool/driver/static/provider.py

@ -35,9 +35,11 @@ class StaticNodeProvider(Provider):
def checkHost(self, node):
# Check node is reachable
if node["connection-type"] != "ssh":
return
try:
keys = nodescan(node["name"],
port=node["ssh-port"],
port=node["connection-port"],
timeout=node["timeout"])
except exceptions.ConnectionTimeoutException:
raise StaticNodeError(

2
nodepool/tests/fixtures/config_validate/good.yaml

@ -90,7 +90,7 @@ providers:
labels: trusty-static
host-key: fake-key
timeout: 13
ssh-port: 22022
connection-port: 22022
username: zuul
max-parallel-jobs: 1

9
nodepool/tests/fixtures/static.yaml

@ -10,6 +10,9 @@ labels:
- name: fake-concurrent-label
min-ready: 2
- name: fake-windows-label
min-ready: 2
providers:
- name: static-provider
driver: static
@ -20,10 +23,14 @@ providers:
labels: fake-label
host-key: ssh-rsa FAKEKEY
timeout: 13
ssh-port: 22022
connection-port: 22022
username: zuul
max-parallel-jobs: 1
- name: fake-host-2
labels: fake-concurrent-label
host-key: ssh-rsa FAKEKEY
max-parallel-jobs: 2
- name: fake-host-3
labels: fake-windows-label
max-parallel-jobs: 1
connection-type: winrm

10
releasenotes/notes/static-driver-windows-cf80096636dbb428.yaml

@ -0,0 +1,10 @@
---
features:
- |
Added support for configuring windows static nodes. A static node can now
define a ``connection-type``. The ``ssh-port`` option has been renamed
to ``connection-port``.
deprecations:
- |
``ssh-port`` in static node config is deprecated. Please update config to
use ``connection-port`` instead.
Loading…
Cancel
Save