grafana / grafana-operator

An operator for Grafana that installs and manages Grafana instances, Dashboards and Datasources through Kubernetes/OpenShift CRs
https://grafana.github.io/grafana-operator/
Apache License 2.0
892 stars 392 forks source link

Lack of documentation when `kubectl explain` #1685

Closed gecube closed 2 weeks ago

gecube commented 3 weeks ago

Like a DevOps I expect that kubectl explain GrafanaDashboard.spec.datasources would give me some meaningful output. Right not it returns

$ kubectl explain GrafanaDashboard.spec.datasources
GROUP:      grafana.integreatly.org
KIND:       GrafanaDashboard
VERSION:    v1beta1

FIELD: datasources <[]Object>

DESCRIPTION:
    <empty>
FIELDS:
  datasourceName    <string> -required-
    <no description>

  inputName <string> -required-
    <no description>

It is very basic information. I'd like to see the documentation like for the embedded k8s api resources:

$ kubectl explain deployment.metadata.name
GROUP:      apps
KIND:       Deployment
VERSION:    v1

FIELD: name <string>

DESCRIPTION:
    Name must be unique within a namespace. Is required when creating resources,
    although some resources may allow a client to request the generation of an
    appropriate name automatically. Name is primarily intended for creation
    idempotence and configuration definition. Cannot be updated. More info:
    https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names

or good and mature operators like FluxCD:

$ kubectl explain helmrelease.spec.values
GROUP:      helm.toolkit.fluxcd.io
KIND:       HelmRelease
VERSION:    v2

FIELD: values <Object>

DESCRIPTION:
    Values holds the values for this Helm release.
theSuess commented 3 weeks ago

Thanks for reporting this. This is definitely something we're interested in merging, but currently not our highest priority. If you have the time, we'd appreciate a PR. Otherwise, this will have to wait until one of us has some downtime

theSuess commented 3 weeks ago

Revisiting this issue, I've checked against my installation where descriptions are present. How did you install the operator to test this?

We had issues with missing descriptions before, so I'd like to make sure they are still present in all installation methods (see #1567 for context)

gecube commented 3 weeks ago

@theSuess thanks. I will check and report back to you.

gecube commented 2 weeks ago

@theSuess So I found the reason. I used https://github.com/aenix-io/cozystack where the grafana-operator of old version (~ half a year ago) was used. Unfortunately, helm upgrade for some reason DOES NOT updates CRDs.

https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations

There is no support at this time for upgrading or deleting CRDs using Helm. This was an explicit decision after much community discussion due to the danger for unintentional data loss. Furthermore, there is currently no community consensus around how to handle CRDs and their lifecycle. As this evolves, Helm will add support for those use cases.

The tools like FluxCD and ArgoCD solves this issue with their own features. Like https://fluxcd.io/flux/components/helm/helmreleases/#controlling-the-lifecycle-of-custom-resource-definitions

I think the issue could be closed as there is no good solution for upgrading CRDs with current tools.

theSuess commented 2 weeks ago

Yeah, it really sucks that helm doesn't do CRD updates. We have the full instructions for manual upgrades in our documenation: https://grafana.github.io/grafana-operator/docs/installation/helm/#upgrading

Thanks for taking a closer look at what caused this in your case!