operator-framework/helm-operator-plugins

Waches overrideValues feature seems not to support boolean values.

antonio-tolentino opened this issue · 2 comments

I maybe missing something but I am trying to install Tempo helm charts and it seems that the values passed are converted to string and helm can not compare the value correctly in situations you have sub-charts condition based. The same happens with the boolean values I am passing to the the application, they all arrived there as string.

Am I doing something wrong?

Manifest:

- group: obs.example.com
  version: v1alpha1
  kind: Tempo
  chart: helm-charts/tempo-distributed
  overrideValues:
    multitenancyEnabled: false
    reportingEnabled: false
    minio.enabled: false

Error:
Warning: Condition path 'minio.enabled' for chart minio returned non-bool value

Log:

{"level":"info","ts":"2023-07-03T08:53:21+02:00","logger":"cmd","msg":"Version","Go Version":"go1.19.10","GOOS":"linux","GOARCH":"amd64","helm-operator":"v1.30.0","commit":"b794fe909abc1affa1f28cfb75ceaf3bf79187e6"}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","logger":"cmd","msg":"Watch namespaces not configured by environment variable WATCH_NAMESPACE or file. Watching all namespaces.","Namespace":""}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","logger":"controller-runtime.metrics","msg":"Metrics server is starting to listen","addr":":8080"}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","logger":"helm.controller","msg":"Watching resource","apiVersion":"obs.example.com/v1alpha1","kind":"Tempo","namespace":"","reconcilePeriod":"1m0s"}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","logger":"helm.controller","msg":"Watching resource","apiVersion":"obs.example.com/v1alpha1","kind":"TempoHA","namespace":"","reconcilePeriod":"1m0s"}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","msg":"Starting server","path":"/metrics","kind":"metrics","addr":"[::]:8080"}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","msg":"Starting server","kind":"health probe","addr":"[::]:8081"}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","msg":"Starting EventSource","controller":"tempoha-controller","source":"kind source: *unstructured.Unstructured"}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","msg":"Starting Controller","controller":"tempoha-controller"}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","msg":"Starting EventSource","controller":"tempo-controller","source":"kind source: *unstructured.Unstructured"}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","msg":"Starting Controller","controller":"tempo-controller"}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","msg":"Starting workers","controller":"tempo-controller","worker count":14}
{"level":"info","ts":"2023-07-03T08:53:21+02:00","msg":"Starting workers","controller":"tempoha-controller","worker count":14}
2023/07/03 08:53:39 Warning: Condition path 'minio.enabled' for chart minio returned non-bool value
{"level":"error","ts":"2023-07-03T08:53:40+02:00","logger":"helm.controller","msg":"Release failed","namespace":"tempo","name":"tempo","apiVersion":"obs.example.com/v1alpha1","kind":"Tempo","release":"tempo","error":"failed to install release: unable to build kubernetes objects from release manifest: error validating \"\": error validating data: [ValidationError(Deployment.spec.template.spec.affinity): invalid type for io.k8s.api.core.v1.Affinity: got \"boolean\", expected \"map\", ValidationError(Deployment.spec.template.spec.topologySpreadConstraints): invalid type for io.k8s.api.core.v1.PodSpec.topologySpreadConstraints: got \"boolean\", expected \"array\"]","stacktrace":"github.com/operator-framework/operator-sdk/internal/helm/controller.HelmOperatorReconciler.Reconcile\n\tinternal/helm/controller/reconcile.go:243\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\t/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.5/pkg/internal/controller/controller.go:122\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.5/pkg/internal/controller/controller.go:323\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.5/pkg/internal/controller/controller.go:274\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.5/pkg/internal/controller/controller.go:235"}

Just to confirm, are you using code from this repository or from operator-sdk?

This repo uses strvals.ParseInto (which looks correct), but operator-sdk uses strvals.ParseIntoString (which seems like it would result in the issue you're experiencing).

Hi @joelanford,
Thank you for respond so fast.

I have downloaded operator-sdk using the instructions from https://sdk.operatorframework.io/docs/installation/.

Operator-sdk version:
operator-sdk version: "v1.30.0", commit: "b794fe909abc1affa1f28cfb75ceaf3bf79187e6", kubernetes version: "1.26.0", go version: "go1.19.10", GOOS: "linux", GOARCH: "amd64"

Project init:

operator-sdk init --plugins helm.sdk.operatorframework.io/v1 \
--domain=example.com \
--kind=Tempo \
--group=obs \
--version=v1alpha1 \
--helm-chart=tempo-distributed \
--helm-chart-repo=https://grafana.github.io/helm-charts \
--helm-chart-version=1.4.7

I have included the manifests I used to reproduce the situation in manifests.zip :
manifests.zip

Do you see anything strange or wrong?