Skip to content

Commit f8f6e0a

Browse files
authored
Upgrade grafana operator to the latest available version (#356)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes - **New Features** - Updated Helm chart and application versions for Grafana Operator. - Introduced new Custom Resource Definitions (CRDs) for managing alert rules, contact points, notification policies, and more. - Added support for ServiceMonitor to enhance Prometheus scraping capabilities. - New configuration options for better customization, including `watchNamespaceSelector`, `isOpenShift`, and `namespaceOverride`. - **Documentation** - Expanded README with Terraform installation instructions and upgrade guidelines. - Enhanced descriptions for configuration options to improve clarity. - **Bug Fixes** - Improved RBAC configurations to ensure proper permissions in Kubernetes environments. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: George Gaál <[email protected]>
1 parent cd0be91 commit f8f6e0a

21 files changed

Lines changed: 7248 additions & 258 deletions

‎packages/system/grafana-operator/charts/grafana-operator/Chart.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.1.2
18+
version: 0.3.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "v5.6.0"
24+
appVersion: "v5.13.0"

‎packages/system/grafana-operator/charts/grafana-operator/README.md‎

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,45 @@ linkTitle: "Helm installation"
77

88
[grafana-operator](https://github.com/grafana/grafana-operator) for Kubernetes to manage Grafana instances and grafana resources.
99

10-
![Version: 0.1.2](https://img.shields.io/badge/Version-0.1.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v5.6.0](https://img.shields.io/badge/AppVersion-v5.6.0-informational?style=flat-square)
10+
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v5.13.0](https://img.shields.io/badge/AppVersion-v5.13.0-informational?style=flat-square)
1111

1212
## Installation
1313

1414
This is a OCI helm chart, helm started support OCI in version 3.8.0.
1515

1616
```shell
17-
helm upgrade -i grafana-operator oci://ghcr.io/grafana/helm-charts/grafana-operator --version v5.6.0
17+
helm upgrade -i grafana-operator oci://ghcr.io/grafana/helm-charts/grafana-operator --version v5.13.0
1818
```
1919

2020
Sadly helm OCI charts currently don't support searching for available versions of a helm [oci registry](https://github.com/helm/helm/issues/11000).
2121

22+
### Using Terraform
23+
24+
To install the helm chart using terraform, make sure you use the right values for `repository` and `name` as shown below:
25+
26+
```hcl
27+
resource "helm_release" "grafana_kubernetes_operator" {
28+
name = "grafana-operator"
29+
namespace = "default"
30+
repository = "oci://ghcr.io/grafana/helm-charts"
31+
chart = "grafana-operator"
32+
verify = false
33+
version = "v5.13.0"
34+
}
35+
```
36+
37+
## Upgrading
38+
39+
Helm does not provide functionality to update custom resource definitions. This can result in the operator misbehaving when a release contains updates to the custom resource definitions.
40+
To avoid issues due to outdated or missing definitions, run the following command before updating an existing installation:
41+
42+
```shell
43+
kubectl apply --server-side --force-conflicts -f https://github.com/grafana/grafana-operator/releases/download/v5.13.0/crds.yaml
44+
```
45+
46+
The `--server-side` and `--force-conflict` flags are required to avoid running into issues with the `kubectl.kubernetes.io/last-applied-configuration` annotation.
47+
By using server side apply, this annotation is not considered. `--force-conflict` allows kubectl to modify fields previously managed by helm.
48+
2249
## Development
2350

2451
For general and helm specific development instructions please read the [CONTRIBUTING.md](../../../CONTRIBUTING.md)
@@ -38,24 +65,39 @@ It's easier to just manage this configuration outside of the operator.
3865
| additionalLabels | object | `{}` | additional labels to add to all resources |
3966
| affinity | object | `{}` | pod affinity |
4067
| env | list | `[]` | Additional environment variables |
41-
| fullnameOverride | string | `""` | |
68+
| extraObjects | list | `[]` | Array of extra K8s objects to deploy |
69+
| fullnameOverride | string | `""` | Overrides the fully qualified app name. |
4270
| image.pullPolicy | string | `"IfNotPresent"` | The image pull policy to use in grafana operator container |
4371
| image.repository | string | `"ghcr.io/grafana/grafana-operator"` | grafana operator image repository |
4472
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
4573
| imagePullSecrets | list | `[]` | image pull secrets |
74+
| isOpenShift | bool | `false` | Determines if the target cluster is OpenShift. Additional rbac permissions for routes will be added on OpenShift |
4675
| leaderElect | bool | `false` | If you want to run multiple replicas of the grafana-operator, this is not recommended. |
4776
| metricsService.metricsPort | int | `9090` | metrics service port |
77+
| metricsService.pprofPort | int | `8888` | port for the pprof profiling endpoint |
4878
| metricsService.type | string | `"ClusterIP"` | metrics service type |
49-
| nameOverride | string | `""` | |
79+
| nameOverride | string | `""` | Overrides the name of the chart. |
80+
| namespaceOverride | string | `""` | Overrides the namespace name. |
5081
| namespaceScope | bool | `false` | If the operator should run in namespace-scope or not, if true the operator will only be able to manage instances in the same namespace |
5182
| nodeSelector | object | `{}` | pod node selector |
5283
| podAnnotations | object | `{}` | pod annotations |
5384
| podSecurityContext | object | `{}` | pod security context |
5485
| priorityClassName | string | `""` | pod priority class name |
86+
| rbac.create | bool | `true` | Specifies whether to create the ClusterRole and ClusterRoleBinding. If "namespaceScope" is true or "watchNamespaces" is set, this will create Role and RoleBinding instead. |
5587
| resources | object | `{}` | grafana operator container resources |
5688
| securityContext | object | `{"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsNonRoot":true}` | grafana operator container security context |
5789
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
5890
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
5991
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
92+
| serviceMonitor | object | `{"additionalLabels":{},"enabled":false,"interval":"1m","metricRelabelings":[],"relabelings":[],"scrapeTimeout":"10s","targetLabels":[],"telemetryPath":"/metrics"}` | Enable this to use with Prometheus Operator |
93+
| serviceMonitor.additionalLabels | object | `{}` | Set of labels to transfer from the Kubernetes Service onto the target |
94+
| serviceMonitor.enabled | bool | `false` | When set true then use a ServiceMonitor to configure scraping |
95+
| serviceMonitor.interval | string | `"1m"` | Set how frequently Prometheus should scrape |
96+
| serviceMonitor.metricRelabelings | list | `[]` | MetricRelabelConfigs to apply to samples before ingestion |
97+
| serviceMonitor.relabelings | list | `[]` | Set relabel_configs as per https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config |
98+
| serviceMonitor.scrapeTimeout | string | `"10s"` | Set timeout for scrape |
99+
| serviceMonitor.targetLabels | list | `[]` | Set of labels to transfer from the Kubernetes Service onto the target |
100+
| serviceMonitor.telemetryPath | string | `"/metrics"` | Set path to metrics path |
60101
| tolerations | list | `[]` | pod tolerations |
102+
| watchNamespaceSelector | string | `""` | Sets the WATCH_NAMESPACE_SELECTOR environment variable, it defines which namespaces the operator should be listening for based on label and key value pair added on namespace kind. By default it's all namespaces. |
61103
| watchNamespaces | string | `""` | Sets the WATCH_NAMESPACE environment variable, it defines which namespaces the operator should be listening for. By default it's all namespaces, if you only want to listen for the same namespace as the operator is deployed to look at namespaceScope. |

‎packages/system/grafana-operator/charts/grafana-operator/README.md.gotmpl‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ linkTitle: "Helm installation"
77

88
[grafana-operator](https://github.com/grafana/grafana-operator) for Kubernetes to manage Grafana instances and grafana resources.
99

10-
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
10+
{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
1111

1212
## Installation
1313

@@ -19,6 +19,34 @@ helm upgrade -i grafana-operator oci://ghcr.io/grafana/helm-charts/grafana-opera
1919

2020
Sadly helm OCI charts currently don't support searching for available versions of a helm [oci registry](https://github.com/helm/helm/issues/11000).
2121

22+
### Using Terraform
23+
24+
To install the helm chart using terraform, make sure you use the right values for `repository` and `name` as shown below:
25+
26+
```hcl
27+
resource "helm_release" "grafana_kubernetes_operator" {
28+
name = "grafana-operator"
29+
namespace = "default"
30+
repository = "oci://ghcr.io/grafana/helm-charts"
31+
chart = "grafana-operator"
32+
verify = false
33+
version = "{{ template "chart.appVersion" . }}"
34+
}
35+
```
36+
37+
38+
## Upgrading
39+
40+
Helm does not provide functionality to update custom resource definitions. This can result in the operator misbehaving when a release contains updates to the custom resource definitions.
41+
To avoid issues due to outdated or missing definitions, run the following command before updating an existing installation:
42+
43+
```shell
44+
kubectl apply --server-side --force-conflicts -f https://github.com/grafana/grafana-operator/releases/download/{{ template "chart.appVersion" . }}/crds.yaml
45+
```
46+
47+
The `--server-side` and `--force-conflict` flags are required to avoid running into issues with the `kubectl.kubernetes.io/last-applied-configuration` annotation.
48+
By using server side apply, this annotation is not considered. `--force-conflict` allows kubectl to modify fields previously managed by helm.
49+
2250
## Development
2351

2452
For general and helm specific development instructions please read the [CONTRIBUTING.md](../../../CONTRIBUTING.md)

0 commit comments

Comments
 (0)