Skip to content

Commit

Permalink
Merge pull request #558 from pb82/prepare-release-4.0.1
Browse files Browse the repository at this point in the history
feat: prepare release v4.0.1
  • Loading branch information
pb82 committed Oct 19, 2021
2 parents eeefa1e + a848388 commit 8225cdc
Show file tree
Hide file tree
Showing 13 changed files with 146 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Current Operator version
VERSION ?= 4.0.0
VERSION ?= 4.0.1
# Default bundle image tag
BUNDLE_IMG ?= quay.io/grafana-operator/controller-bundle:v$(VERSION)
# Options for 'bundle-build'
Expand Down
4 changes: 2 additions & 2 deletions api/integreatly/v1alpha1/grafanadatasource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ type GrafanaDataSourceFields struct {
Name string `json:"name"`
Type string `json:"type"`
Uid string `json:"uid,omitempty"`
Access string `json:"access"`
Access string `json:"access,omitempty"`
OrgId int `json:"orgId,omitempty"`
Url string `json:"url"`
Url string `json:"url,omitempty"`
Password string `json:"password,omitempty"`
User string `json:"user,omitempty"`
Database string `json:"database,omitempty"`
Expand Down
30 changes: 27 additions & 3 deletions bundle/manifests/grafana-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
capabilities: Basic Install
operators.operatorframework.io/builder: operator-sdk-v1.3.2
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
name: grafana-operator.v4.0.0
name: grafana-operator.v4.0.1
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand All @@ -18,6 +18,9 @@ spec:
- kind: GrafanaDataSource
name: grafanadatasources.integreatly.org
version: v1alpha1
- kind: GrafanaNotificationChannel
name: grafananotificationchannels.integreatly.org
version: v1alpha1
- kind: Grafana
name: grafanas.integreatly.org
version: v1alpha1
Expand Down Expand Up @@ -130,6 +133,26 @@ spec:
- get
- patch
- update
- apiGroups:
- integreatly.org
resources:
- grafananotificationchannels
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- integreatly.org
resources:
- grafananotificationchannels/status
verbs:
- get
- patch
- update
- apiGroups:
- integreatly.org
resources:
Expand Down Expand Up @@ -229,7 +252,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.annotations['olm.targetNamespaces']
image: quay.io/grafana-operator/grafana-operator:v4.0.0
image: quay.io/grafana-operator/grafana-operator:v4.0.1
imagePullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -301,4 +324,5 @@ spec:
maturity: alpha
provider:
name: Red Hat
version: 4.0.0
replaces: grafana-operator.v4.0.0
version: 4.0.1
2 changes: 0 additions & 2 deletions bundle/manifests/integreatly.org_grafanadatasources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,8 @@ spec:
withCredentials:
type: boolean
required:
- access
- name
- type
- url
type: object
type: array
name:
Expand Down
72 changes: 72 additions & 0 deletions bundle/manifests/integreatly.org_grafananotificationchannels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: grafananotificationchannels.integreatly.org
spec:
group: integreatly.org
names:
kind: GrafanaNotificationChannel
listKind: GrafanaNotificationChannelList
plural: grafananotificationchannels
singular: grafananotificationchannel
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: GrafanaNotificationChannel is the Schema for the GrafanaNotificationChannels API
properties:
apiVersion:
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'
type: string
kind:
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'
type: string
metadata:
type: object
spec:
description: GrafanaNotificationChannelSpec defines the desired state of GrafanaNotificationChannel
properties:
json:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file'
type: string
name:
type: string
required:
- json
- name
type: object
status:
description: GrafanaNotificationChannelStatus defines the observed state of GrafanaNotificationChannel
properties:
hash:
type: string
id:
type: integer
message:
type: string
phase:
type: string
uid:
type: string
required:
- hash
- id
- message
- phase
- uid
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
2 changes: 0 additions & 2 deletions config/crd/bases/integreatly.org_grafanadatasources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,8 @@ spec:
withCredentials:
type: boolean
required:
- access
- name
- type
- url
type: object
type: array
name:
Expand Down
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ kind: Kustomization
images:
- name: controller
newName: quay.io/grafana-operator/grafana-operator
newTag: v4.0.0
newTag: v4.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,5 @@ spec:
maturity: alpha
provider:
name: Red Hat
replaces: grafana-operator.v4.0.0
version: 0.0.0
8 changes: 4 additions & 4 deletions controllers/grafanadatasource/datasource_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type GrafanaDatasourceReconciler struct {
Scheme *runtime.Scheme
Context context.Context
Cancel context.CancelFunc
recorder record.EventRecorder
Recorder record.EventRecorder
Logger logr.Logger
}

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

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

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

err := r.Client.Status().Update(r.Context, &datasources[i])
if err != nil {
r.recorder.Event(&datasources[i], "Warning", "UpdateError", err.Error())
r.Recorder.Event(&datasources[i], "Warning", "UpdateError", err.Error())
}
}
}
Expand Down
35 changes: 22 additions & 13 deletions controllers/model/grafanaDeployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,23 @@ func getVolumes(cr *v1alpha1.Grafana) []v13.Volume { // nolint
}

// Volume to store the plugins
appendIfContainsPlugin := func(slice []v13.VolumeMount) bool {
appendIfContainsPlugin := func() bool {
var foundGrafanaPluginsPath bool
if cr.Spec.Deployment.ExtraVolumeMounts != nil {
for _, item := range slice {
if cr.Spec.Deployment != nil {
for _, item := range cr.Spec.Deployment.ExtraVolumeMounts {
if item.MountPath == config.GrafanaPluginsPath {
foundGrafanaPluginsPath = true
break
}
}
}
volumes = append(volumes, cr.Spec.Deployment.ExtraVolumes...)

if cr.Spec.Deployment != nil {
volumes = append(volumes, cr.Spec.Deployment.ExtraVolumes...)
}
return foundGrafanaPluginsPath
}
if !appendIfContainsPlugin(cr.Spec.Deployment.ExtraVolumeMounts) {
if !appendIfContainsPlugin() {
volumes = append(volumes, v13.Volume{
Name: constants.GrafanaPluginsVolumeName,
VolumeSource: v13.VolumeSource{
Expand Down Expand Up @@ -343,20 +346,23 @@ func getVolumeMounts(cr *v1alpha1.Grafana) []v13.VolumeMount {
MountPath: config.GrafanaDataPath,
})

appendIfContainsPlugin := func(slice []v13.VolumeMount) bool {
appendIfContainsPlugin := func() bool {
var foundGrafanaPluginsPath bool
if cr.Spec.Deployment.ExtraVolumeMounts != nil {
for _, item := range slice {
if cr.Spec.Deployment != nil {
for _, item := range cr.Spec.Deployment.ExtraVolumeMounts {
if item.MountPath == config.GrafanaPluginsPath {
foundGrafanaPluginsPath = true
break
}
}
}
mounts = append(mounts, cr.Spec.Deployment.ExtraVolumeMounts...)

if cr.Spec.Deployment != nil {
mounts = append(mounts, cr.Spec.Deployment.ExtraVolumeMounts...)
}
return foundGrafanaPluginsPath
}
if !appendIfContainsPlugin(cr.Spec.Deployment.ExtraVolumeMounts) {
if !appendIfContainsPlugin() {
mounts = append(mounts, v13.VolumeMount{
Name: constants.GrafanaPluginsVolumeName,
MountPath: config.GrafanaPluginsPath,
Expand Down Expand Up @@ -573,9 +579,12 @@ func getInitContainers(cr *v1alpha1.Grafana, plugins string) []v13.Container {
}

var volumeName = constants.GrafanaPluginsVolumeName
for _, item := range cr.Spec.Deployment.ExtraVolumeMounts {
if item.MountPath == config.GrafanaPluginsPath {
volumeName = item.Name

if cr.Spec.Deployment != nil {
for _, item := range cr.Spec.Deployment.ExtraVolumeMounts {
if item.MountPath == config.GrafanaPluginsPath {
volumeName = item.Name
}
}
}

Expand Down
18 changes: 9 additions & 9 deletions documentation/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,6 @@ GrafanaDataSourceSpec defines the desired state of GrafanaDataSource
</tr>
</thead>
<tbody><tr>
<td><b>access</b></td>
<td>string</td>
<td>
<br/>
</td>
<td>true</td>
</tr><tr>
<td><b>name</b></td>
<td>string</td>
<td>
Expand All @@ -417,12 +410,12 @@ GrafanaDataSourceSpec defines the desired state of GrafanaDataSource
</td>
<td>true</td>
</tr><tr>
<td><b>url</b></td>
<td><b>access</b></td>
<td>string</td>
<td>
<br/>
</td>
<td>true</td>
<td>false</td>
</tr><tr>
<td><b>basicAuth</b></td>
<td>boolean</td>
Expand Down Expand Up @@ -500,6 +493,13 @@ GrafanaDataSourceSpec defines the desired state of GrafanaDataSource
<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>url</b></td>
<td>string</td>
<td>
<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>user</b></td>
<td>string</td>
Expand Down
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,12 @@ func main() { // nolint
os.Exit(1)
}
if err = (&grafanadatasource.GrafanaDatasourceReconciler{
Client: mgr.GetClient(),
Context: ctx,
Cancel: cancel,
Logger: ctrl.Log.WithName("controllers").WithName("GrafanaDatasource"),
Scheme: mgr.GetScheme(),
Client: mgr.GetClient(),
Context: ctx,
Cancel: cancel,
Logger: ctrl.Log.WithName("controllers").WithName("GrafanaDatasource"),
Scheme: mgr.GetScheme(),
Recorder: mgr.GetEventRecorderFor("GrafanaDatasource"),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "GrafanaDatasource")
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package version

var (
Version = "3.10.0"
Version = "4.0.1"
)

0 comments on commit 8225cdc

Please sign in to comment.