ansible / awx-operator

An Ansible AWX operator for Kubernetes built with Operator SDK and Ansible. 🤖
https://www.github.com/ansible/awx
Apache License 2.0
1.24k stars 626 forks source link

yaml.scanner.ScannerError: mapping values are not allowed here when trying to set extra env vars #118

Closed adammike closed 3 years ago

adammike commented 3 years ago

When trying to use this YAML, I get mapping values are not allowed here in the operator logs

---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: awx
spec:
  deployment_type: awx
  ca_trust_bundle: /etc/ca-bundle/ca_bundle.pem
  tower_admin_user: admin
  tower_admin_email: <redacted>
  tower_replicas: 3
  tower_hostname: <redacted>
  tower_postgres_configuration_secret: awx-db-configuration
  tower_ingress_type: Ingress
  tower_ingress_tls_secret: awx-tls-secret
  tower_web_extra_env: |2
    - name: LDAPTLS_REQCERT
      value: "never"
  tower_task_extra_env: |2
    - name: LDAPTLS_REQCERT
      value: "never"
  tower_ingress_annotations: |
      kubernetes.io/ingress.class: private-iks-k8s-nginx
  tower_task_extra_volume_mounts: |
    - name: ca-bundle
      mountPath: /etc/ca-bundle
  tower_extra_volumes: |
    - name: ca-bundle
      secret:
        secretName: awx-ca-bundle
  tower_web_extra_volume_mounts: |
    - name: ca-bundle
      mountPath: /etc/ca-bundle

I've tried every version of spacing.. adding spaces, removing spaces, forcing an indent using |2, |4, nothing I do gets the environment variables to work..

 self.get_mark())\\nyaml.scanner.ScannerError: mapping values are not allowed here\\n  in \\\"<unicode string>\\\", line 74, column 31:\\n                            - name: LDAPTLS_REQCERT\\n                                  ^\\n\", 
Spredzy commented 3 years ago

The above PR (https://github.com/ansible/awx-operator/pull/125) fixes this issue.

Thank you for providing the exact spec file you used, it made it easy to reproduce and fix :+1:

If you want to test it locally, you will have to rebuild the operator container, and update the locally downloaded version of https://raw.githubusercontent.com/ansible/awx-operator/devel/deploy/awx-operator.yaml to make it points to your freshly built operator container.