Skip to content

Commit

Permalink
Merge pull request #1344 from grafana/chore/update-deployment-manifests
Browse files Browse the repository at this point in the history
chore: update deployment manifests for helm, kustomize & OLM
  • Loading branch information
theSuess committed Dec 12, 2023
2 parents c35f03a + 20366ed commit ffe46ea
Show file tree
Hide file tree
Showing 23 changed files with 59 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Build and load (current arch)
env:
KO_DOCKER_REPO: ko.local/grafana-operator/grafana-operator
KO_DOCKER_REPO: ko.local/grafana/grafana-operator
run: |
ko build --sbom=none --bare
kind load docker-image "$KO_DOCKER_REPO"
Expand Down
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ GRAFANA_VERSION := $(shell grep 'GrafanaVersion' controllers/config/operator_con

# Image URL to use all building/pushing image targets
REGISTRY ?= ghcr.io
REPO ?= grafana-operator
IMG ?= $(REGISTRY)/$(REPO)/grafana-operator:v$(VERSION)
ORG ?= grafana
IMG ?= $(REGISTRY)/$(ORG)/grafana-operator:v$(VERSION)
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.25.0

Expand Down Expand Up @@ -95,7 +95,7 @@ endif
manifests: yq controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." crd:maxDescLen=0,generateEmbeddedObjectMeta=false output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." crd:maxDescLen=0,generateEmbeddedObjectMeta=false output:crd:artifacts:config=deploy/helm/grafana-operator/crds
yq -i '(select(.kind == "Deployment") | .spec.template.spec.containers[0].env[] |= select(.name == "RELATED_IMAGE_GRAFANA").value = "$(GRAFANA_IMAGE):$(GRAFANA_VERSION)"), (select(.kind == "Namespace"))' config/manager/manager.yaml
yq -i '(select(.kind == "Deployment") | .spec.template.spec.containers[0].env[] | select (.name == "RELATED_IMAGE_GRAFANA")).value="$(GRAFANA_IMAGE):$(GRAFANA_VERSION)"' config/manager/manager.yaml

.PHONY: kustomize-crd
kustomize-crd: kustomize manifests
Expand Down Expand Up @@ -217,6 +217,7 @@ endif
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
CHANNELS=v5
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS := --channels=$(CHANNELS)
endif
Expand All @@ -226,6 +227,7 @@ endif
# To re-generate a bundle for any other default channel without changing the default setup, you can:
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
DEFAULT_CHANNEL="v5"
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
Expand Down Expand Up @@ -300,7 +302,7 @@ else
KO=$(shell which ko)
endif

export KO_DOCKER_REPO ?= ko.local/grafana-operator/grafana-operator
export KO_DOCKER_REPO ?= ko.local/grafana/grafana-operator
export KIND_CLUSTER_NAME ?= kind-grafana
export KUBECONFIG ?= ${HOME}/.kube/kind-grafana-operator

Expand Down Expand Up @@ -332,7 +334,7 @@ start-kind:
helm/docs: helm-docs
$(HELM_DOCS)

BUNDLE_IMG ?= $(REGISTRY)/$(REPO)/grafana-operator-bundle:v$(VERSION)
BUNDLE_IMG ?= $(REGISTRY)/$(ORG)/grafana-operator-bundle:v$(VERSION)

.PHONY: bundle-build
bundle-build: ## Build the bundle image.
Expand Down
2 changes: 1 addition & 1 deletion PREPARE_RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ There is a lot of information on what is needed to manage OLM [compatible operat
- `createdAt`: Make sure that createdAt matches when the image was published. If not you will have to change it manually when creating PR:s to OLM.
```
# This is how the time syntax should look.
$ docker inspect ghcr.io/grafana-operator/grafana-operator:v5.0.0 |jq '.[0].Created'
$ docker inspect ghcr.io/grafana/grafana-operator:v5.0.0 |jq '.[0].Created'
"2023-11-22T10:34:12.173861869Z"
# 2023-11-22T10:34:12Z is enough
```
Expand Down
1 change: 0 additions & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ layout:
- go.kubebuilder.io/v3
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: grafana-operator
repo: github.com/grafana/grafana-operator
resources:
Expand Down
8 changes: 2 additions & 6 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=grafana-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.bundle.channels.v1=v5
LABEL operators.operatorframework.io.bundle.channel.default.v1=v5
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.32.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/

# Copy files to locations specified by labels.
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
21 changes: 12 additions & 9 deletions bundle/manifests/grafana-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@ metadata:
]
capabilities: Basic Install
categories: Monitoring
createdAt: "2023-11-06T20:49:26Z"
containerImage: ghcr.io/grafana/grafana-operator@sha256:97561cef949b58f55ec67d133c02ac205e2ec3fb77388aeb868dacfcebad0752
createdAt: "2023-12-11T16:03:28Z"
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/grafana/grafana-operator
support: Community
name: grafana-operator.v5.4.2
support: Grafana Labs
name: grafana-operator.v5.6.0
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -328,7 +329,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.annotations['olm.targetNamespaces']
image: ghcr.io/grafana-operator/grafana-operator@sha256:bd4faa4e8b721fbbc8e7bde096347e4b123e85a01ab437c021664120ac3c00c6
image: ghcr.io/grafana/grafana-operator@sha256:97561cef949b58f55ec67d133c02ac205e2ec3fb77388aeb868dacfcebad0752
imagePullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -410,15 +411,17 @@ spec:
- Observability
links:
- name: Grafana Operator
url: https://grafana-operator.github.io/grafana-operator
maturity: alpha
url: https://grafana.github.io/grafana-operator
maturity: stable
minKubeVersion: 1.23.0
provider:
name: Community
relatedImages:
- image: docker.io/grafana/grafana@sha256:ff68ed4324e471ffa269aa5308cdcf12276ef2d5a660daea95db9d629a32a7d8
name: grafana
- image: ghcr.io/grafana-operator/grafana-operator@sha256:bd4faa4e8b721fbbc8e7bde096347e4b123e85a01ab437c021664120ac3c00c6
- image: ghcr.io/grafana/grafana-operator@sha256:97561cef949b58f55ec67d133c02ac205e2ec3fb77388aeb868dacfcebad0752
name: manager
replaces: grafana-operator.v5.4.1
version: 5.4.2
- image: ghcr.io/grafana/grafana-operator@sha256:97561cef949b58f55ec67d133c02ac205e2ec3fb77388aeb868dacfcebad0752
name: grafana-operator-97561cef949b58f55ec67d133c02ac205e2ec3fb77388aeb868dacfcebad0752-annotation
replaces: grafana-operator.v5.5.2
version: 5.6.0
7 changes: 2 additions & 5 deletions bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ annotations:
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: grafana-operator
operators.operatorframework.io.bundle.channels.v1: alpha
operators.operatorframework.io.bundle.channels.v1: v5
operators.operatorframework.io.bundle.channel.default.v1: v5
operators.operatorframework.io.metrics.builder: operator-sdk-v1.32.0
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3

# Annotations for testing.
operators.operatorframework.io.test.mediatype.v1: scorecard+v1
operators.operatorframework.io.test.config.v1: tests/scorecard/
70 changes: 0 additions & 70 deletions bundle/tests/scorecard/config.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions config/kuttl-overlay/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ patches:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: ghcr.io/grafana-operator/grafana-operator
newName: ko.local/grafana-operator/grafana-operator
- name: ghcr.io/grafana/grafana-operator
newName: ko.local/grafana/grafana-operator
newTag: latest
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ configMapGenerator:

images:
- name: controller
newName: ghcr.io/grafana-operator/grafana-operator
newTag: v5.4.2
newName: ghcr.io/grafana/grafana-operator
newTag: v5.6.0
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ 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"
containerImage: ghcr.io/grafana/grafana-operator:v5.6.0
createdAt: "2023-12-11T09:21:22Z"
repository: https://github.com/grafana/grafana-operator
support: Community
support: Grafana Labs
name: grafana-operator.v0.0.0
namespace: placeholder
spec:
Expand Down Expand Up @@ -59,10 +59,10 @@ spec:
- Observability
links:
- name: Grafana Operator
url: https://grafana-operator.github.io/grafana-operator
maturity: alpha
url: https://grafana.github.io/grafana-operator
maturity: stable
minKubeVersion: 1.23.0
provider:
name: Community
replaces: grafana-operator.v5.4.1
replaces: grafana-operator.v5.5.2
version: 0.0.0
1 change: 0 additions & 1 deletion config/manifests/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ resources:
- bases/grafana-operator.clusterserviceversion.yaml
- ../default
- ../samples
- ../scorecard
# [WEBHOOK] To enable webhooks, uncomment all the sections with [WEBHOOK] prefix.
# Do NOT uncomment sections with prefix [CERTMANAGER], as OLM does not support cert-manager.
# These patches remove the unnecessary "cert" volume and its manager container volumeMount.
Expand Down
6 changes: 0 additions & 6 deletions config/scorecard/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
resources:
- bases/config.yaml
patches:
- path: patches/basic.config.yaml
target:
group: scorecard.operatorframework.io
kind: Configuration
name: config
version: v1alpha3
- path: patches/olm.config.yaml
target:
group: scorecard.operatorframework.io
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/grafana-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ linkTitle: "Helm 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.6.0
helm upgrade -i grafana-operator oci://ghcr.io/grafana/helm-charts/grafana-operator --version v5.6.0
```

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 @@ -40,7 +40,7 @@ It's easier to just manage this configuration outside of the operator.
| env | list | `[]` | Additional environment variables |
| 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 |
| image.repository | string | `"ghcr.io/grafana/grafana-operator"` | grafana operator image repository |
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | `[]` | image pull secrets |
| leaderElect | bool | `false` | If you want to run multiple replicas of the grafana-operator, this is not recommended. |
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/grafana-operator/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ linkTitle: "Helm 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 {{ template "chart.appVersion" . }}
helm upgrade -i grafana-operator oci://ghcr.io/grafana/helm-charts/grafana-operator --version {{ template "chart.appVersion" . }}
```

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 Down
2 changes: 1 addition & 1 deletion deploy/helm/grafana-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env: []

image:
# -- grafana operator image repository
repository: ghcr.io/grafana-operator/grafana-operator
repository: ghcr.io/grafana/grafana-operator
# -- The image pull policy to use in grafana operator container
pullPolicy: IfNotPresent
# -- Overrides the image tag whose default is the chart appVersion.
Expand Down
2 changes: 1 addition & 1 deletion deploy/kustomize/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
- --health-probe-bind-address=:8081
- --metrics-bind-address=0.0.0.0:9090
- --leader-elect
image: ghcr.io/grafana-operator/grafana-operator:v5.4.2
image: ghcr.io/grafana/grafana-operator:v5.4.2
imagePullPolicy: Always
ports:
- containerPort: 9090
Expand Down
4 changes: 2 additions & 2 deletions docs/blog/flux-gitops/grafana-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: flux-system
spec:
interval: 10m
url: oci://ghcr.io/grafana-operator/kustomize/grafana-operator
url: oci://ghcr.io/grafana/kustomize/grafana-operator
ref:
tag: v5.0.0-rc3
---
Expand All @@ -18,7 +18,7 @@ spec:
interval: 10m
targetNamespace: grafana
images:
- name: ghcr.io/grafana-operator/grafana-operator
- name: ghcr.io/grafana/grafana-operator
newTag: v5.0.0-rc3
prune: true
sourceRef:
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/kustomize-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ If you want to install the grafana-operator without using GitOps, you can also d
For example, you can run the following Flux command to download the artifact and unpack it. Then you can run a normal kubectl apply command.

```shell
flux pull artifact oci://ghcr.io/grafana-operator/kustomize/grafana-operator:{{<param version>}} -output ./grafana-opreator
flux pull artifact oci://ghcr.io/grafana/kustomize/grafana-operator:{{<param version>}} -output ./grafana-opreator
```

But of course we recommend that you manage your grafana-operator installation through your GitOps solution, no matter if it's Flux or some other solution.
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/v5-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ We are hosting our Helm chart in an OCI repo so it's a bit different from what y
notice the `oci://` part of the URL.

```shell
helm upgrade -i grafana-operator oci://ghcr.io/grafana-operator/helm-charts/grafana-operator --version {{<param version>}} -n grafana-operator
helm upgrade -i grafana-operator oci://ghcr.io/grafana/helm-charts/grafana-operator --version {{<param version>}} -n grafana-operator
```

## Use operator
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/installation/kustomize.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ After you have downloaded Flux you can use `flux pull artifact` to download the

```shell
mkdir grafana-operator
flux pull artifact oci://ghcr.io/grafana-operator/kustomize/grafana-operator:{{<param version>}} --output ./grafana-operator/
flux pull artifact oci://ghcr.io/grafana/kustomize/grafana-operator:{{<param version>}} --output ./grafana-operator/
```

This will provide you the manifest files unpacked and ready to use.
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/grafana/grafana-operator/v5

go 1.20
go 1.21

toolchain go1.21.3

require (
github.com/bitly/go-simplejson v0.5.1
Expand Down

0 comments on commit ffe46ea

Please sign in to comment.