Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement private k8s cluster
Browse files Browse the repository at this point in the history
mimihalescu committed Jul 28, 2022
1 parent 8057d80 commit 97dbdf2
Showing 2 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/api/managed-kubernetes/k8s_cluster.md
Original file line number Diff line number Diff line change
@@ -50,6 +50,10 @@ This is a simple module that supports creating or removing K8s Clusters. This mo
| maintenance_window | False | dict | | The datacenter location. |
| api_subnet_allow_list | False | list | | The datacenter location. |
| s3_buckets_param | False | list | | The datacenter location. |
| public | False | str | | The indicator if the cluster is public or private. |
| location | False | str | | The location of the cluster if the cluster is private. This property is immutable. The location must be enabled for your contract or you must have a Datacenter within that location. This attribute is mandatory if the cluster is private. |
| nat_gateway_ip | False | str | | The nat gateway IP of the cluster if the cluster is private. |
| node_subnet | False | str | | The node subnet of the cluster if the cluster is private. |
| api_url | False | str | | The Ionos API base URL. |
| username | False | str | | The Ionos username. Overrides the IONOS_USERNAME environment variable. |
| password | False | str | | The Ionos password. Overrides the IONOS_PASSWORD environment variable. |
30 changes: 30 additions & 0 deletions plugins/modules/k8s_cluster.py
Original file line number Diff line number Diff line change
@@ -66,6 +66,28 @@
'type': 'list',
'elements': 'str',
},
'public': {
'description': ['The indicator if the cluster is public or private.'],
'available': ['present'],
'type': 'str'
},
'location': {
'description': 'The location of the cluster if the cluster is private. This property is immutable. The '
'location must be enabled for your contract or you must have a Datacenter within that '
'location. This attribute is mandatory if the cluster is private.',
'available': ['present'],
'type': 'str'
},
'nat_gateway_ip': {
'description': 'The nat gateway IP of the cluster if the cluster is private.',
'available': ['present'],
'type': 'str'
},
'node_subnet': {
'description': 'The node subnet of the cluster if the cluster is private.',
'available': ['present'],
'type': 'str'
},
'api_url': {
'description': ['The Ionos API base URL.'],
'version_added': '2.4',
@@ -223,6 +245,10 @@ def create_k8s_cluster(module, client):
cluster_name = module.params.get('cluster_name')
k8s_version = module.params.get('k8s_version')
maintenance = module.params.get('maintenance_window')
public = module.params.get('public')
location = module.params.get('location')
nat_gateway_ip = module.params.get('nat_gateway_ip')
node_subnet = module.params.get('node_subnet')
wait = module.params.get('wait')
api_subnet_allow_list = module.params.get('api_subnet_allow_list')
s3_buckets = list(map(lambda bucket_name: S3Bucket(name=bucket_name))) if module.params.get('s3_buckets') else None
@@ -254,6 +280,10 @@ def create_k8s_cluster(module, client):
maintenance_window=maintenance_window,
api_subnet_allow_list=api_subnet_allow_list,
s3_buckets=s3_buckets,
public=public,
nat_gateway_ip=nat_gateway_ip,
node_subnet=node_subnet,
location=location
)
k8s_cluster = KubernetesCluster(properties=k8s_cluster_properties)

0 comments on commit 97dbdf2

Please sign in to comment.