Skip to content

Commit 383f7c0

Browse files
authored
Merge pull request #40 from integr8ly/fix-extra-json
fix datasource json and secure json fields
2 parents 3106d08 + 906af99 commit 383f7c0

File tree

3 files changed

+94
-35
lines changed

3 files changed

+94
-35
lines changed

deploy/examples/datasources/Prometheus.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ spec:
1313
version: 1
1414
editable: true
1515
jsonData:
16+
tlsSkipVerify: true
1617
timeInterval: "5s"

pkg/apis/integreatly/v1alpha1/grafanadatasource_types.go

+57-17
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,63 @@ type GrafanaDataSourceList struct {
4848
}
4949

5050
type GrafanaDataSourceFields struct {
51-
Name string `json:"name"`
52-
Type string `json:"type"`
53-
Access string `json:"access"`
54-
OrgId int `json:"orgId,omitempty"`
55-
Url string `json:"url"`
56-
Password string `json:"password,omitempty"`
57-
User string `json:"user,omitempty"`
58-
Database string `json:"database,omitempty"`
59-
BasicAuth bool `json:"basicAuth,omitempty"`
60-
BasicAuthUser string `json:"basicAuthUser,omitempty"`
61-
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`
62-
WithCredentials bool `json:"withCredentials,omitempty"`
63-
IsDefault bool `json:"isDefault,omitempty"`
64-
JsonData map[string]string `json:"jsonData,omitempty"`
65-
SecureJsonData map[string]string `json:"secureJsonData,omitempty"`
66-
Version int `json:"version,omitempty"`
67-
Editable bool `json:"editable,omitempty"`
51+
Name string `json:"name"`
52+
Type string `json:"type"`
53+
Access string `json:"access"`
54+
OrgId int `json:"orgId,omitempty"`
55+
Url string `json:"url"`
56+
Password string `json:"password,omitempty"`
57+
User string `json:"user,omitempty"`
58+
Database string `json:"database,omitempty"`
59+
BasicAuth bool `json:"basicAuth,omitempty"`
60+
BasicAuthUser string `json:"basicAuthUser,omitempty"`
61+
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`
62+
WithCredentials bool `json:"withCredentials,omitempty"`
63+
IsDefault bool `json:"isDefault,omitempty"`
64+
JsonData GrafanaDataSourceJsonData `json:"jsonData,omitempty"`
65+
SecureJsonData GrafanaDataSourceSecureJsonData `json:"secureJsonData,omitempty"`
66+
Version int `json:"version,omitempty"`
67+
Editable bool `json:"editable,omitempty"`
68+
}
69+
70+
// The most common json options
71+
// See https://grafana.com/docs/administration/provisioning/#datasources
72+
type GrafanaDataSourceJsonData struct {
73+
TlsAuth bool `json:"tlsAuth,omitempty"`
74+
TlsAuthWithCACert bool `json:"tlsAuthWithCACert,omitempty"`
75+
TlsSkipVerify bool `json:"tlsSkipVerify,omitempty"`
76+
GraphiteVersion string `json:"graphiteVersion,omitempty"`
77+
TimeInterval string `json:"timeInterval,omitempty"`
78+
EsVersion int `json:"esVersion,omitempty"`
79+
TimeField string `json:"timeField,omitempty"`
80+
Interval string `json:"interval,omitempty"`
81+
LogMessageField string `json:"logMessageField,omitempty"`
82+
LogLevelField string `json:"logLevelField,omitempty"`
83+
AuthType string `json:"authType,omitempty"`
84+
AssumeRoleArn string `json:"assumeRoleArn,omitempty"`
85+
DefaultRegion string `json:"defaultRegion,omitempty"`
86+
CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"`
87+
TsdbVersion string `json:"tsdbVersion,omitempty"`
88+
TsdbResolution string `json:"tsdbResolution,omitempty"`
89+
Sslmode string `json:"sslmode,omitempty"`
90+
Encrypt string `json:"encrypt,omitempty"`
91+
PostgresVersion int `json:"postgresVersion,omitempty"`
92+
Timescaledb bool `json:"timescaledb,omitempty"`
93+
MaxOpenConns int `json:"maxOpenConns,omitempty"`
94+
MaxIdleConns int `json:"maxIdleConns,omitempty"`
95+
ConnMaxLifetime int `json:"connMaxLifetime,omitempty"`
96+
}
97+
98+
// The most common secure json options
99+
// See https://grafana.com/docs/administration/provisioning/#datasources
100+
type GrafanaDataSourceSecureJsonData struct {
101+
TlsCaCert string `json:"tlsCACert,omitempty"`
102+
TlsClientCert string `json:"tlsClientCert,omitempty"`
103+
TlsClientKey string `json:"tlsClientKey,omitempty"`
104+
Password string `json:"password,omitempty"`
105+
BasicAuthPassword string `json:"basicAuthPassword,omitempty"`
106+
AccessKey string `json:"accessKey,omitempty"`
107+
SecretKey string `json:"secretKey,omitempty"`
68108
}
69109

70110
func init() {

pkg/apis/integreatly/v1alpha1/zz_generated.deepcopy.go

+36-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)