Update tests for node-attributes
This found problems with the openshift and openshiftpods drivers, so that is fixed. Also update the docs to reflect the fact that node-attributes is supported across all drivers. Note that we do not appear to have GCE driver tests, so that one is just assumed to work. :( Change-Id: I98b6f871815d2b564d1550d960e682c180bac7c2
This commit is contained in:
parent
24db91f96b
commit
8528322cf0
|
@ -1301,6 +1301,12 @@ Selecting the kubernetes driver adds the following options to the
|
||||||
|
|
||||||
Namespaces are prefixed with the pool's name.
|
Namespaces are prefixed with the pool's name.
|
||||||
|
|
||||||
|
.. attr:: node-attributes
|
||||||
|
:type: dict
|
||||||
|
|
||||||
|
A dictionary of key-value pairs that will be stored with the node data
|
||||||
|
in ZooKeeper. The keys and values can be any arbitrary string.
|
||||||
|
|
||||||
.. attr:: labels
|
.. attr:: labels
|
||||||
:type: list
|
:type: list
|
||||||
|
|
||||||
|
@ -1427,6 +1433,12 @@ Selecting the openshift driver adds the following options to the
|
||||||
|
|
||||||
Project's name are prefixed with the pool's name.
|
Project's name are prefixed with the pool's name.
|
||||||
|
|
||||||
|
.. attr:: node-attributes
|
||||||
|
:type: dict
|
||||||
|
|
||||||
|
A dictionary of key-value pairs that will be stored with the node data
|
||||||
|
in ZooKeeper. The keys and values can be any arbitrary string.
|
||||||
|
|
||||||
.. attr:: labels
|
.. attr:: labels
|
||||||
:type: list
|
:type: list
|
||||||
|
|
||||||
|
@ -1557,6 +1569,12 @@ Selecting the openshift pods driver adds the following options to the
|
||||||
|
|
||||||
The project's name that will be used to create the pods.
|
The project's name that will be used to create the pods.
|
||||||
|
|
||||||
|
.. attr:: node-attributes
|
||||||
|
:type: dict
|
||||||
|
|
||||||
|
A dictionary of key-value pairs that will be stored with the node data
|
||||||
|
in ZooKeeper. The keys and values can be any arbitrary string.
|
||||||
|
|
||||||
.. attr:: labels
|
.. attr:: labels
|
||||||
:type: list
|
:type: list
|
||||||
|
|
||||||
|
@ -1789,6 +1807,12 @@ section of the configuration.
|
||||||
|
|
||||||
A unique name within the provider for this pool of resources.
|
A unique name within the provider for this pool of resources.
|
||||||
|
|
||||||
|
.. attr:: node-attributes
|
||||||
|
:type: dict
|
||||||
|
|
||||||
|
A dictionary of key-value pairs that will be stored with the node data
|
||||||
|
in ZooKeeper. The keys and values can be any arbitrary string.
|
||||||
|
|
||||||
.. attr:: subnet-id
|
.. attr:: subnet-id
|
||||||
|
|
||||||
If provided, specifies the subnet to assign to the primary network
|
If provided, specifies the subnet to assign to the primary network
|
||||||
|
@ -2079,6 +2103,12 @@ section of the configuration.
|
||||||
|
|
||||||
A unique name within the provider for this pool of resources.
|
A unique name within the provider for this pool of resources.
|
||||||
|
|
||||||
|
.. attr:: node-attributes
|
||||||
|
:type: dict
|
||||||
|
|
||||||
|
A dictionary of key-value pairs that will be stored with the node data
|
||||||
|
in ZooKeeper. The keys and values can be any arbitrary string.
|
||||||
|
|
||||||
.. attr:: host-key-checking
|
.. attr:: host-key-checking
|
||||||
:type: bool
|
:type: bool
|
||||||
:default: True
|
:default: True
|
||||||
|
|
|
@ -109,10 +109,11 @@ class OpenshiftProviderConfig(ProviderConfig):
|
||||||
'python-path': str,
|
'python-path': str,
|
||||||
}
|
}
|
||||||
|
|
||||||
pool = {
|
pool = ConfigPool.getCommonSchemaDict()
|
||||||
|
pool.update({
|
||||||
v.Required('name'): str,
|
v.Required('name'): str,
|
||||||
v.Required('labels'): [openshift_label],
|
v.Required('labels'): [openshift_label],
|
||||||
}
|
})
|
||||||
|
|
||||||
schema = ProviderConfig.getCommonSchemaDict()
|
schema = ProviderConfig.getCommonSchemaDict()
|
||||||
schema.update({
|
schema.update({
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
import math
|
import math
|
||||||
import voluptuous as v
|
import voluptuous as v
|
||||||
|
|
||||||
|
from nodepool.driver import ConfigPool
|
||||||
from nodepool.driver.openshift.config import OpenshiftPool
|
from nodepool.driver.openshift.config import OpenshiftPool
|
||||||
from nodepool.driver.openshift.config import OpenshiftProviderConfig
|
from nodepool.driver.openshift.config import OpenshiftProviderConfig
|
||||||
|
|
||||||
|
@ -52,10 +53,11 @@ class OpenshiftPodsProviderConfig(OpenshiftProviderConfig):
|
||||||
'python-path': str,
|
'python-path': str,
|
||||||
}
|
}
|
||||||
|
|
||||||
pool = {
|
pool = ConfigPool.getCommonSchemaDict()
|
||||||
|
pool.update({
|
||||||
v.Required('name'): str,
|
v.Required('name'): str,
|
||||||
v.Required('labels'): [openshift_label],
|
v.Required('labels'): [openshift_label],
|
||||||
}
|
})
|
||||||
|
|
||||||
schema = OpenshiftProviderConfig.getCommonSchemaDict()
|
schema = OpenshiftProviderConfig.getCommonSchemaDict()
|
||||||
schema.update({
|
schema.update({
|
||||||
|
|
|
@ -51,6 +51,9 @@ providers:
|
||||||
max-servers: 1
|
max-servers: 1
|
||||||
subnet-id: null
|
subnet-id: null
|
||||||
security-group-id: null
|
security-group-id: null
|
||||||
|
node-attributes:
|
||||||
|
key1: value1
|
||||||
|
key2: value2
|
||||||
labels:
|
labels:
|
||||||
- name: ubuntu1404-ebs-optimized
|
- name: ubuntu1404-ebs-optimized
|
||||||
cloud-image: ubuntu1404
|
cloud-image: ubuntu1404
|
||||||
|
@ -61,6 +64,9 @@ providers:
|
||||||
max-servers: 1
|
max-servers: 1
|
||||||
subnet-id: null
|
subnet-id: null
|
||||||
security-group-id: null
|
security-group-id: null
|
||||||
|
node-attributes:
|
||||||
|
key1: value1
|
||||||
|
key2: value2
|
||||||
labels:
|
labels:
|
||||||
- name: ubuntu1404
|
- name: ubuntu1404
|
||||||
cloud-image: ubuntu1404
|
cloud-image: ubuntu1404
|
||||||
|
@ -92,6 +98,9 @@ providers:
|
||||||
subnet-id: null
|
subnet-id: null
|
||||||
security-group-id: null
|
security-group-id: null
|
||||||
host-key-checking: false
|
host-key-checking: false
|
||||||
|
node-attributes:
|
||||||
|
key1: value1
|
||||||
|
key2: value2
|
||||||
labels:
|
labels:
|
||||||
- name: ubuntu1404-non-host-key-checking
|
- name: ubuntu1404-non-host-key-checking
|
||||||
cloud-image: ubuntu1404
|
cloud-image: ubuntu1404
|
||||||
|
@ -102,6 +111,9 @@ providers:
|
||||||
subnet-id: null
|
subnet-id: null
|
||||||
security-group-id: null
|
security-group-id: null
|
||||||
public-ip-address: false
|
public-ip-address: false
|
||||||
|
node-attributes:
|
||||||
|
key1: value1
|
||||||
|
key2: value2
|
||||||
labels:
|
labels:
|
||||||
- name: ubuntu1404-private-ip
|
- name: ubuntu1404-private-ip
|
||||||
cloud-image: ubuntu1404
|
cloud-image: ubuntu1404
|
||||||
|
@ -111,6 +123,9 @@ providers:
|
||||||
max-servers: 1
|
max-servers: 1
|
||||||
subnet-id: null
|
subnet-id: null
|
||||||
security-group-id: null
|
security-group-id: null
|
||||||
|
node-attributes:
|
||||||
|
key1: value1
|
||||||
|
key2: value2
|
||||||
labels:
|
labels:
|
||||||
- name: ubuntu1404-with-tags
|
- name: ubuntu1404-with-tags
|
||||||
cloud-image: ubuntu1404
|
cloud-image: ubuntu1404
|
||||||
|
@ -122,6 +137,9 @@ providers:
|
||||||
max-servers: 1
|
max-servers: 1
|
||||||
subnet-id: null
|
subnet-id: null
|
||||||
security-group-id: null
|
security-group-id: null
|
||||||
|
node-attributes:
|
||||||
|
key1: value1
|
||||||
|
key2: value2
|
||||||
labels:
|
labels:
|
||||||
- name: ubuntu1404-with-name-tag
|
- name: ubuntu1404-with-name-tag
|
||||||
cloud-image: ubuntu1404
|
cloud-image: ubuntu1404
|
||||||
|
|
|
@ -13,6 +13,9 @@ providers:
|
||||||
context: admin-cluster.local
|
context: admin-cluster.local
|
||||||
pools:
|
pools:
|
||||||
- name: main
|
- name: main
|
||||||
|
node-attributes:
|
||||||
|
key1: value1
|
||||||
|
key2: value2
|
||||||
labels:
|
labels:
|
||||||
- name: kubernetes-namespace
|
- name: kubernetes-namespace
|
||||||
type: namespace
|
type: namespace
|
||||||
|
|
|
@ -13,6 +13,9 @@ providers:
|
||||||
context: admin-cluster.local
|
context: admin-cluster.local
|
||||||
pools:
|
pools:
|
||||||
- name: main
|
- name: main
|
||||||
|
node-attributes:
|
||||||
|
key1: value1
|
||||||
|
key2: value2
|
||||||
labels:
|
labels:
|
||||||
- name: openshift-project
|
- name: openshift-project
|
||||||
type: project
|
type: project
|
||||||
|
|
|
@ -12,6 +12,9 @@ providers:
|
||||||
context: service-account.local
|
context: service-account.local
|
||||||
pools:
|
pools:
|
||||||
- name: main
|
- name: main
|
||||||
|
node-attributes:
|
||||||
|
key1: value1
|
||||||
|
key2: value2
|
||||||
labels:
|
labels:
|
||||||
- name: pod-fedora
|
- name: pod-fedora
|
||||||
image: docker.io/fedora:28
|
image: docker.io/fedora:28
|
||||||
|
|
|
@ -145,6 +145,8 @@ class TestDriverAws(tests.DBTestCase):
|
||||||
self.assertEqual(node.state, zk.READY)
|
self.assertEqual(node.state, zk.READY)
|
||||||
self.assertIsNotNone(node.launcher)
|
self.assertIsNotNone(node.launcher)
|
||||||
self.assertEqual(node.connection_type, 'ssh')
|
self.assertEqual(node.connection_type, 'ssh')
|
||||||
|
self.assertEqual(node.attributes,
|
||||||
|
{'key1': 'value1', 'key2': 'value2'})
|
||||||
if host_key_checking:
|
if host_key_checking:
|
||||||
nodescan.assert_called_with(
|
nodescan.assert_called_with(
|
||||||
node.interface_ip,
|
node.interface_ip,
|
||||||
|
|
|
@ -122,6 +122,8 @@ class TestDriverKubernetes(tests.DBTestCase):
|
||||||
self.assertIsNotNone(node.launcher)
|
self.assertIsNotNone(node.launcher)
|
||||||
self.assertEqual(node.connection_type, 'kubectl')
|
self.assertEqual(node.connection_type, 'kubectl')
|
||||||
self.assertEqual(node.connection_port.get('token'), 'fake-token')
|
self.assertEqual(node.connection_port.get('token'), 'fake-token')
|
||||||
|
self.assertEqual(node.attributes,
|
||||||
|
{'key1': 'value1', 'key2': 'value2'})
|
||||||
|
|
||||||
node.state = zk.DELETING
|
node.state = zk.DELETING
|
||||||
self.zk.storeNode(node)
|
self.zk.storeNode(node)
|
||||||
|
|
|
@ -120,6 +120,8 @@ class TestDriverOpenshift(tests.DBTestCase):
|
||||||
self.assertEqual(node.connection_type, 'kubectl')
|
self.assertEqual(node.connection_type, 'kubectl')
|
||||||
self.assertEqual(node.connection_port.get('token'), 'fake-token')
|
self.assertEqual(node.connection_port.get('token'), 'fake-token')
|
||||||
self.assertEqual(node.python_path, '/usr/bin/python3')
|
self.assertEqual(node.python_path, '/usr/bin/python3')
|
||||||
|
self.assertEqual(node.attributes,
|
||||||
|
{'key1': 'value1', 'key2': 'value2'})
|
||||||
|
|
||||||
node.state = zk.DELETING
|
node.state = zk.DELETING
|
||||||
self.zk.storeNode(node)
|
self.zk.storeNode(node)
|
||||||
|
|
|
@ -103,6 +103,8 @@ class TestDriverOpenshiftPods(tests.DBTestCase):
|
||||||
self.assertIsNotNone(node.launcher)
|
self.assertIsNotNone(node.launcher)
|
||||||
self.assertEqual(node.connection_type, 'kubectl')
|
self.assertEqual(node.connection_type, 'kubectl')
|
||||||
self.assertEqual(node.connection_port.get('token'), 'fake-token')
|
self.assertEqual(node.connection_port.get('token'), 'fake-token')
|
||||||
|
self.assertEqual(node.attributes,
|
||||||
|
{'key1': 'value1', 'key2': 'value2'})
|
||||||
|
|
||||||
node.state = zk.DELETING
|
node.state = zk.DELETING
|
||||||
self.zk.storeNode(node)
|
self.zk.storeNode(node)
|
||||||
|
|
Loading…
Reference in New Issue