mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-09 12:20:27 -07:00
Changing NodePool from Zone to Location (#182)
<!-- This change is generated by MagicModules. --> /cc @rambleraptor
This commit is contained in:
parent
ba60e76aee
commit
1ec588abb1
5 changed files with 59 additions and 46 deletions
|
@ -256,6 +256,9 @@ options:
|
||||||
description:
|
description:
|
||||||
- The location where the cluster is deployed.
|
- The location where the cluster is deployed.
|
||||||
required: true
|
required: true
|
||||||
|
aliases:
|
||||||
|
- zone
|
||||||
|
version_added: 2.8
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -626,7 +629,7 @@ def main():
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
subnetwork=dict(type='str'),
|
subnetwork=dict(type='str'),
|
||||||
location=dict(required=True, type='str'),
|
location=dict(required=True, type='str', aliases=['zone']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,9 @@ options:
|
||||||
- The location where the cluster is deployed.
|
- The location where the cluster is deployed.
|
||||||
required: true
|
required: true
|
||||||
aliases:
|
aliases:
|
||||||
|
- region
|
||||||
- zone
|
- zone
|
||||||
|
version_added: 2.8
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -362,7 +364,7 @@ import json
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['zone'])))
|
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone'])))
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if not module.params['scopes']:
|
||||||
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
|
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
|
||||||
|
|
|
@ -207,17 +207,21 @@ options:
|
||||||
Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster
|
Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster
|
||||||
task and then set this cluster field to "{{ name-of-resource }}"'
|
task and then set this cluster field to "{{ name-of-resource }}"'
|
||||||
required: true
|
required: true
|
||||||
zone:
|
location:
|
||||||
description:
|
description:
|
||||||
- The zone where the node pool is deployed.
|
- The location where the node pool is deployed.
|
||||||
required: true
|
required: true
|
||||||
|
aliases:
|
||||||
|
- region
|
||||||
|
- zone
|
||||||
|
version_added: 2.8
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: create a cluster
|
- name: create a cluster
|
||||||
gcp_container_cluster:
|
gcp_container_cluster:
|
||||||
name: cluster-nodepool
|
name: "cluster-nodepool"
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
location: us-central1-a
|
location: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
|
@ -231,7 +235,7 @@ EXAMPLES = '''
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
location: us-central1-a
|
||||||
project: "test_project"
|
project: "test_project"
|
||||||
auth_kind: "serviceaccount"
|
auth_kind: "serviceaccount"
|
||||||
service_account_file: "/tmp/auth.pem"
|
service_account_file: "/tmp/auth.pem"
|
||||||
|
@ -415,9 +419,9 @@ cluster:
|
||||||
- The cluster this node pool belongs to.
|
- The cluster this node pool belongs to.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
zone:
|
location:
|
||||||
description:
|
description:
|
||||||
- The zone where the node pool is deployed.
|
- The location where the node pool is deployed.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
'''
|
'''
|
||||||
|
@ -468,7 +472,7 @@ def main():
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
cluster=dict(required=True),
|
cluster=dict(required=True),
|
||||||
zone=dict(required=True, type='str'),
|
location=dict(required=True, type='str', aliases=['region', 'zone']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -551,8 +555,8 @@ def self_link(module):
|
||||||
|
|
||||||
|
|
||||||
def collection(module):
|
def collection(module):
|
||||||
res = {'project': module.params['project'], 'zone': module.params['zone'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')}
|
res = {'project': module.params['project'], 'location': module.params['location'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')}
|
||||||
return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res)
|
return "https://container.googleapis.com/v1/projects/{project}/zones/{location}/clusters/{cluster}/nodePools".format(**res)
|
||||||
|
|
||||||
|
|
||||||
def return_if_object(module, response, allow_not_found=False):
|
def return_if_object(module, response, allow_not_found=False):
|
||||||
|
|
|
@ -40,10 +40,14 @@ requirements:
|
||||||
- requests >= 2.18.4
|
- requests >= 2.18.4
|
||||||
- google-auth >= 1.3.0
|
- google-auth >= 1.3.0
|
||||||
options:
|
options:
|
||||||
zone:
|
location:
|
||||||
description:
|
description:
|
||||||
- The zone where the node pool is deployed.
|
- The location where the node pool is deployed.
|
||||||
required: true
|
required: true
|
||||||
|
aliases:
|
||||||
|
- region
|
||||||
|
- zone
|
||||||
|
version_added: 2.8
|
||||||
cluster:
|
cluster:
|
||||||
description:
|
description:
|
||||||
- The cluster this node pool belongs to.
|
- The cluster this node pool belongs to.
|
||||||
|
@ -59,7 +63,7 @@ EXAMPLES = '''
|
||||||
- name: a node pool facts
|
- name: a node pool facts
|
||||||
gcp_container_node_pool_facts:
|
gcp_container_node_pool_facts:
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
location: us-central1-a
|
||||||
project: test_project
|
project: test_project
|
||||||
auth_kind: serviceaccount
|
auth_kind: serviceaccount
|
||||||
service_account_file: "/tmp/auth.pem"
|
service_account_file: "/tmp/auth.pem"
|
||||||
|
@ -248,9 +252,9 @@ items:
|
||||||
- The cluster this node pool belongs to.
|
- The cluster this node pool belongs to.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
zone:
|
location:
|
||||||
description:
|
description:
|
||||||
- The zone where the node pool is deployed.
|
- The location where the node pool is deployed.
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
'''
|
'''
|
||||||
|
@ -267,7 +271,7 @@ import json
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict(zone=dict(required=True, type='str'), cluster=dict(required=True)))
|
module = GcpModule(argument_spec=dict(location=dict(required=True, type='str', aliases=['region', 'zone']), cluster=dict(required=True)))
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if not module.params['scopes']:
|
||||||
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
|
module.params['scopes'] = ['https://www.googleapis.com/auth/cloud-platform']
|
||||||
|
@ -282,8 +286,8 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
def collection(module):
|
def collection(module):
|
||||||
res = {'project': module.params['project'], 'zone': module.params['zone'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')}
|
res = {'project': module.params['project'], 'location': module.params['location'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')}
|
||||||
return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res)
|
return "https://container.googleapis.com/v1/projects/{project}/zones/{location}/clusters/{cluster}/nodePools".format(**res)
|
||||||
|
|
||||||
|
|
||||||
def fetch_list(module, link):
|
def fetch_list(module, link):
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
# Pre-test setup
|
# Pre-test setup
|
||||||
- name: create a cluster
|
- name: create a cluster
|
||||||
gcp_container_cluster:
|
gcp_container_cluster:
|
||||||
name: cluster-nodepool
|
name: "cluster-nodepool"
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
location: us-central1-a
|
location: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
location: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
location: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
- name: verify that node_pool was created
|
- name: verify that node_pool was created
|
||||||
gcp_container_node_pool_facts:
|
gcp_container_node_pool_facts:
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
location: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
location: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
location: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
- name: verify that node_pool was deleted
|
- name: verify that node_pool was deleted
|
||||||
gcp_container_node_pool_facts:
|
gcp_container_node_pool_facts:
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
location: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
name: my-pool
|
name: my-pool
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
cluster: "{{ cluster }}"
|
cluster: "{{ cluster }}"
|
||||||
zone: us-central1-a
|
location: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
# If errors happen, don't crash the playbook!
|
# If errors happen, don't crash the playbook!
|
||||||
- name: delete a cluster
|
- name: delete a cluster
|
||||||
gcp_container_cluster:
|
gcp_container_cluster:
|
||||||
name: cluster-nodepool
|
name: "cluster-nodepool"
|
||||||
initial_node_count: 4
|
initial_node_count: 4
|
||||||
location: us-central1-a
|
location: us-central1-a
|
||||||
project: "{{ gcp_project }}"
|
project: "{{ gcp_project }}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue