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

HelmRelease not able to work with customresourcedefinition PostgresService #4743

Open
1 task done
akumari144088 opened this issue Apr 25, 2024 · 6 comments
Open
1 task done

Comments

@akumari144088
Copy link

Describe the bug

HelmRelease not able to work postgres database. It doesnt process the code for customresourcedefinition PostgresService

Below is the chunk of the code for that crd.
patroni:
clusterName: {{default "patroni" .Values.patroni.clusterName}}
dcs:
type: {{ default "kubernetes" .Values.patroni.dcs.type }}
{{ if or (eq .Values.patroni.dcs.type "etcd3") (eq .Values.patroni.dcs.type "etcd") }}

Helm Release is not able to process this. It process it as syntax error. However this code is working fine the in environment but somehow helmrelease is not able to process it. It gives below error
YAML parse error on postgres-operator-chart/templates/cr.yaml: error converting YAML to JSON: yaml: line 27: found character that cannot start any token

Steps to reproduce

Install flux with gitrepsitory controllers and helmrelease controllers
Install postgres helm charts and try to install it with crd postgresservices

Expected behavior

It should run without failure and create the postgresservices customresourcedefintion

Screenshots and recordings

No response

OS / Distro

centos

Flux version

https://github.com/fluxcd/flux2/releases/latest/download/install.yaml

Flux check

NA

Git provider

No response

Container Registry provider

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@souleb
Copy link
Member

souleb commented Apr 25, 2024

Hi, can you put code in code blocks? It will be easier to read. Can you provide the outputs of flux check and kubectl describe helmrelease

@akumari144088
Copy link
Author

    clusterName: {{default "patroni" .Values.patroni.clusterName}}
    dcs:
      type: {{ default "kubernetes" .Values.patroni.dcs.type }}
      {{ if or (eq .Values.patroni.dcs.type "etcd3") (eq .Values.patroni.dcs.type "etcd") }}

flux check output -
[root@localhost .kube]# kubectl logs -f flux-cli-setup-dxzgn -n flux-system
► checking prerequisites
✔ Kubernetes 1.26.3 >=1.25.0-0
► checking controllers
✔ helm-controller: deployment ready
► artifactorycn.netcracker.com:17114/fluxcd/helm-controller:v0.37.4
✔ image-automation-controller: deployment ready
► artifactorycn.netcracker.com:17114/fluxcd/image-automation-controller:v0.37.1
✔ image-reflector-controller: deployment ready
► artifactorycn.netcracker.com:17114/fluxcd/image-reflector-controller:v0.31.2
✔ kustomize-controller: deployment ready
► artifactorycn.netcracker.com:17114/fluxcd/kustomize-controller:v1.2.2
✔ notification-controller: deployment ready
► artifactorycn.netcracker.com:17114/fluxcd/notification-controller:v1.2.4
✔ source-controller: deployment ready
► artifactorycn.netcracker.com:17114/fluxcd/source-controller:v1.2.4
► checking crds
✔ alerts.notification.toolkit.fluxcd.io/v1beta3
✔ buckets.source.toolkit.fluxcd.io/v1beta2
✔ gitrepositories.source.toolkit.fluxcd.io/v1
✔ helmcharts.source.toolkit.fluxcd.io/v1beta2
✔ helmreleases.helm.toolkit.fluxcd.io/v2beta2
✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2
✔ imagepolicies.image.toolkit.fluxcd.io/v1beta2
✔ imagerepositories.image.toolkit.fluxcd.io/v1beta2
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta1
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1
✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta3
✔ receivers.notification.toolkit.fluxcd.io/v1
✔ all checks passed

output of describe helmrelease -
Type Reason Age From Message


Warning InstallFailed helm-controller Helm install failed for release infra-test/postgres-operator-chart with chart [email protected]: YAML parse error on postgres-operator-chart/templates/cr.yaml: error converting YAML to JSON: yaml: line 27: found character that cannot start any token

Last Helm logs:

2024-04-25T06:15:28.219986786Z: skipping CustomResourceDefinition apply: policy is set to Skip
Warning InstallFailed helm-controller Helm install failed for release infra-test/postgres-operator-chart with chart [email protected]: YAML parse error on postgres-operator-chart/templates/cr.yaml: error converting YAML to JSON: yaml: line 27: found character that cannot start any token

@souleb
Copy link
Member

souleb commented Apr 25, 2024

can you also provide the .spec so I can reproduce this?

@akumari144088
Copy link
Author

akumari144088 commented Apr 25, 2024

spec:
      chart: ./xxxx
      sourceRef:
        kind: GitRepository
        name: flux-git-repo
        namespace: flux-system
  releaseName: postgres-operator-chart
  targetNamespace: infra-test
  test:
    enable: true
  values:
    replicatorPassword: xxxx
    siteManager:
      install: false
    patroni:
      clusterName: "patroni"
      powa:
        install: true
      dcs:
        type: kubernetes
        hosts:
          - host: "etcd1.example.com"
            port: 2379
    connectionPooler:
        install: false
    postgresExporter:
        install: false
    serviceAccount:
     create: true
     name: "postgres-sa"
    metricCollector:
      prometheusRules:
        backupAlertThreshold: 5
        alertDelay: 3m
    dbaas:
      adapter:
        address: xxxx
      vaultIntegration:
        enabled: false
    policies:
      tolerations:
    operator:
      podLabels: {}
   operatorInit:
      image: "xxxxt"
      resources:
        limits:
          cpu: 50m
          memory: 50Mi
        requests:
          cpu: 50m
          memory: 50Mi
    operator:
      resources:
        limits:
          cpu: 50m
          memory: 50Mi
        requests:
          cpu: 50m
          memory: 50Mi
  install:
    disableHooks: true 

@souleb
Copy link
Member

souleb commented Apr 25, 2024

I see that you own the chart git repository. The issue here is with the chart. Maybe use helm lint? There is also https://github.com/helm/chart-testing for testing your chart.

@akumari144088
Copy link
Author

@souleb It was not a syntax problem. There was problem in overrding values which is fixed now. But thanks for pointing me in right direction.

I have one other issue though. Its about dynamic manipulation of config map. Does HelmRelease doesnt allow it? Below is the config and error

data:
  security-configurations.tar.gz: |-
    {{- "\n" }}
    {{- .Files.Get "tar_archive.tar.gz" | b64enc | indent 4 }}
    ```
    
    Error msg -
    [2024-04-26 04:35:39.649] [INFO] [caller=kubernetes_service] Kubernetes version=v1.26.3
[2024-04-26 04:35:39.656] [FATAL] [caller=main] can not get configs from tar.gz: EOF
panic: can not get configs from tar.gz: EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants