Skip to content

Commit

Permalink
Update kubernetes.core ansible collection to 3.2.0 (rackerlabs#334)
Browse files Browse the repository at this point in the history
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:
- https://github.com/ansible-collections/kubernetes.core/blob/main/CHANGELOG.rst#v3-1-0
- ansible-collections/kubernetes.core#568

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$ export SSH_AUTH_SOCK=/tmp/ssh-XXXXEaumni/agent.109689
(genestack) ubuntu@openstack-flex-launcher-cluster-local:/opt/genestack$ ansible-playbook ~/genestack_post_deploy.yaml --tag mariadb
[WARNING]:  * Failed to parse /etc/genestack/inventory/inventory.yaml.example with ini plugin: Invalid host pattern 'all:' supplied, ending in ':' is not allowed, this
character is reserved to provide a port.                                                                                                                                        [WARNING]: Unable to parse /etc/genestack/inventory/inventory.yaml.example as an inventory source                                                                               [WARNING]: Skipping 'apiVersion' as this is not a valid group definition                                                                                                        [WARNING]: Skipping 'kind' as this is not a valid group definition                                                                                                              [WARNING]: Skipping key (name) in group (metadata) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleUnicode'>                                        [WARNING]: Skipping unexpected key (annotations) in group (metadata), only "vars", "children" and "hosts" are valid
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
[WARNING]:  * Failed to parse /etc/genestack/inventory/inventory.yaml.example with ini plugin: Invalid host pattern 'all:' supplied, ending in ':' is not allowed, this
character is reserved to provide a port.
[WARNING]: Unable to parse /etc/genestack/inventory/inventory.yaml.example as an inventory source
[WARNING]: Skipping 'apiVersion' as this is not a valid group definition
[WARNING]: Skipping 'kind' as this is not a valid group definition
[WARNING]: Skipping key (name) in group (metadata) as it is not a mapping, it is a <class 'ansible.parsing.yaml.objects.AnsibleUnicode'>
[WARNING]: Skipping unexpected key (annotations) in group (metadata), only "vars", "children" and "hosts" are valid

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.

Signed-off-by: Chris Blumentritt <[email protected]>
  • Loading branch information
cblument authored Jun 27, 2024
1 parent ebaf03e commit f31a647
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ansible-collection-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ collections:
version: 2.1.0
type: git
- name: https://github.com/ansible-collections/kubernetes.core
version: 3.0.0
version: 3.2.0
type: git

0 comments on commit f31a647

Please sign in to comment.