diff --git a/deploy/examples/datasources/Prometheus.yaml b/deploy/examples/datasources/Prometheus.yaml index e66986199..315253088 100644 --- a/deploy/examples/datasources/Prometheus.yaml +++ b/deploy/examples/datasources/Prometheus.yaml @@ -13,4 +13,5 @@ spec: version: 1 editable: true jsonData: + tlsSkipVerify: true timeInterval: "5s" \ No newline at end of file diff --git a/pkg/apis/integreatly/v1alpha1/grafanadatasource_types.go b/pkg/apis/integreatly/v1alpha1/grafanadatasource_types.go index a9574bd1c..c0f1ff54e 100644 --- a/pkg/apis/integreatly/v1alpha1/grafanadatasource_types.go +++ b/pkg/apis/integreatly/v1alpha1/grafanadatasource_types.go @@ -48,23 +48,63 @@ type GrafanaDataSourceList struct { } type GrafanaDataSourceFields struct { - Name string `json:"name"` - Type string `json:"type"` - Access string `json:"access"` - OrgId int `json:"orgId,omitempty"` - Url string `json:"url"` - Password string `json:"password,omitempty"` - User string `json:"user,omitempty"` - Database string `json:"database,omitempty"` - BasicAuth bool `json:"basicAuth,omitempty"` - BasicAuthUser string `json:"basicAuthUser,omitempty"` - BasicAuthPassword string `json:"basicAuthPassword,omitempty"` - WithCredentials bool `json:"withCredentials,omitempty"` - IsDefault bool `json:"isDefault,omitempty"` - JsonData map[string]string `json:"jsonData,omitempty"` - SecureJsonData map[string]string `json:"secureJsonData,omitempty"` - Version int `json:"version,omitempty"` - Editable bool `json:"editable,omitempty"` + Name string `json:"name"` + Type string `json:"type"` + Access string `json:"access"` + OrgId int `json:"orgId,omitempty"` + Url string `json:"url"` + Password string `json:"password,omitempty"` + User string `json:"user,omitempty"` + Database string `json:"database,omitempty"` + BasicAuth bool `json:"basicAuth,omitempty"` + BasicAuthUser string `json:"basicAuthUser,omitempty"` + BasicAuthPassword string `json:"basicAuthPassword,omitempty"` + WithCredentials bool `json:"withCredentials,omitempty"` + IsDefault bool `json:"isDefault,omitempty"` + JsonData GrafanaDataSourceJsonData `json:"jsonData,omitempty"` + SecureJsonData GrafanaDataSourceSecureJsonData `json:"secureJsonData,omitempty"` + Version int `json:"version,omitempty"` + Editable bool `json:"editable,omitempty"` +} + +// The most common json options +// See https://grafana.com/docs/administration/provisioning/#datasources +type GrafanaDataSourceJsonData struct { + TlsAuth bool `json:"tlsAuth,omitempty"` + TlsAuthWithCACert bool `json:"tlsAuthWithCACert,omitempty"` + TlsSkipVerify bool `json:"tlsSkipVerify,omitempty"` + GraphiteVersion string `json:"graphiteVersion,omitempty"` + TimeInterval string `json:"timeInterval,omitempty"` + EsVersion int `json:"esVersion,omitempty"` + TimeField string `json:"timeField,omitempty"` + Interval string `json:"interval,omitempty"` + LogMessageField string `json:"logMessageField,omitempty"` + LogLevelField string `json:"logLevelField,omitempty"` + AuthType string `json:"authType,omitempty"` + AssumeRoleArn string `json:"assumeRoleArn,omitempty"` + DefaultRegion string `json:"defaultRegion,omitempty"` + CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"` + TsdbVersion string `json:"tsdbVersion,omitempty"` + TsdbResolution string `json:"tsdbResolution,omitempty"` + Sslmode string `json:"sslmode,omitempty"` + Encrypt string `json:"encrypt,omitempty"` + PostgresVersion int `json:"postgresVersion,omitempty"` + Timescaledb bool `json:"timescaledb,omitempty"` + MaxOpenConns int `json:"maxOpenConns,omitempty"` + MaxIdleConns int `json:"maxIdleConns,omitempty"` + ConnMaxLifetime int `json:"connMaxLifetime,omitempty"` +} + +// The most common secure json options +// See https://grafana.com/docs/administration/provisioning/#datasources +type GrafanaDataSourceSecureJsonData struct { + TlsCaCert string `json:"tlsCACert,omitempty"` + TlsClientCert string `json:"tlsClientCert,omitempty"` + TlsClientKey string `json:"tlsClientKey,omitempty"` + Password string `json:"password,omitempty"` + BasicAuthPassword string `json:"basicAuthPassword,omitempty"` + AccessKey string `json:"accessKey,omitempty"` + SecretKey string `json:"secretKey,omitempty"` } func init() { diff --git a/pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go index 524a12b9f..1ca53ade1 100644 --- a/pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go @@ -1,6 +1,6 @@ // +build !ignore_autogenerated -// Code generated by deepcopy-gen. DO NOT EDIT. +// Code generated by operator-sdk-v0.10.0-x86_64-linux-gnu. DO NOT EDIT. package v1alpha1 @@ -732,20 +732,8 @@ func (in *GrafanaDataSource) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GrafanaDataSourceFields) DeepCopyInto(out *GrafanaDataSourceFields) { *out = *in - if in.JsonData != nil { - in, out := &in.JsonData, &out.JsonData - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.SecureJsonData != nil { - in, out := &in.SecureJsonData, &out.SecureJsonData - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } + out.JsonData = in.JsonData + out.SecureJsonData = in.SecureJsonData return } @@ -759,6 +747,22 @@ func (in *GrafanaDataSourceFields) DeepCopy() *GrafanaDataSourceFields { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GrafanaDataSourceJsonData) DeepCopyInto(out *GrafanaDataSourceJsonData) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaDataSourceJsonData. +func (in *GrafanaDataSourceJsonData) DeepCopy() *GrafanaDataSourceJsonData { + if in == nil { + return nil + } + out := new(GrafanaDataSourceJsonData) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GrafanaDataSourceList) DeepCopyInto(out *GrafanaDataSourceList) { *out = *in @@ -792,15 +796,29 @@ func (in *GrafanaDataSourceList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GrafanaDataSourceSecureJsonData) DeepCopyInto(out *GrafanaDataSourceSecureJsonData) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GrafanaDataSourceSecureJsonData. +func (in *GrafanaDataSourceSecureJsonData) DeepCopy() *GrafanaDataSourceSecureJsonData { + if in == nil { + return nil + } + out := new(GrafanaDataSourceSecureJsonData) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GrafanaDataSourceSpec) DeepCopyInto(out *GrafanaDataSourceSpec) { *out = *in if in.Datasources != nil { in, out := &in.Datasources, &out.Datasources *out = make([]GrafanaDataSourceFields, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + copy(*out, *in) } return }