Browse Source

Merge "Make providing a keypair optional"

changes/06/619806/1
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
ee44e6e9e1
  1. 6
      magnum/api/attr_validator.py
  2. 3
      magnum/drivers/heat/template_def.py
  3. 5
      magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml
  4. 1
      magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml
  5. 3
      magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml
  6. 3
      magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml
  7. 3
      magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml
  8. 1
      magnum/drivers/swarm_fedora_atomic_v2/templates/swarmcluster.yaml
  9. 9
      magnum/tests/unit/api/test_attr_validator.py
  10. 6
      releasenotes/notes/make-keypair-optional-fcf4a17e440d0879.yaml

6
magnum/api/attr_validator.py

@ -63,8 +63,12 @@ def validate_flavor(cli, flavor):
def validate_keypair(cli, keypair):
"""Validate keypair"""
"""Validate keypair
validate the keypair, if provided.
"""
if keypair is None:
return
try:
cli.nova().keypairs.get(keypair)
except nova_exception.NotFound:

3
magnum/drivers/heat/template_def.py

@ -210,8 +210,7 @@ class BaseTemplateDefinition(TemplateDefinition):
self._osc = None
self.add_parameter('ssh_key_name',
cluster_attr='keypair',
required=True)
cluster_attr='keypair')
self.add_parameter('server_image',
cluster_template_attr='image_id')
self.add_parameter('dns_nameserver',

5
magnum/drivers/k8s_coreos_v1/templates/kubecluster.yaml

@ -10,10 +10,11 @@ parameters:
octavia_enabled:
type: string
default: true
ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server
default: ""
external_network:
type: string
@ -337,7 +338,7 @@ parameters:
kube_version:
type: string
description: version of kubernetes used for kubernetes cluster
default: v1.10.3_coreos.0
default: v1.10.3_coreos.0
kube_dashboard_version:
type: string

1
magnum/drivers/k8s_fedora_atomic_v1/templates/kubecluster.yaml

@ -10,6 +10,7 @@ parameters:
ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server
default: ""
external_network:
type: string

3
magnum/drivers/k8s_fedora_ironic_v1/templates/kubecluster.yaml

@ -10,7 +10,8 @@ parameters:
ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server
default: ""
external_network:
type: string
description: uuid/name of a network to use for floating ip addresses

3
magnum/drivers/mesos_ubuntu_v1/templates/mesoscluster.yaml

@ -11,7 +11,8 @@ parameters:
ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server
default: ""
external_network:
type: string
description: uuid/name of a network to use for floating ip addresses

3
magnum/drivers/swarm_fedora_atomic_v1/templates/cluster.yaml

@ -16,7 +16,8 @@ parameters:
ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server
default: ""
external_network:
type: string
description: uuid/name of a network to use for floating ip addresses

1
magnum/drivers/swarm_fedora_atomic_v2/templates/swarmcluster.yaml

@ -16,6 +16,7 @@ parameters:
ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server
default: ""
external_network:
type: string

9
magnum/tests/unit/api/test_attr_validator.py

@ -94,6 +94,15 @@ class TestAttrValidator(base.BaseTestCase):
attr_validator.validate_external_network,
mock_os_cli, 'test_ext_net')
def test_validate_keypair_with_no_keypair(self):
mock_keypair = mock.MagicMock()
mock_keypair.id = None
mock_nova = mock.MagicMock()
mock_nova.keypairs.get.return_value = mock_keypair
mock_os_cli = mock.MagicMock()
mock_os_cli.nova.return_value = mock_nova
attr_validator.validate_keypair(mock_os_cli, None)
def test_validate_keypair_with_valid_keypair(self):
mock_keypair = mock.MagicMock()
mock_keypair.id = 'test-keypair'

6
releasenotes/notes/make-keypair-optional-fcf4a17e440d0879.yaml

@ -0,0 +1,6 @@
---
features:
- |
This makes the keypair optional. The user should not have to include
the keypair because they may use some other method of security such
as using SSSD, preconfigured on the image.
Loading…
Cancel
Save