flux2 icon indicating copy to clipboard operation
flux2 copied to clipboard

Reconciler error - Too long: may not be longer than 32768

Open sou-rsmoraes opened this issue 2 years ago • 1 comments

Describe the bug

Not able to apply values.yaml file from Airbyte using flux.

Steps to reproduce

Having a multi-tenancy repo, create a platform entry which applies your middlewares like Airbyte, using Helm Releases.

  1. Bootstrap flux from gitlab inside a specific folder from that git repo.
export GITLAB_TOKEN="<MY-TOKEN>"

flux bootstrap gitlab \
    --owner="my-group-in-gitlab/my-subgroup" \
    --repository="my-cluster-repo" \
    --hostname="gitlab.mydomain.com" \
    --token-auth \
    --branch master \
    --path=cluster

After bootstraping, you will have the following structure into your GitLab repo:

├── cluster
│   ├── flux-system
│   │   ├── gotk-components.yaml
│   │   ├── gotk-sync.yaml
│   │   ├── kustomization.yaml
  1. Create the following configuration files in order to install Airbyte as a Helm Release:
├── cluster
│   ├── flux-system
│   ├── platform.yaml
├── platform
│   ├── airbyte
│   │   ├── kustomization.yaml
│   │   ├── namespace.yaml
│   │   ├── release.yaml
│   │   ├── repository.yaml
└── .gitignore
  1. Make the files have the following content:

a. platform.yaml:

apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: airbyte
  namespace: flux-system
spec:
  interval: 10m0s
  sourceRef:
    kind: GitRepository
    name: flux-system
  path: ./platform/airbyte
  prune: true
  wait: true
  timeout: 5m0s

b. platform/airbyte/kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: airbyte
resources:
  - namespace.yaml
  - repository.yaml
  - release.yaml

c. platform/airbyte/namespace.yaml:

apiVersion: v1
kind: Namespace
metadata:
  name: airbyte
  labels:
    toolkit.fluxcd.io/tenant: data-team

d. platform/airbyte/release.yaml:

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: airbyte
  namespace: airbyte
spec:
  releaseName: comp-airbyte
  chart:
    spec:
      chart: airbyte
      sourceRef:
        kind: HelmRepository
        name: airbyte
  interval: 50m
  install:
    remediation:
      retries: 3

e. platform/airbyte/repository.yaml:

apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
  name: airbyte
  namespace: airbyte
spec:
  interval: 5m
  url: https://airbytehq.github.io/helm-charts

If you do the previous steps, commit the code, it will work properly since the Helm Release will be applied with default Airbyte values.yaml file.

  1. Now, create a custom values.yaml value to host your own Airbyte configurations, like using an external Postgres.
├── cluster
│   ...
├── platform
│   ├── airbyte
│   │   ├── ...
│   │   ├── values.yaml
└── .gitignore

a. Use the default one used by Airbyte test scenarios: https://github.com/airbytehq/airbyte-platform/blob/main/charts/airbyte/values.yaml

b. Change the externalDatabase or any other entry, like enabling metrics (https://github.com/airbytehq/airbyte-platform/blob/main/charts/airbyte/values.yaml#L925)

...

## @section Metrics parameters
metrics:
  enabled: true
  1. Result, since the values.yaml is very big, not being able to complete the reconciliation.

a. Running flux get kustomizations we get READY as Unknown and MESSAGE as Reconciliation in progress.

b. Running flux logs --flux-namespace=flux-system --kind=Kustomization we get the following error message:

2023-12-12T17:16:23.983Z error Kustomization/airbyte.flux-system - Reconciler error Kustomization.kustomize.toolkit.fluxcd.io "airbyte" is invalid: status.conditions[1].message: Too long: may not be longer than 32768

Expected behavior

Applied revision and reconciliation completed.

For sure, I do not need to get the entire values.yaml as I did but I believe, there will be use cases in which this size is a limitation.

Screenshots and recordings

No response

OS / Distro

kubernetes Version: 1.25.6 / Kustomize Version: v5.0.1

Flux version

2.1.2

Flux check

✗ flux 2.1.2 <2.2.0 (new version is available, please upgrade) ✔ Kubernetes 1.25.6 >=1.25.0-0 ► checking controllers ✔ helm-controller: deployment ready ► ghcr.io/fluxcd/helm-controller:v0.36.2 ✔ kustomize-controller: deployment ready ► ghcr.io/fluxcd/kustomize-controller:v1.1.1 ✔ notification-controller: deployment ready ► ghcr.io/fluxcd/notification-controller:v1.1.0 ✔ source-controller: deployment ready ► ghcr.io/fluxcd/source-controller:v1.1.2 ► checking crds ✔ alerts.notification.toolkit.fluxcd.io/v1beta2 ✔ buckets.source.toolkit.fluxcd.io/v1beta2 ✔ gitrepositories.source.toolkit.fluxcd.io/v1 ✔ helmcharts.source.toolkit.fluxcd.io/v1beta2 ✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1 ✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2 ✔ kustomizations.kustomize.toolkit.fluxcd.io/v1 ✔ ocirepositories.source.toolkit.fluxcd.io/v1beta2 ✔ providers.notification.toolkit.fluxcd.io/v1beta2 ✔ receivers.notification.toolkit.fluxcd.io/v1 ✔ all checks passed

Git provider

GitLab

Container Registry provider

No response

Additional context

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

sou-rsmoraes avatar Dec 12 '23 17:12 sou-rsmoraes

The error is misleading, and I suspect your YAML is malformed which causes the kustomize-controller to print it in the Ready condition message.

We should however ensure that if messages exceed the maximum length, we trim them.

hiddeco avatar Dec 12 '23 17:12 hiddeco