Skip to content

Commit 8225cdc

Browse files
authored
Merge pull request #558 from pb82/prepare-release-4.0.1
feat: prepare release v4.0.1
2 parents eeefa1e + a848388 commit 8225cdc

13 files changed

+146
-43
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Current Operator version
2-
VERSION ?= 4.0.0
2+
VERSION ?= 4.0.1
33
# Default bundle image tag
44
BUNDLE_IMG ?= quay.io/grafana-operator/controller-bundle:v$(VERSION)
55
# Options for 'bundle-build'

api/integreatly/v1alpha1/grafanadatasource_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ type GrafanaDataSourceFields struct {
7070
Name string `json:"name"`
7171
Type string `json:"type"`
7272
Uid string `json:"uid,omitempty"`
73-
Access string `json:"access"`
73+
Access string `json:"access,omitempty"`
7474
OrgId int `json:"orgId,omitempty"`
75-
Url string `json:"url"`
75+
Url string `json:"url,omitempty"`
7676
Password string `json:"password,omitempty"`
7777
User string `json:"user,omitempty"`
7878
Database string `json:"database,omitempty"`

bundle/manifests/grafana-operator.clusterserviceversion.yaml

+27-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
capabilities: Basic Install
77
operators.operatorframework.io/builder: operator-sdk-v1.3.2
88
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
9-
name: grafana-operator.v4.0.0
9+
name: grafana-operator.v4.0.1
1010
namespace: placeholder
1111
spec:
1212
apiservicedefinitions: {}
@@ -18,6 +18,9 @@ spec:
1818
- kind: GrafanaDataSource
1919
name: grafanadatasources.integreatly.org
2020
version: v1alpha1
21+
- kind: GrafanaNotificationChannel
22+
name: grafananotificationchannels.integreatly.org
23+
version: v1alpha1
2124
- kind: Grafana
2225
name: grafanas.integreatly.org
2326
version: v1alpha1
@@ -130,6 +133,26 @@ spec:
130133
- get
131134
- patch
132135
- update
136+
- apiGroups:
137+
- integreatly.org
138+
resources:
139+
- grafananotificationchannels
140+
verbs:
141+
- create
142+
- delete
143+
- get
144+
- list
145+
- patch
146+
- update
147+
- watch
148+
- apiGroups:
149+
- integreatly.org
150+
resources:
151+
- grafananotificationchannels/status
152+
verbs:
153+
- get
154+
- patch
155+
- update
133156
- apiGroups:
134157
- integreatly.org
135158
resources:
@@ -229,7 +252,7 @@ spec:
229252
valueFrom:
230253
fieldRef:
231254
fieldPath: metadata.annotations['olm.targetNamespaces']
232-
image: quay.io/grafana-operator/grafana-operator:v4.0.0
255+
image: quay.io/grafana-operator/grafana-operator:v4.0.1
233256
imagePullPolicy: Always
234257
livenessProbe:
235258
httpGet:
@@ -301,4 +324,5 @@ spec:
301324
maturity: alpha
302325
provider:
303326
name: Red Hat
304-
version: 4.0.0
327+
replaces: grafana-operator.v4.0.0
328+
version: 4.0.1

bundle/manifests/integreatly.org_grafanadatasources.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,8 @@ spec:
276276
withCredentials:
277277
type: boolean
278278
required:
279-
- access
280279
- name
281280
- type
282-
- url
283281
type: object
284282
type: array
285283
name:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
controller-gen.kubebuilder.io/version: v0.4.1
6+
creationTimestamp: null
7+
name: grafananotificationchannels.integreatly.org
8+
spec:
9+
group: integreatly.org
10+
names:
11+
kind: GrafanaNotificationChannel
12+
listKind: GrafanaNotificationChannelList
13+
plural: grafananotificationchannels
14+
singular: grafananotificationchannel
15+
scope: Namespaced
16+
versions:
17+
- name: v1alpha1
18+
schema:
19+
openAPIV3Schema:
20+
description: GrafanaNotificationChannel is the Schema for the GrafanaNotificationChannels API
21+
properties:
22+
apiVersion:
23+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
24+
type: string
25+
kind:
26+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
27+
type: string
28+
metadata:
29+
type: object
30+
spec:
31+
description: GrafanaNotificationChannelSpec defines the desired state of GrafanaNotificationChannel
32+
properties:
33+
json:
34+
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file'
35+
type: string
36+
name:
37+
type: string
38+
required:
39+
- json
40+
- name
41+
type: object
42+
status:
43+
description: GrafanaNotificationChannelStatus defines the observed state of GrafanaNotificationChannel
44+
properties:
45+
hash:
46+
type: string
47+
id:
48+
type: integer
49+
message:
50+
type: string
51+
phase:
52+
type: string
53+
uid:
54+
type: string
55+
required:
56+
- hash
57+
- id
58+
- message
59+
- phase
60+
- uid
61+
type: object
62+
type: object
63+
served: true
64+
storage: true
65+
subresources:
66+
status: {}
67+
status:
68+
acceptedNames:
69+
kind: ""
70+
plural: ""
71+
conditions: []
72+
storedVersions: []

config/crd/bases/integreatly.org_grafanadatasources.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,8 @@ spec:
284284
withCredentials:
285285
type: boolean
286286
required:
287-
- access
288287
- name
289288
- type
290-
- url
291289
type: object
292290
type: array
293291
name:

config/manager/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ kind: Kustomization
1313
images:
1414
- name: controller
1515
newName: quay.io/grafana-operator/grafana-operator
16-
newTag: v4.0.0
16+
newTag: v4.0.1

config/manifests/bases/grafana-operator.clusterserviceversion.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,5 @@ spec:
145145
maturity: alpha
146146
provider:
147147
name: Red Hat
148+
replaces: grafana-operator.v4.0.0
148149
version: 0.0.0

controllers/grafanadatasource/datasource_controller.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type GrafanaDatasourceReconciler struct {
4848
Scheme *runtime.Scheme
4949
Context context.Context
5050
Cancel context.CancelFunc
51-
recorder record.EventRecorder
51+
Recorder record.EventRecorder
5252
Logger logr.Logger
5353
}
5454

@@ -155,7 +155,7 @@ func (r *GrafanaDatasourceReconciler) reconcileDataSources(state *common.DataSou
155155
// finally, update the configmap
156156
err = r.Client.Update(r.Context, state.KnownDataSources)
157157
if err != nil {
158-
r.recorder.Event(state.KnownDataSources, "Warning", "UpdateError", err.Error())
158+
r.Recorder.Event(state.KnownDataSources, "Warning", "UpdateError", err.Error())
159159
} else {
160160
r.manageSuccess(updated)
161161
}
@@ -194,7 +194,7 @@ func (i *GrafanaDatasourceReconciler) updateHash(known *v1.ConfigMap) (string, e
194194

195195
// Handle error case: update datasource with error message and status
196196
func (r *GrafanaDatasourceReconciler) manageError(datasource *grafanav1alpha1.GrafanaDataSource, issue error) {
197-
r.recorder.Event(datasource, "Warning", "ProcessingError", issue.Error())
197+
r.Recorder.Event(datasource, "Warning", "ProcessingError", issue.Error())
198198

199199
// datasource deleted
200200
if datasource == nil {
@@ -227,7 +227,7 @@ func (r *GrafanaDatasourceReconciler) manageSuccess(datasources []grafanav1alpha
227227

228228
err := r.Client.Status().Update(r.Context, &datasources[i])
229229
if err != nil {
230-
r.recorder.Event(&datasources[i], "Warning", "UpdateError", err.Error())
230+
r.Recorder.Event(&datasources[i], "Warning", "UpdateError", err.Error())
231231
}
232232
}
233233
}

controllers/model/grafanaDeployment.go

+22-13
Original file line numberDiff line numberDiff line change
@@ -224,20 +224,23 @@ func getVolumes(cr *v1alpha1.Grafana) []v13.Volume { // nolint
224224
}
225225

226226
// Volume to store the plugins
227-
appendIfContainsPlugin := func(slice []v13.VolumeMount) bool {
227+
appendIfContainsPlugin := func() bool {
228228
var foundGrafanaPluginsPath bool
229-
if cr.Spec.Deployment.ExtraVolumeMounts != nil {
230-
for _, item := range slice {
229+
if cr.Spec.Deployment != nil {
230+
for _, item := range cr.Spec.Deployment.ExtraVolumeMounts {
231231
if item.MountPath == config.GrafanaPluginsPath {
232232
foundGrafanaPluginsPath = true
233233
break
234234
}
235235
}
236236
}
237-
volumes = append(volumes, cr.Spec.Deployment.ExtraVolumes...)
237+
238+
if cr.Spec.Deployment != nil {
239+
volumes = append(volumes, cr.Spec.Deployment.ExtraVolumes...)
240+
}
238241
return foundGrafanaPluginsPath
239242
}
240-
if !appendIfContainsPlugin(cr.Spec.Deployment.ExtraVolumeMounts) {
243+
if !appendIfContainsPlugin() {
241244
volumes = append(volumes, v13.Volume{
242245
Name: constants.GrafanaPluginsVolumeName,
243246
VolumeSource: v13.VolumeSource{
@@ -343,20 +346,23 @@ func getVolumeMounts(cr *v1alpha1.Grafana) []v13.VolumeMount {
343346
MountPath: config.GrafanaDataPath,
344347
})
345348

346-
appendIfContainsPlugin := func(slice []v13.VolumeMount) bool {
349+
appendIfContainsPlugin := func() bool {
347350
var foundGrafanaPluginsPath bool
348-
if cr.Spec.Deployment.ExtraVolumeMounts != nil {
349-
for _, item := range slice {
351+
if cr.Spec.Deployment != nil {
352+
for _, item := range cr.Spec.Deployment.ExtraVolumeMounts {
350353
if item.MountPath == config.GrafanaPluginsPath {
351354
foundGrafanaPluginsPath = true
352355
break
353356
}
354357
}
355358
}
356-
mounts = append(mounts, cr.Spec.Deployment.ExtraVolumeMounts...)
359+
360+
if cr.Spec.Deployment != nil {
361+
mounts = append(mounts, cr.Spec.Deployment.ExtraVolumeMounts...)
362+
}
357363
return foundGrafanaPluginsPath
358364
}
359-
if !appendIfContainsPlugin(cr.Spec.Deployment.ExtraVolumeMounts) {
365+
if !appendIfContainsPlugin() {
360366
mounts = append(mounts, v13.VolumeMount{
361367
Name: constants.GrafanaPluginsVolumeName,
362368
MountPath: config.GrafanaPluginsPath,
@@ -573,9 +579,12 @@ func getInitContainers(cr *v1alpha1.Grafana, plugins string) []v13.Container {
573579
}
574580

575581
var volumeName = constants.GrafanaPluginsVolumeName
576-
for _, item := range cr.Spec.Deployment.ExtraVolumeMounts {
577-
if item.MountPath == config.GrafanaPluginsPath {
578-
volumeName = item.Name
582+
583+
if cr.Spec.Deployment != nil {
584+
for _, item := range cr.Spec.Deployment.ExtraVolumeMounts {
585+
if item.MountPath == config.GrafanaPluginsPath {
586+
volumeName = item.Name
587+
}
579588
}
580589
}
581590

documentation/api.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,6 @@ GrafanaDataSourceSpec defines the desired state of GrafanaDataSource
396396
</tr>
397397
</thead>
398398
<tbody><tr>
399-
<td><b>access</b></td>
400-
<td>string</td>
401-
<td>
402-
<br/>
403-
</td>
404-
<td>true</td>
405-
</tr><tr>
406399
<td><b>name</b></td>
407400
<td>string</td>
408401
<td>
@@ -417,12 +410,12 @@ GrafanaDataSourceSpec defines the desired state of GrafanaDataSource
417410
</td>
418411
<td>true</td>
419412
</tr><tr>
420-
<td><b>url</b></td>
413+
<td><b>access</b></td>
421414
<td>string</td>
422415
<td>
423416
<br/>
424417
</td>
425-
<td>true</td>
418+
<td>false</td>
426419
</tr><tr>
427420
<td><b>basicAuth</b></td>
428421
<td>boolean</td>
@@ -500,6 +493,13 @@ GrafanaDataSourceSpec defines the desired state of GrafanaDataSource
500493
<br/>
501494
</td>
502495
<td>false</td>
496+
</tr><tr>
497+
<td><b>url</b></td>
498+
<td>string</td>
499+
<td>
500+
<br/>
501+
</td>
502+
<td>false</td>
503503
</tr><tr>
504504
<td><b>user</b></td>
505505
<td>string</td>

main.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,12 @@ func main() { // nolint
237237
os.Exit(1)
238238
}
239239
if err = (&grafanadatasource.GrafanaDatasourceReconciler{
240-
Client: mgr.GetClient(),
241-
Context: ctx,
242-
Cancel: cancel,
243-
Logger: ctrl.Log.WithName("controllers").WithName("GrafanaDatasource"),
244-
Scheme: mgr.GetScheme(),
240+
Client: mgr.GetClient(),
241+
Context: ctx,
242+
Cancel: cancel,
243+
Logger: ctrl.Log.WithName("controllers").WithName("GrafanaDatasource"),
244+
Scheme: mgr.GetScheme(),
245+
Recorder: mgr.GetEventRecorderFor("GrafanaDatasource"),
245246
}).SetupWithManager(mgr); err != nil {
246247
setupLog.Error(err, "unable to create controller", "controller", "GrafanaDatasource")
247248
os.Exit(1)

version/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package version
22

33
var (
4-
Version = "3.10.0"
4+
Version = "4.0.1"
55
)

0 commit comments

Comments
 (0)