Skip to content

Commit

Permalink
fix(datasource): deprecate unused fields (orgId, editable) (#1501)
Browse files Browse the repository at this point in the history
  • Loading branch information
weisdd committed Apr 19, 2024
1 parent ea03cf4 commit 53edab1
Show file tree
Hide file tree
Showing 24 changed files with 262 additions and 61 deletions.
7 changes: 5 additions & 2 deletions api/v1beta1/grafanadatasource_types.go
Expand Up @@ -36,11 +36,14 @@ type GrafanaDatasourceInternal struct {
Access string `json:"access,omitempty"`
Database string `json:"database,omitempty"`
User string `json:"user,omitempty"`
OrgID *int64 `json:"orgId,omitempty"`
IsDefault *bool `json:"isDefault,omitempty"`
BasicAuth *bool `json:"basicAuth,omitempty"`
BasicAuthUser string `json:"basicAuthUser,omitempty"`
Editable *bool `json:"editable,omitempty"`

// Deprecated field, it has no effect
OrgID *int64 `json:"orgId,omitempty"`
// Deprecated field, it has no effect
Editable *bool `json:"editable,omitempty"`

// +kubebuilder:validation:Schemaless
// +kubebuilder:pruning:PreserveUnknownFields
Expand Down
10 changes: 5 additions & 5 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 63 additions & 14 deletions bundle/manifests/grafana-operator.clusterserviceversion.yaml
Expand Up @@ -33,13 +33,6 @@ metadata:
"apiVersion": "grafana.integreatly.org/v1beta1",
"kind": "GrafanaAlertRuleGroup",
"metadata": {
"labels": {
"app.kubernetes.io/created-by": "grafana-operator",
"app.kubernetes.io/instance": "grafanaalertrulegroup-sample",
"app.kubernetes.io/managed-by": "kustomize",
"app.kubernetes.io/name": "grafanaalertrulegroup",
"app.kubernetes.io/part-of": "grafana-operator"
},
"name": "grafanaalertrulegroup-sample"
},
"spec": {
Expand Down Expand Up @@ -126,6 +119,32 @@ metadata:
]
}
},
{
"apiVersion": "grafana.integreatly.org/v1beta1",
"kind": "GrafanaContactPoint",
"metadata": {
"labels": {
"app.kubernetes.io/created-by": "grafana-operator",
"app.kubernetes.io/instance": "grafanacontactpoint-sample",
"app.kubernetes.io/managed-by": "kustomize",
"app.kubernetes.io/name": "grafanacontactpoint",
"app.kubernetes.io/part-of": "grafana-operator"
},
"name": "grafanacontactpoint-sample"
},
"spec": {
"instanceSelector": {
"matchLabels": {
"dashboards": "grafana-a"
}
},
"name": "grafanacontactpoint-sample",
"settings": {
"email": null
},
"type": "email"
}
},
{
"apiVersion": "grafana.integreatly.org/v1beta1",
"kind": "GrafanaDashboard",
Expand All @@ -150,7 +169,6 @@ metadata:
"spec": {
"datasource": {
"access": "proxy",
"editable": true,
"isDefault": true,
"jsonData": {
"timeInterval": "5s",
Expand Down Expand Up @@ -192,13 +210,13 @@ metadata:
capabilities: Basic Install
categories: Monitoring
containerImage: ghcr.io/grafana/grafana-operator@sha256:97561cef949b58f55ec67d133c02ac205e2ec3fb77388aeb868dacfcebad0752
createdAt: "2024-03-05T15:09:12Z"
createdAt: "2024-04-19T08:44:59Z"
description: Deploys and manages Grafana instances, dashboards and data sources
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: Grafana Labs
name: grafana-operator.v5.6.3
name: grafana-operator.v5.8.1
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand All @@ -209,6 +227,11 @@ spec:
kind: GrafanaAlertRuleGroup
name: grafanaalertrulegroups.grafana.integreatly.org
version: v1beta1
- description: GrafanaContactPoint is the Schema for the grafanacontactpoints API
displayName: Grafana Contact Point
kind: GrafanaContactPoint
name: grafanacontactpoints.grafana.integreatly.org
version: v1beta1
- description: GrafanaDashboard is the Schema for the grafanadashboards API
displayName: Grafana Dashboard
kind: GrafanaDashboard
Expand Down Expand Up @@ -302,6 +325,32 @@ spec:
- get
- patch
- update
- apiGroups:
- grafana.integreatly.org
resources:
- grafanacontactpoints
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- grafana.integreatly.org
resources:
- grafanacontactpoints/finalizers
verbs:
- update
- apiGroups:
- grafana.integreatly.org
resources:
- grafanacontactpoints/status
verbs:
- get
- patch
- update
- apiGroups:
- grafana.integreatly.org
resources:
Expand Down Expand Up @@ -456,12 +505,12 @@ spec:
- --leader-elect
env:
- name: RELATED_IMAGE_GRAFANA
value: docker.io/grafana/grafana@sha256:ff68ed4324e471ffa269aa5308cdcf12276ef2d5a660daea95db9d629a32a7d8
value: docker.io/grafana/grafana@sha256:9a2acaa26a0b302a56d8e113068a1297cf0726fcaff5e6bb77344888e5f1c976
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.annotations['olm.targetNamespaces']
image: ghcr.io/grafana/grafana-operator@sha256:e398d39e48abdd16ae126233bc3b485b0c7f79e9b087fc5db5c164e9d64da276
image: ghcr.io/grafana/grafana-operator@sha256:34229f59e1609764196870aa2672aa1b784e88583ec445ff04e810a8333b72a7
imagePullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -553,9 +602,9 @@ spec:
name: Grafana Labs
url: https://grafana.com
relatedImages:
- image: docker.io/grafana/grafana@sha256:ff68ed4324e471ffa269aa5308cdcf12276ef2d5a660daea95db9d629a32a7d8
- image: docker.io/grafana/grafana@sha256:9a2acaa26a0b302a56d8e113068a1297cf0726fcaff5e6bb77344888e5f1c976
name: grafana
- image: ghcr.io/grafana/grafana-operator@sha256:e398d39e48abdd16ae126233bc3b485b0c7f79e9b087fc5db5c164e9d64da276
- image: ghcr.io/grafana/grafana-operator@sha256:34229f59e1609764196870aa2672aa1b784e88583ec445ff04e810a8333b72a7
name: manager
- image: ghcr.io/grafana/grafana-operator@sha256:97561cef949b58f55ec67d133c02ac205e2ec3fb77388aeb868dacfcebad0752
name: grafana-operator-97561cef949b58f55ec67d133c02ac205e2ec3fb77388aeb868dacfcebad0752-annotation
Expand Down
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.14.0
creationTimestamp: null
name: grafanaalertrulegroups.grafana.integreatly.org
spec:
Expand Down
143 changes: 143 additions & 0 deletions bundle/manifests/grafana.integreatly.org_grafanacontactpoints.yaml
@@ -0,0 +1,143 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
creationTimestamp: null
name: grafanacontactpoints.grafana.integreatly.org
spec:
group: grafana.integreatly.org
names:
kind: GrafanaContactPoint
listKind: GrafanaContactPointList
plural: grafanacontactpoints
singular: grafanacontactpoint
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
properties:
apiVersion:
type: string
kind:
type: string
metadata:
type: object
spec:
properties:
allowCrossNamespaceImport:
type: boolean
disableResolveMessage:
type: boolean
instanceSelector:
properties:
matchExpressions:
items:
properties:
key:
type: string
operator:
type: string
values:
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-map-type: atomic
name:
type: string
resyncPeriod:
default: 10m
format: duration
pattern: ^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$
type: string
settings:
x-kubernetes-preserve-unknown-fields: true
type:
enum:
- alertmanager
- dingding
- discord
- email
- googlechat
- kafka
- line
- opsgenie
- pagerduty
- pushover
- sensugo
- slack
- teams
- telegram
- threema
- victorops
- webhook
- wecom
type: string
required:
- instanceSelector
- name
- settings
type: object
status:
properties:
conditions:
items:
properties:
lastTransitionTime:
format: date-time
type: string
message:
maxLength: 32768
type: string
observedGeneration:
format: int64
minimum: 0
type: integer
reason:
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
enum:
- "True"
- "False"
- Unknown
type: string
type:
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
required:
- conditions
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.14.0
creationTimestamp: null
name: grafanadashboards.grafana.integreatly.org
spec:
Expand Down
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.14.0
creationTimestamp: null
name: grafanadatasources.grafana.integreatly.org
spec:
Expand Down
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.14.0
creationTimestamp: null
name: grafanafolders.grafana.integreatly.org
spec:
Expand Down

0 comments on commit 53edab1

Please sign in to comment.