Ryan Brown 2018-10-18 10:55:42 -04:00 committed by GitHub
parent 3b5471a734
commit 18a088c64e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 2452 additions and 1095 deletions

View file

@ -268,7 +268,7 @@ EXAMPLES = '''
disk_size_gb: 500
zone: us-central1-a
project: "test_project"
auth_kind: "service_account"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
'''
@ -286,7 +286,7 @@ RETURN = '''
- An optional description of this cluster.
returned: success
type: str
initial_node_count:
initialNodeCount:
description:
- The number of nodes to create in this cluster. You must ensure that your Compute
Engine resource quota is sufficient for this number of instances. You must also
@ -296,7 +296,7 @@ RETURN = '''
this and a nodePool at the same time.
returned: success
type: int
node_config:
nodeConfig:
description:
- Parameters used in creating the cluster's nodes.
- For requests, this field should only be used in lieu of a "nodePool" object, since
@ -307,19 +307,19 @@ RETURN = '''
returned: success
type: complex
contains:
machine_type:
machineType:
description:
- The name of a Google Compute Engine machine type (e.g.
- n1-standard-1). If unspecified, the default machine type is n1-standard-1.
returned: success
type: str
disk_size_gb:
diskSizeGb:
description:
- Size of the disk attached to each node, specified in GB. The smallest allowed disk
size is 10GB. If unspecified, the default disk size is 100GB.
returned: success
type: int
oauth_scopes:
oauthScopes:
description:
- The set of Google API scopes to be made available on all of the node VMs under the
"default" service account.
@ -332,7 +332,7 @@ RETURN = '''
enabled, in which case their required scopes will be added.
returned: success
type: list
service_account:
serviceAccount:
description:
- The Google Cloud Platform Service Account to be used by the node VMs. If no Service
Account is specified, the "default" service account is used.
@ -353,7 +353,7 @@ RETURN = '''
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
returned: success
type: dict
image_type:
imageType:
description:
- The image type to use for this node. Note that for a given image type, the latest
version of it will be used.
@ -371,7 +371,7 @@ RETURN = '''
- 'Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.'
returned: success
type: dict
local_ssd_count:
localSsdCount:
description:
- The number of local SSD disks to be attached to the node.
- 'The limit for this value is dependant upon the maximum number of disks available
@ -392,7 +392,7 @@ RETURN = '''
for more inforamtion about preemptible VM instances.'
returned: success
type: bool
master_auth:
masterAuth:
description:
- The authentication information for accessing the master endpoint.
returned: success
@ -409,23 +409,23 @@ RETURN = '''
the master endpoint is open to the Internet, you should create a strong password.
returned: success
type: str
cluster_ca_certificate:
clusterCaCertificate:
description:
- Base64-encoded public certificate that is the root of trust for the cluster.
returned: success
type: str
client_certificate:
clientCertificate:
description:
- Base64-encoded public certificate used by clients to authenticate to the cluster
endpoint.
returned: success
type: str
client_key:
clientKey:
description:
- Base64-encoded private key used by clients to authenticate to the cluster endpoint.
returned: success
type: str
logging_service:
loggingService:
description:
- 'The logging service the cluster should use to write logs. Currently available options: logging.googleapis.com
- the Google Cloud Logging service.'
@ -433,7 +433,7 @@ RETURN = '''
- if left as an empty string,logging.googleapis.com will be used.
returned: success
type: str
monitoring_service:
monitoringService:
description:
- The monitoring service the cluster should use to write metrics.
- 'Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring
@ -450,20 +450,20 @@ RETURN = '''
resource.
returned: success
type: str
cluster_ipv4_cidr:
clusterIpv4Cidr:
description:
- The IP address range of the container pods in this cluster, in CIDR notation (e.g.
10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block
in 10.0.0.0/8.
returned: success
type: str
addons_config:
addonsConfig:
description:
- Configurations for the various addons available to run in the cluster.
returned: success
type: complex
contains:
http_load_balancing:
httpLoadBalancing:
description:
- Configuration for the HTTP (L7) load balancing controller addon, which makes it
easy to set up HTTP load balancers for services in a cluster.
@ -476,7 +476,7 @@ RETURN = '''
it runs a small pod in the cluster that manages the load balancers.
returned: success
type: bool
horizontal_pod_autoscaling:
horizontalPodAutoscaling:
description:
- Configuration for the horizontal pod autoscaling feature, which increases or decreases
the number of replica pods a replication controller has based on the resource usage
@ -509,48 +509,48 @@ RETURN = '''
the masterAuth property of this resource for username and password information.
returned: success
type: str
initial_cluster_version:
initialClusterVersion:
description:
- The software version of the master endpoint and kubelets used in the cluster when
it was first created. The version can be upgraded over time.
returned: success
type: str
current_master_version:
currentMasterVersion:
description:
- The current software version of the master endpoint.
returned: success
type: str
current_node_version:
currentNodeVersion:
description:
- The current version of the node software components. If they are currently at multiple
versions because they're in the process of being upgraded, this reflects the minimum
version of all nodes.
returned: success
type: str
create_time:
createTime:
description:
- The time the cluster was created, in RFC3339 text format.
returned: success
type: str
node_ipv4_cidr_size:
nodeIpv4CidrSize:
description:
- The size of the address space on each node for hosting containers.
- This is provisioned from within the container_ipv4_cidr range.
returned: success
type: int
services_ipv4_cidr:
servicesIpv4Cidr:
description:
- The IP address range of the Kubernetes services in this cluster, in CIDR notation
(e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from the
container CIDR.
returned: success
type: str
current_node_count:
currentNodeCount:
description:
- The number of nodes currently in the cluster.
returned: success
type: int
expire_time:
expireTime:
description:
- The time the cluster will be automatically deleted in RFC3339 text format.
returned: success
@ -632,7 +632,8 @@ def main():
if fetch:
if state == 'present':
if is_different(module, fetch):
fetch = update(module, self_link(module))
update(module, self_link(module))
fetch = fetch_resource(module, self_link(module))
changed = True
else:
delete(module, self_link(module))
@ -689,9 +690,9 @@ def resource_to_request(module):
return return_vals
def fetch_resource(module, link):
def fetch_resource(module, link, allow_not_found=True):
auth = GcpSession(module, 'container')
return return_if_object(module, auth.get(link))
return return_if_object(module, auth.get(link), allow_not_found)
def self_link(module):
@ -702,9 +703,9 @@ def collection(module):
return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters".format(**module.params)
def return_if_object(module, response):
def return_if_object(module, response, allow_not_found=False):
# If not found, return nothing.
if response.status_code == 404:
if allow_not_found and response.status_code == 404:
return None
# If no content, return nothing.