Closed cblument closed 2 months ago
The kubernetes.core ansible collection needs to updated to 3.2.0 to utilize the enable_helm attribute of the kubernetes.core.kustomize.lookup which was added in 3.1.0
See:
Ansible task example:
- name: Deply mariadb operator kubernetes.core.k8s: definition: "{{ lookup('kubernetes.core.kustomize', binary_path='/usr/local/bin/kubectl', dir='/opt/genestack/kustomize/mariadb-operator', enable_helm=True) }}" namespace: mariadb-system apply: true server_side_apply: field_manager: ansible force_conflicts: true state: present
When the play is run with kubernetes .core 3.0.0
(genestack) ubuntu@openstack-flex-launcher-cluster-local:/opt/genestack$ ansible-galaxy collection list| grep kub kubernetes.core 3.0.0 kubernetes.core 2.4.0 (genestack) ubuntu@openstack-flex-launcher-cluster-local:/opt/genestack$ ansible-playbook ~/genestack_post_deploy.yaml --tag mariadb PLAY [Label stoage nodes] ****************************************************************************************************************************************************** PLAY [Label control plane nodes] *********************************************************************************************************************************************** PLAY [Label nova compute nodes] ************************************************************************************************************************************************ PLAY [Label openstack network nodes] ******************************************************************************************************************************************* [WARNING]: Could not match supplied host pattern, ignoring: openstack_worker_nodes PLAY [Label worker nodes] ****************************************************************************************************************************************************** PLAY [Remove taint from controllers] ******************************************************************************************************************************************* PLAY [Deploy k8s dashboard] **************************************************************************************************************************************************** PLAY [Deploy prometheus] ******************************************************************************************************************************************************* PLAY [Make helm charts] ******************************************************************************************************************************************************** PLAY [Ceph internal] *********************************************************************************************************************************************************** PLAY [OpenStack namespace] ***************************************************************************************************************************************************** PLAY [MariaDB] ***************************************************************************************************************************************************************** TASK [Gathering Facts] ********************************************************************************************************************************************************* ok: [localhost] TASK [Get secret if exists] **************************************************************************************************************************************************** ok: [localhost] TASK [Create secret if it does not exist] ************************************************************************************************************************************** skipping: [localhost] TASK [Set cluster name in kustomize file] ************************************************************************************************************************************** ok: [localhost] TASK [Deply mariadb operator] ************************************************************************************************************************************************** fatal: [localhost]: FAILED! => {"msg": "kustomize command failed with: error: trouble configuring builtin HelmChartInflationGenerator with config: `\nincludeCRDs: true\nname: m ariadb-operator\nnamespace: mariadb-system\nreleaseName: mariadb-operator\nrepo: https://mariadb-operator.github.io/mariadb-operator\nvaluesInline:\n affinity:\n nodeAffini ty:\n requiredDuringSchedulingIgnoredDuringExecution:\n nodeSelectorTerms:\n - matchExpressions:\n - key: node-role.kubernetes.io/worker\n operator: In\n values:\n - worker\n clusterName: cluster.local\n metrics:\n enabled: true\n webhook:\n affinity:\n nodeAffinity:\n requiredDuringSchedulingIgnoredDuringExecution:\n nodeSelectorTerms:\n - matchExpressions:\n - key: node-role.kubernetes.io/worker\n o perator: In\n values:\n - worker\n cert:\n certManager:\n enabled: true\nversion: 0.28.1\n`: must specify --enable-helm\n"} PLAY RECAP ********************************************************************************************************************************************************************* localhost : ok=3 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0 (genestack) ubuntu@openstack-flex-launcher-cluster-local:/opt/genestack$
When the play is run with kubernetes.core 3.2.0
(genestack) ubuntu@openstack-flex-launcher-cluster-local:/opt/genestack$ ansible-galaxy collection list| grep kub kubernetes.core 3.2.0 kubernetes.core 2.4.0 (genestack) ubuntu@openstack-flex-launcher-cluster-local:/opt/genestack$ ansible-playbook ~/genestack_post_deploy.yaml --tag mariadb PLAY [Label stoage nodes] ****************************************************************************************************************************************************** PLAY [Label control plane nodes] *********************************************************************************************************************************************** PLAY [Label nova compute nodes] ************************************************************************************************************************************************ PLAY [Label openstack network nodes] ******************************************************************************************************************************************* [WARNING]: Could not match supplied host pattern, ignoring: openstack_worker_nodes PLAY [Label worker nodes] ****************************************************************************************************************************************************** PLAY [Remove taint from controllers] ******************************************************************************************************************************************* PLAY [Deploy k8s dashboard] **************************************************************************************************************************************************** PLAY [Deploy prometheus] ******************************************************************************************************************************************************* PLAY [Make helm charts] ******************************************************************************************************************************************************** PLAY [Ceph internal] *********************************************************************************************************************************************************** PLAY [OpenStack namespace] ***************************************************************************************************************************************************** PLAY [MariaDB] ***************************************************************************************************************************************************************** TASK [Gathering Facts] ********************************************************************************************************************************************************* ok: [localhost] TASK [Get secret if exists] **************************************************************************************************************************************************** ok: [localhost] TASK [Create secret if it does not exist] ************************************************************************************************************************************** skipping: [localhost] TASK [Set cluster name in kustomize file] ************************************************************************************************************************************** ok: [localhost] TASK [Deply mariadb operator] ************************************************************************************************************************************************** changed: [localhost] TASK [Wait for mariadb operator webhook pod conditions] ************************************************************************************************************************ ok: [localhost] => (item=Ready) ok: [localhost] => (item=ContainersReady) PLAY RECAP ********************************************************************************************************************************************************************* localhost : ok=5 changed=1 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0 (genestack) ubuntu@openstack-flex-launcher-cluster-local:/opt/genestack$
And the playbook completes without error.
The kubernetes.core ansible collection needs to updated to 3.2.0 to utilize the enable_helm attribute of the kubernetes.core.kustomize.lookup which was added in 3.1.0
See:
Ansible task example:
When the play is run with kubernetes .core 3.0.0
When the play is run with kubernetes.core 3.2.0
And the playbook completes without error.