Skip to content

Commit

Permalink
Merge branch 'master' into blog-5-dec
Browse files Browse the repository at this point in the history
  • Loading branch information
hubeadmin authored Dec 5, 2023
2 parents c3cf11d + 7daff95 commit 755fff0
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fetch-depth: 0
- id: changed-files
name: Get changed files
uses: tj-actions/changed-files@25ef3926d147cd02fc7e931c1ef50772bbb0d25d #v40.1.1
uses: tj-actions/changed-files@da093c1609db0edd0a037ce9664e135f74bf30d9 #v40.2.0
with:
files_ignore: |
**/*.md
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ jobs:
with:
go-version-file: "go.mod"

- name: Run helm-template
run: |
helm template deploy/helm/grafana-operator/
- name: Run helm-lint
run: |
helm lint deploy/helm/grafana-operator/
- name: Run helm-docs
run: |
make helm/docs
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# NOTE: this section almost matches outputs out kubebuilder v3.7.0
###
# Current Operator version
VERSION ?= 5.5.0
VERSION ?= 5.5.2

# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
alm-examples: '[]'
capabilities: Basic Install
categories: Monitoring
containerImage: ghcr.io/grafana-operator/grafana-operator:v5.5.0
createdAt: "2023-09-12T08:09:00.92Z"
repository: https://github.com/grafana-operator/grafana-operator
support: Community
Expand Down
6 changes: 3 additions & 3 deletions controllers/reconcilers/grafana/deployment_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,18 @@ func getVolumeMounts(cr *v1beta1.Grafana, scheme *runtime.Scheme) []v1.VolumeMou
return mounts
}

func setGrafanaImage() string {
func getGrafanaImage() string {
grafanaImg := os.Getenv("RELATED_IMAGE_GRAFANA")
if grafanaImg == "" {
grafanaImg = fmt.Sprintf("%s@%s", config2.GrafanaImage, config2.GrafanaVersion)
grafanaImg = fmt.Sprintf("%s:%s", config2.GrafanaImage, config2.GrafanaVersion)
}
return grafanaImg
}

func getContainers(cr *v1beta1.Grafana, scheme *runtime.Scheme, vars *v1beta1.OperatorReconcileVars, openshiftPlatform bool) []v1.Container {
var containers []v1.Container

image := setGrafanaImage()
image := getGrafanaImage()
plugins := model.GetPluginsConfigMap(cr, scheme)

// env var to restart containers if plugins change
Expand Down
23 changes: 23 additions & 0 deletions controllers/reconcilers/grafana/deployment_reconciler_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package grafana

import (
"fmt"
"testing"

config2 "github.com/grafana-operator/grafana-operator/v5/controllers/config"

"github.com/stretchr/testify/assert"
)

func Test_getGrafanaImage(t *testing.T) {
expectedDeploymentImage := fmt.Sprintf("%s:%s", config2.GrafanaImage, config2.GrafanaVersion)

assert.Equal(t, expectedDeploymentImage, getGrafanaImage())
}

func Test_getGrafanaImage_withEnvironmentOverride(t *testing.T) {
expectedDeploymentImage := "I want this grafana image"
t.Setenv("RELATED_IMAGE_GRAFANA", expectedDeploymentImage)

assert.Equal(t, expectedDeploymentImage, getGrafanaImage())
}
4 changes: 2 additions & 2 deletions deploy/helm/grafana-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.1.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v5.5.0"
appVersion: "v5.5.2"
5 changes: 2 additions & 3 deletions deploy/helm/grafana-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ linkTitle: "Helm installation"

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

![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v5.5.0](https://img.shields.io/badge/AppVersion-v5.5.0-informational?style=flat-square)
![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.5.2](https://img.shields.io/badge/AppVersion-v5.5.2-informational?style=flat-square)

## Installation

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

```shell
helm upgrade -i grafana-operator oci://ghcr.io/grafana-operator/helm-charts/grafana-operator --version v5.5.0
helm upgrade -i grafana-operator oci://ghcr.io/grafana-operator/helm-charts/grafana-operator --version v5.5.2
```

Sadly helm OCI charts currently don't support searching for available versions of a helm [oci registry](https://github.com/helm/helm/issues/11000).
Expand All @@ -38,7 +38,6 @@ It's easier to just manage this configuration outside of the operator.
| additionalLabels | object | `{}` | additional labels to add to all resources |
| affinity | object | `{}` | pod affinity |
| env | list | `[]` | Additional environment variables |
| env.grafanaImage | string | `""` | grafana image, e.g. docker.io/grafana/grafana:9.1.6, overwrites the default grafana image defined in the operator |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | The image pull policy to use in grafana operator container |
| image.repository | string | `"ghcr.io/grafana-operator/grafana-operator"` | grafana operator image repository |
Expand Down
1 change: 1 addition & 0 deletions deploy/helm/grafana-operator/templates/cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "grafana-operator.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- with .Values.additionalLabels }}
{{- toYaml . | nindent 4 }}
Expand Down
5 changes: 1 addition & 4 deletions deploy/helm/grafana-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "grafana-operator.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "grafana-operator.labels" . | nindent 4 }}
{{- with .Values.additionalLabels }}
Expand Down Expand Up @@ -42,10 +43,6 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- if .Values.env.grafanaImage }}
- name: RELATED_IMAGE_GRAFANA
value: {{ .Values.env.grafanaImage }}
{{- end }}
- name: WATCH_NAMESPACE
{{- if and .Values.namespaceScope (eq .Values.watchNamespaces "") }}
value: {{ .Release.Namespace }}
Expand Down
8 changes: 6 additions & 2 deletions deploy/helm/grafana-operator/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: {{ if not $namespaceScoped }}Cluster{{ end }}Role
metadata:
namespace: {{ . }}
{{- if $namespaceScoped }}
namespace: {{ $operatorNamespace }}
{{- end }}
name: grafana-operator-permissions
labels:
{{- include "grafana-operator.labels" $ | nindent 4 }}
Expand Down Expand Up @@ -231,7 +233,9 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: {{ if not $namespaceScoped }}Cluster{{ end }}RoleBinding
metadata:
name: grafana-operator-permissions
namespace: {{ . }}
{{- if $namespaceScoped }}
namespace: {{ $operatorNamespace }}
{{- end }}
labels:
{{- include "grafana-operator.labels" $ | nindent 4 }}
{{- with $.Values.additionalLabels }}
Expand Down
1 change: 1 addition & 0 deletions deploy/helm/grafana-operator/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "grafana-operator.fullname" . }}-metrics-service
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "grafana-operator.labels" . | nindent 4 }}
{{- with .Values.additionalLabels }}
Expand Down
1 change: 1 addition & 0 deletions deploy/helm/grafana-operator/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "grafana-operator.serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "grafana-operator.labels" . | nindent 4 }}
{{- with .Values.additionalLabels }}
Expand Down
7 changes: 3 additions & 4 deletions deploy/helm/grafana-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ watchNamespaces: ""

# -- Additional environment variables
env: []
# -- grafana image, e.g. docker.io/grafana/grafana:9.1.6, overwrites the default grafana image defined in the operator
# - name: RELATED_IMAGE_GRAFANA
# value: "docker.io/grafana/grafana:9.1.6"
# - name: MY_VAR
# value: "myvalue"

Expand All @@ -26,10 +29,6 @@ image:
# -- image pull secrets
imagePullSecrets: []

env:
# -- grafana image, e.g. docker.io/grafana/grafana:9.1.6, overwrites the default grafana image defined in the operator
grafanaImage: ""

nameOverride: ""
fullnameOverride: ""

Expand Down
91 changes: 91 additions & 0 deletions docs/blog/operator-migration-to-upstream-grafana.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
author: "Hubert Stefański"
date: 2023-11-21
title: "Moving Upstream"
linkTitle: "Grafana-Operator Moving Upstream"
description: "An announcement of an upcoming migration to upstream grafana repositories"
---

Exciting times coming up!

The community folks over at upstream Grafana, have reached out and asked if we’d be open to migrating
the Grafana-Operator to their https://github.com/grafana organization! We said "YES!"

## Why?

Ever since we moved away from our initial `Integr8ly` home, (where Peter first created the operator) we have focused on
growing the community and improving the user experience as best we could, we believe that moving to upstream Grafana is
the next logical step.

With this, we hope that the operator gets some more “validity” (for the lack of a better word). With which, we hope new
users and developers will be more likely to engage. Especially given its presence in the official `Grafana`
organization.

It’s not a secret that the current maintainer team isn’t as active as it could be (believe, us, we want to do more).
But... the grafana-operator is a true side-gig for us, 3/4 of our current active maintainers don't work with Kubernetes
day-to-day. We acknowledge that this is one of the major factors limiting development right now. Where some feature
requests have been open for months at a time, with no one being able to implement them. With our limited time we tend to
focus on fixing bugs and small quality-of-life improvements, however, we know that this is not enough and that the
operator has much greater potential. After all, we only support a few core features, out of numerous possible ones in
Grafana.

So, the choice is pretty clear for us, considering the slow development speed, and our limited capacity but also wanting
the operator to grow, in all aspects, community, featureset etc., we believe this to be a step in the right direction
for everyone involved.

## What does it mean for me(as a grafana-operator user)?

Technically, not much will change, the grafana-operator will still be the grafana-operator you’ve gotten to know, love
and have pulled millions of times (we see the stats 😁).

We don’t plan on a new API version with this repo migration, at least not in the upcoming quarters, we’re really happy
with how flexible our API is now, so we don’t really have a reason to change anything.

We also don’t expect existing deployments to be affected in any capacity, and if for any reason that would happen, we'll
be there to help out!

## What about the maintainers?

All current Grafana-Operator maintainers are planning on sticking around and continuing on with our involvement in the
project, after all, this is a massive leap for the operator, and we’re all happy to be part of it!

In all likelihood, new maintainers from the upstream Grafana community might join, so all-in-all, the maintainers might
be more responsive to issues and pull requests!

## Licensing?

We know that news like this often fill developers with dread over commercialization and sudden license changes. Don't
worry - the license will stay exactly the same!

## What WILL change?

Metadata mostly, we’ll likely switch a few key-values in our manifests to better reflect the actual state of the
operator (i.e ownership, repository addresses, maintenance contacts etc)
In general, house-keeping stuff that doesn't really affect users.

The primary change will be the repo address on Github, we'll migrate
the https://github.com/grafana-operator/grafana-operator to https://github.com/grafana.
Github automatically redirects migrated addresses, so there's nothing to be concerned about on that end.
Future OCI URI's will reflect this change, while existing artifacts will still have the same URI, they will be copied
over to our new home with the caveat, that digests will change.

The documentation URL will also change, however, we will set up a redirect from it's current location, so it's likely
you won't even notice it moved!

Perhaps, the biggest change to you, as a contributor to the grafana-operator, would be a new requirement to sign the
[Grafana CLA](https://grafana.com/docs/grafana/latest/developers/cla/), But worry not, this CLA is based on the
Apache Software Foundation CLA, which should put those of us whom are concerned about signing agreements, at ease.

We might end up moving a few other things around, like creating a new channel on the upstream Grafana slack, however,
you'll definitely hear about any other changes before they happen! So, stay tuned!

## Summary

Thanks to everyone that supported us over the past 4 years, the project has really grown beyond expectation. From a
niche operator created for a very specific project, to a pretty sizeable community and a project that is now used by
many major companies throughout the world, some of whom you wouldn't expect, as they don't announce it publicly, but
contact us for support!

We've got our hopes set high for this migration, and we hope you do too, let's take the operator to the next level!

Thanks ~ Grafana Operator Maintainers
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/blang/semver v3.5.1+incompatible
github.com/go-logr/logr v1.3.0
github.com/google/go-jsonnet v0.20.0
github.com/grafana/grafana-api-golang-client v0.23.0
github.com/grafana/grafana-api-golang-client v0.24.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.30.0
github.com/openshift/api v3.9.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grafana/grafana-api-golang-client v0.23.0 h1:Uta0dSkxWYf1D83/E7MRLCG69387FiUc+k9U/35nMhY=
github.com/grafana/grafana-api-golang-client v0.23.0/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
github.com/grafana/grafana-api-golang-client v0.24.0 h1:9cUvft7xCMnnL/Uscwy7eoldn16Gz5TH4T1MymuVs8E=
github.com/grafana/grafana-api-golang-client v0.24.0/go.mod h1:24W29gPe9yl0/3A9X624TPkAOR8DpHno490cPwnkv8E=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
Expand Down
2 changes: 1 addition & 1 deletion hugo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ archived_version = false
# The version number for the version of the docs represented in this doc set.
# Used in the "version-banner" partial to display a version number for the
# current doc set.
version = "v5.5.0"
version = "v5.5.2"

# A link to latest version of the docs. Used in the "version-banner" partial to
# point people to the main doc site.
Expand Down

0 comments on commit 755fff0

Please sign in to comment.