Skip to content

Support yaml 1.2 #791

Open
Open
@M0NsTeRRR

Description

@M0NsTeRRR
SUMMARY

Any component that uses pyyaml (like kubernetes.core.k8s in my case) is affected by the fact that pyyaml currently does not support YAML 1.2. One of the maintainers noted in an issue that we can use an alternative library (developed by him) as a workaround until pyyaml is updated to support YAML 1.2.

ISSUE TYPE
  • Use yamlcore on top of pyyaml until pyyaml support YAML 1.2 spec.
COMPONENT NAME

Every components that use pyyaml.

ADDITIONAL INFORMATION

In this reproducible example, my playbook applies a Kustomize file that deploys a Helm chart. In a production scenario, my Kustomize setup would include a Helm chart along with additional components. Why do I use Ansible this way instead of using the helm components? This is because I’m using the playbook only for the initial setup; after that, ArgoCD takes over and synchronizes changes to this Kustomize file.

CRDs : https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus-operator-crds/charts/crds/templates

Linked PR on CRDs : prometheus-operator/prometheus-operator#4897

Playbook

---
- name: Deploy prometheus-operator-crds
  hosts: kubernetes_master[0]
  become: true
  tasks:
    - name: "Install kubernetes base infra first part"
      kubernetes.core.k8s:
        definition: "{{ lookup('kubernetes.core.kustomize', dir='../argocd/monitoring/prometheus-operator-crds', enable_helm=True) }}"
        wait: true
        kubeconfig: "/home/vscode/.kube/homelab"
        validate_certs: true
      delegate_to: localhost

Kustomize file

---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: &namespace prometheus-operator-crds

helmCharts:
- name: prometheus-operator-crds
  releaseName: prometheus-operator-crds
  namespace: *namespace
  repo: https://prometheus-community.github.io/helm-charts
  version: 16.0.0

Error

An exception occurred during task execution. To see the full traceback, use -vvv. The error was:                                 ^
fatal: [master1.unicornafk.fr -> localhost]: FAILED! => changed=false 
  msg: |-
    Failed to load resource definition: could not determine a constructor for the tag 'tag:yaml.org,2002:value'
      in "<unicode string>", line 9903, column 29:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions