Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix helmchartconfig indent #291

Merged

Conversation

deathjoin
Copy link
Contributor

Description

This PR fixes indent for HelmChartConfig. While current indent works fine for one-field config, trying to add second dict item will result in only the first being rendered.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Small minor change not affecting the Ansible Role code (GitHub Actions Workflow, Documentation etc.)

How Has This Been Tested?

Playbook for testing

- name: Deploy RKE2
  hosts: k8s_cluster
  become: no
  gather_facts: no
  vars:
    rke2_ingress_nginx_values:
      tcp: 
        "389": "ldap/ldap-prod:389"
      controller: 
        config:
          whitelist-source-range: "192.168.0.0/24"
  tasks:
    - name: copy the output to a local file
      copy:
        content: "{{ lookup('template', 'roles/rke2/templates/ingress-nginx-config.yml.j2') }}"
        dest: "hello.yaml"
      delegate_to: localhost

Run with current template result

Notice tcp is outside valuesContent block

apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
  name: rke2-ingress-nginx
  namespace: kube-system
spec:
  valuesContent: |-
    controller:
      config:
          whitelist-source-range: 192.168.0.0/24
  tcp:
      '389': ldap/ldap-prod:389

Run with fixed template result

Now indent is correct for all items

apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
  name: rke2-ingress-nginx
  namespace: kube-system
spec:
  valuesContent: |-
    controller:
      config:
        whitelist-source-range: 192.168.0.0/24
    tcp:
      '389': ldap/ldap-prod:389

Fix only first item being properly indented resulting in loosing all other items
@MonolithProjects MonolithProjects added the bug Something isn't working label Dec 23, 2024
Copy link
Collaborator

@MonolithProjects MonolithProjects left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks

@MonolithProjects MonolithProjects merged commit 597c980 into lablabs:main Dec 23, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants