Skip to content

Commit

Permalink
images: Replace all instances of the depreciated k8s_facts module wit…
Browse files Browse the repository at this point in the history
…h k8s_info.

When using the 2.9.6 Ansible version, the time it takes for Metering to finish its role execution jumps from 3-5 minutes to ~35-40 minutes. If we increase the verbosity of the ansible logs for the Metering deployment, in 2.9.6, we see that the `k8s_facts` tasks are making a file lookup call orders of magnitude more often, whereas before, that file lookup call was made once or twice.

A more concrete example:
```yaml
ASK [meteringconfig : Check for the existence of the Presto TLS secret] *******
task path: /opt/ansible/roles/meteringconfig/tasks/configure_presto_tls.yml:15

Wednesday 29 April 2020  21:43:56 +0000 (0:00:00.380)       0:00:38.695 *******
File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file

File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file

File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file

File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file

File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file

File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file

File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file

File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file

File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file

File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file

File lookup using /opt/ansible/charts/openshift-metering/values.yaml as file
...
```

If we switch to the [`k8s_info` module](https://docs.ansible.com/ansible/latest/modules/k8s_info_module.html), the performance issues are resolved and that file lookup call is only made once or twice.
  • Loading branch information
timflannagan committed Apr 30, 2020
1 parent 0c8a30c commit 3c8a6af
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- name: Check for the existence of Hive TLS-related secrets
block:
- name: Check for the existence of the Hive Metastore TLS secret
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec.hive.spec.metastore.config.tls.secretName }}"
Expand All @@ -22,7 +22,7 @@
register: hive_metastore_tls_buf

- name: Check for the existence of the Hive Server Metastore TLS secret
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec.hive.spec.server.config.metastoreTLS.secretName }}"
Expand All @@ -31,7 +31,7 @@
register: hive_server_client_tls_buf

- name: Check for the existence of the Hive Server TLS secret
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec.hive.spec.server.config.tls.secretName }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Get the Openshift cluster's networking config object
- name: Check the IP version infrastructure provisioned
k8s_facts:
k8s_info:
api_version: "config.openshift.io/v1"
kind: Network
name: cluster
Expand Down Expand Up @@ -31,7 +31,7 @@
# Cluster Proxy Configuration
#
- name: Check if the cluster-wide Proxy configured
k8s_facts:
k8s_info:
api_version: "config.openshift.io/v1"
kind: Proxy
name: cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- name: Check for the existence of Presto TLS-related secrets
block:
- name: Check for the existence of the Presto TLS secret
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec.presto.spec.config.tls.secretName }}"
Expand All @@ -22,7 +22,7 @@
register: presto_secret_tls_buf

- name: Check for the existence of the Presto Auth secret
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec.presto.spec.config.auth.secretName }}"
Expand All @@ -31,7 +31,7 @@
register: presto_secret_auth_buf

- name: Check for the existence of the Presto-Hive client TLS secret
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec.presto.spec.config.connectors.hive.tls.secretName }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- name: Check for the existence of the reporting-operator Presto TLS-related secrets
block:
- name: Check for the existence of the reporting-operator Presto client auth secret
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec['reporting-operator'].spec.config.presto.auth.secretName }}"
Expand Down Expand Up @@ -52,7 +52,7 @@
- name: Check for the existence of reporting-operator Hive TLS-related secrets
block:
- name: Check for the existence of the reporting-operator Hive client auth secret
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec['reporting-operator'].spec.config.hive.auth.secretName }}"
Expand Down Expand Up @@ -92,7 +92,7 @@
- name: Check for the existence of reporting-operator authProxy-related secret data
block:
- name: Check for the existence of the reporting-operator authProxy cookie seed secret
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec['reporting-operator'].spec.authProxy.cookie.secretName }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- name: Check for the existence of the Metering Root CA secret
block:
- name: Check if Root CA secret already exists
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec.tls.secretName }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
when: meteringconfig_storage_s3_create_bucket

- name: Attempt to obtain the AWS credentials secret in the "{{ meta.namespace}}" namespace
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_storage_s3_aws_credentials_secret_name }}"
Expand Down Expand Up @@ -114,7 +114,7 @@
- name: Get azure storage account name
block:
- name: Get Azure storage credentials secret
k8s_facts:
k8s_info:
api_version: v1
kind: Secret
name: "{{ meteringconfig_spec.storage.hive.azure.secretName }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

- name: Query for {{ resource.apis | map(attribute='kind') | join(', ') }} resources with selector {{ label_selector }} to delete
k8s_facts:
k8s_info:
api_version: "{{ to_delete_item.api_version | default(omit) }}"
kind: "{{ to_delete_item.kind }}"
namespace: "{{ namespace }}"
Expand Down

0 comments on commit 3c8a6af

Please sign in to comment.