Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1.29] Performance / custom dashboards: new configs (#3668) #3670

Merged
merged 1 commit into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 12 additions & 7 deletions business/dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,14 +569,19 @@ func (in *DashboardsService) GetCustomDashboardRefs(namespace, app, version stri

if len(runtimes) == 0 {
cfg := config.Get()
filters := make(map[string]string)
if app != "" {
filters[cfg.IstioLabels.AppLabelName] = app
}
if version != "" {
filters[cfg.IstioLabels.VersionLabelName] = version
discoveryEnabled := cfg.ExternalServices.CustomDashboards.DiscoveryEnabled
if discoveryEnabled == config.DashboardsDiscoveryEnabled ||
(discoveryEnabled == config.DashboardsDiscoveryAuto &&
len(pods) <= cfg.ExternalServices.CustomDashboards.DiscoveryAutoThreshold) {
filters := make(map[string]string)
if app != "" {
filters[cfg.IstioLabels.AppLabelName] = app
}
if version != "" {
filters[cfg.IstioLabels.VersionLabelName] = version
}
runtimes = in.discoverDashboards(namespace, filters)
}
runtimes = in.discoverDashboards(namespace, filters)
}
return runtimes
}
Expand Down
22 changes: 16 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ const (
OidcClientSecretFile = "/kiali-secret/oidc-secret"
)

const (
DashboardsDiscoveryEnabled = "true"
DashboardsDiscoveryDisabled = "false"
DashboardsDiscoveryAuto = "auto"
)

// Global configuration for the application.
var configuration Config
var rwMutex sync.RWMutex
Expand Down Expand Up @@ -112,10 +118,12 @@ type PrometheusConfig struct {

// CustomDashboardsConfig describes configuration specific to Custom Dashboards
type CustomDashboardsConfig struct {
Enabled bool `yaml:"enabled,omitempty"`
IsCoreComponent bool `yaml:"is_core_component,omitempty"`
NamespaceLabel string `yaml:"namespace_label,omitempty"`
Prometheus PrometheusConfig `yaml:"prometheus,omitempty"`
DiscoveryEnabled string `yaml:"discovery_enabled,omitempty"`
DiscoveryAutoThreshold int `yaml:"discovery_auto_threshold,omitempty"`
Enabled bool `yaml:"enabled,omitempty"`
IsCoreComponent bool `yaml:"is_core_component,omitempty"`
NamespaceLabel string `yaml:"namespace_label,omitempty"`
Prometheus PrometheusConfig `yaml:"prometheus,omitempty"`
}

// GrafanaConfig describes configuration used for Grafana links
Expand Down Expand Up @@ -388,8 +396,10 @@ func NewConfig() (c *Config) {
},
ExternalServices: ExternalServices{
CustomDashboards: CustomDashboardsConfig{
Enabled: true,
NamespaceLabel: "kubernetes_namespace",
DiscoveryEnabled: DashboardsDiscoveryAuto,
DiscoveryAutoThreshold: 10,
Enabled: true,
NamespaceLabel: "kubernetes_namespace",
},
Grafana: GrafanaConfig{
Auth: Auth{
Expand Down