ansible-collections / ansible-collections/google.cloud

google.cloud.gcp_container_cluster is not stateful

Open
#197 3 comments 1 reaction 0 assignees View on GitHub
stale
Dominant language
Python
Stars
105
Forks
144
Avg merge
5d 10h
Merged PRs (30d)
4

Description

##### SUMMARY
When using the ansible module to manage the state of the cluster, editable values such as master_authorized_networks_config is not matched so it does not update the cluster as expected.

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
google.cloud.gcp_container_cluster

##### ANSIBLE VERSION

```paste below
ansible 2.9.7
config file = None
configured module search path = ['/Users/aeric/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible
executable location = /Library/Frameworks/Python.framework/Versions/3.6/bin/ansible
python version = 3.6.8 (v3.6.8:3c6b436a57, Dec 24 2018, 02:04:31) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
```

##### CONFIGURATION

```paste below

```

##### OS / ENVIRONMENT

##### STEPS TO REPRODUCE

```yaml
tasks:
- name: create a cluster
google.cloud.gcp_container_cluster:
auth_kind: serviceaccount
service_account_file: "{{ gcp_service_account_file }}"
project: saastest-202018
name: "{{ k8s_gcp_region }}-saas-cluster-ansible"
initial_node_count: 1
addons_config:
http_load_balancing:
disabled: no
horizontal_pod_autoscaling:
disabled: no
private_cluster_config:
enable_private_nodes: yes
master_ipv4_cidr_block: "{{ k8s_master_ipv4_cidr_block }}"
subnetwork: projects/saastest-202018/regions/{{ k8s_gcp_region }}/subnetworks/default
resource_labels:
type: saas
location: "{{ k8s_gcp_region }}"
ip_allocation_policy:
use_ip_aliases: yes
master_authorized_networks_config:
enabled: true
cidr_blocks:
- display_name: Any
cidr_block: 10.0.0.0/8
default_max_pods_constraint:
max_pods_per_node: '110'
```
Then change the config for the master_authorized_networks_config which is a modifiable field.

```yaml
tasks:
- name: create a cluster
google.cloud.gcp_container_cluster:
auth_kind: serviceaccount
service_account_file: "{{ gcp_service_account_file }}"
project: saastest-202018
name: "{{ k8s_gcp_region }}-saas-cluster-ansible"
initial_node_count: 1
addons_config:
http_load_balancing:
disabled: no
horizontal_pod_autoscaling:
disabled: no
private_cluster_config:
enable_private_nodes: yes
master_ipv4_cidr_block: "{{ k8s_master_ipv4_cidr_block }}"
subnetwork: projects/saastest-202018/regions/{{ k8s_gcp_region }}/subnetworks/default
resource_labels:
type: saas
location: "{{ k8s_gcp_region }}"
ip_allocation_policy:
use_ip_aliases: yes
master_authorized_networks_config:
enabled: true
cidr_blocks:
- display_name: Any
cidr_block: 0.0.0.0/0
default_max_pods_constraint:
max_pods_per_node: '110'

```

##### EXPECTED RESULTS

```
TASK [Gathering Facts] ***********************************************************************************************************************************************
ok: [localhost]

TASK [create a cluster] **********************************************************************************************************************************************
changed: [localhost]
```

##### ACTUAL RESULTS

```paste below
TASK [Gathering Facts] ***********************************************************************************************************************************************
ok: [localhost]

TASK [create a cluster] **********************************************************************************************************************************************
ok: [localhost]
```

Contributor guide

Open the contributing guide

Research direction

Start with the google.cloud.gcp_container_cluster module and reproduce the two playbook runs using master_authorized_networks_config. Trace how the module compares editable cluster values, then verify that changing the CIDR from 10.0.0.0/8 to 0.0.0.0/0 reports changed and updates the cluster.

Written by the indexing model from the issue text.

Assessment

Tech stack
ansible, google-cloud, python
Domain
cloud, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
66/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.