Skip to content

Commit

Permalink
fix: add omitempty to dashboard spec json field (#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
hubeadmin authored Nov 15, 2021
1 parent ac5c63a commit 7e48dfa
Show file tree
Hide file tree
Showing 16 changed files with 2,222 additions and 610 deletions.
4 changes: 1 addition & 3 deletions api/integreatly/v1alpha1/grafanadashboard_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ import (

// GrafanaDashboardSpec defines the desired state of GrafanaDashboard
type GrafanaDashboardSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
Json string `json:"json"`
Json string `json:"json,omitempty"`
Jsonnet string `json:"jsonnet,omitempty"`
Plugins PluginList `json:"plugins,omitempty"`
Url string `json:"url,omitempty"`
Expand Down
3 changes: 0 additions & 3 deletions api/integreatly/v1alpha1/grafanadatasource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ import (

// GrafanaDataSourceSpec defines the desired state of GrafanaDataSource
type GrafanaDataSourceSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

Datasources []GrafanaDataSourceFields `json:"datasources"`
Name string `json:"name"`
}
Expand Down
2 changes: 0 additions & 2 deletions api/integreatly/v1alpha1/grafananotificationchannel_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ const GrafanaNotificationChannelKind = "GrafanaNotificationChannel"

// GrafanaNotificationChannelSpec defines the desired state of GrafanaNotificationChannel
type GrafanaNotificationChannelSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
Json string `json:"json"`
Name string `json:"name"`
}
Expand Down
7 changes: 6 additions & 1 deletion bundle.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM scratch

# Core bundle labels.
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/
Expand All @@ -8,8 +9,12 @@ LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.13.1
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/

# 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/
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: controller-manager
Expand Down
28 changes: 22 additions & 6 deletions bundle/manifests/grafana-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- kind: GrafanaDashboard
- description: GrafanaDashboard is the Schema for the grafanadashboards API
displayName: Grafana Dashboard
kind: GrafanaDashboard
name: grafanadashboards.integreatly.org
version: v1alpha1
- kind: GrafanaDataSource
Expand All @@ -21,7 +23,9 @@ spec:
- kind: GrafanaNotificationChannel
name: grafananotificationchannels.integreatly.org
version: v1alpha1
- kind: Grafana
- description: Grafana is the Schema for the grafanas API
displayName: Grafana
kind: Grafana
name: grafanas.integreatly.org
version: v1alpha1
description: |
Expand Down Expand Up @@ -210,7 +214,7 @@ spec:
- subjectaccessreviews
verbs:
- create
serviceAccountName: default
serviceAccountName: grafana-operator-controller-manager
deployments:
- name: grafana-operator-controller-manager
spec:
Expand All @@ -235,6 +239,7 @@ spec:
ports:
- containerPort: 8443
name: https
protocol: TCP
resources: {}
- args:
- --health-probe-bind-address=:8081
Expand Down Expand Up @@ -269,21 +274,32 @@ spec:
periodSeconds: 10
resources:
limits:
cpu: 100m
cpu: 200m
memory: 300Mi
requests:
cpu: 100m
memory: 100Mi
securityContext:
allowPrivilegeEscalation: false
serviceAccountName: grafana-operator-controller-manager
terminationGracePeriodSeconds: 10
permissions:
- rules:
- apiGroups:
- ""
- coordination.k8s.io
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
Expand All @@ -300,7 +316,7 @@ spec:
verbs:
- create
- patch
serviceAccountName: default
serviceAccountName: grafana-operator-controller-manager
strategy: deployment
installModes:
- supported: true
Expand Down
17 changes: 10 additions & 7 deletions bundle/manifests/integreatly.org_grafanadashboards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ spec:
description: GrafanaDashboard is the Schema for the grafanadashboards 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'
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'
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
Expand All @@ -37,10 +41,12 @@ spec:
description: The key to select.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the ConfigMap or its key must be defined
description: Specify whether the ConfigMap or its key must be
defined
type: boolean
required:
- key
Expand Down Expand Up @@ -69,7 +75,6 @@ spec:
- id
type: object
json:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run "make" to regenerate code after modifying this file'
type: string
jsonnet:
type: string
Expand All @@ -88,8 +93,6 @@ spec:
type: array
url:
type: string
required:
- json
type: object
status:
type: object
Expand Down
27 changes: 22 additions & 5 deletions bundle/manifests/integreatly.org_grafanadatasources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ spec:
description: GrafanaDataSource is the Schema for the grafanadatasources 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'
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'
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
Expand All @@ -48,10 +52,13 @@ spec:
isDefault:
type: boolean
jsonData:
description: The most common json options See https://grafana.com/docs/administration/provisioning/#datasources
description: GrafanaDataSourceJsonData contains the most common
json options See https://grafana.com/docs/administration/provisioning/#datasources
properties:
addCorsHeader:
description: ' Useful fields for clickhouse datasource See https://github.com/Vertamedia/clickhouse-grafana/tree/master/dist/README.md#configure-the-datasource-with-provisioning See https://github.com/Vertamedia/clickhouse-grafana/tree/master/src/datasource.ts#L44'
description: ' Useful fields for clickhouse datasource See
https://github.com/Vertamedia/clickhouse-grafana/tree/master/dist/README.md#configure-the-datasource-with-provisioning See
https://github.com/Vertamedia/clickhouse-grafana/tree/master/src/datasource.ts#L44'
type: boolean
appInsightsAppId:
description: Fields for Azure data sources
Expand Down Expand Up @@ -104,6 +111,9 @@ spec:
type: string
esVersion:
type: integer
githubUrl:
description: Fields for Github data sources
type: string
graphiteVersion:
type: string
httpHeaderName1:
Expand All @@ -130,6 +140,9 @@ spec:
httpMode:
description: Fields for InfluxDB data sources
type: string
implementation:
description: Fields for Alertmanager data sources
type: string
interval:
type: string
logAnalyticsClientId:
Expand Down Expand Up @@ -214,10 +227,14 @@ spec:
password:
type: string
secureJsonData:
description: The most common secure json options See https://grafana.com/docs/administration/provisioning/#datasources
description: GrafanaDataSourceSecureJsonData contains the most
common secure json options See https://grafana.com/docs/administration/provisioning/#datasources
properties:
accessKey:
type: string
accessToken:
description: Fields for Github data sources
type: string
appInsightsApiKey:
type: string
basicAuthPassword:
Expand Down
18 changes: 12 additions & 6 deletions bundle/manifests/integreatly.org_grafananotificationchannels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,26 @@ spec:
- name: v1alpha1
schema:
openAPIV3Schema:
description: GrafanaNotificationChannel is the Schema for the GrafanaNotificationChannels API
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'
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'
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
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
Expand All @@ -40,7 +45,8 @@ spec:
- name
type: object
status:
description: GrafanaNotificationChannelStatus defines the observed state of GrafanaNotificationChannel
description: GrafanaNotificationChannelStatus defines the observed state
of GrafanaNotificationChannel
properties:
hash:
type: string
Expand Down
Loading

0 comments on commit 7e48dfa

Please sign in to comment.