Skip to content

Commit

Permalink
remove istio_component_namespaces
Browse files Browse the repository at this point in the history
fixes: kiali#4109
  • Loading branch information
jmazzitelli committed Jun 17, 2021
1 parent 9ff1a3b commit 538efb4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 27 deletions.
12 changes: 1 addition & 11 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,6 @@ type DeploymentConfig struct {
Namespace string `yaml:"namespace,omitempty"` // Kiali deployment namespace
}

// IstioComponentNamespaces holds the component-specific Istio namespaces. Any missing component
// defaults to the namespace configured for IstioNamespace (which itself defaults to 'istio-system').
type IstioComponentNamespaces map[string]string

// GraphFindOption defines a single Graph Find/Hide Option
type GraphFindOption struct {
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Expand Down Expand Up @@ -375,7 +371,6 @@ type Config struct {
Identity security.Identity `yaml:",omitempty"`
InCluster bool `yaml:"in_cluster,omitempty"`
InstallationTag string `yaml:"installation_tag,omitempty"`
IstioComponentNamespaces IstioComponentNamespaces `yaml:"istio_component_namespaces,omitempty"`
IstioLabels IstioLabels `yaml:"istio_labels,omitempty"`
IstioNamespace string `yaml:"istio_namespace,omitempty"` // default component namespace
KialiFeatureFlags KialiFeatureFlags `yaml:"kiali_feature_flags,omitempty"`
Expand Down Expand Up @@ -780,15 +775,10 @@ func SaveToFile(filename string, conf *Config) (err error) {
return
}

// IsIstioNamespace returns true if the namespace is the default istio namespace or an Istio component namespace
// IsIstioNamespace returns true if the namespace is the default istio namespace
func IsIstioNamespace(namespace string) bool {
if namespace == configuration.IstioNamespace {
return true
}
for _, ns := range configuration.IstioComponentNamespaces {
if ns == namespace {
return true
}
}
return false
}
1 change: 0 additions & 1 deletion graph/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func setupMocked() (*prometheus.Client, *prometheustest.PromAPIMock, *kubetest.K
func setupMockedWithIstioComponentNamespaces() (*prometheus.Client, *prometheustest.PromAPIMock, *kubetest.K8SClientMock, error) {
testConfig := config.NewConfig()
testConfig.KubernetesConfig.CacheEnabled = false
testConfig.IstioComponentNamespaces = config.IstioComponentNamespaces{"telemetry": "istio-telemetry"}
config.Set(testConfig)
k8s := new(kubetest.K8SClientMock)

Expand Down
28 changes: 13 additions & 15 deletions handlers/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,19 @@ type PrometheusConfig struct {
// PublicConfig is a subset of Kiali configuration that can be exposed to clients to
// help them interact with the system.
type PublicConfig struct {
ClusterInfo ClusterInfo `json:"clusterInfo,omitempty"`
Clusters map[string]business.Cluster `json:"clusters,omitempty"`
Extensions Extensions `json:"extensions,omitempty"`
HealthConfig config.HealthConfig `json:"healthConfig,omitempty"`
InstallationTag string `json:"installationTag,omitempty"`
IstioAnnotations IstioAnnotations `json:"istioAnnotations,omitempty"`
IstioStatusEnabled bool `json:"istioStatusEnabled,omitempty"`
IstioIdentityDomain string `json:"istioIdentityDomain,omitempty"`
IstioNamespace string `json:"istioNamespace,omitempty"`
IstioComponentNamespaces config.IstioComponentNamespaces `json:"istioComponentNamespaces,omitempty"`
IstioLabels config.IstioLabels `json:"istioLabels,omitempty"`
IstioConfigMap string `json:"istioConfigMap"`
KialiFeatureFlags config.KialiFeatureFlags `json:"kialiFeatureFlags,omitempty"`
Prometheus PrometheusConfig `json:"prometheus,omitempty"`
ClusterInfo ClusterInfo `json:"clusterInfo,omitempty"`
Clusters map[string]business.Cluster `json:"clusters,omitempty"`
Extensions Extensions `json:"extensions,omitempty"`
HealthConfig config.HealthConfig `json:"healthConfig,omitempty"`
InstallationTag string `json:"installationTag,omitempty"`
IstioAnnotations IstioAnnotations `json:"istioAnnotations,omitempty"`
IstioStatusEnabled bool `json:"istioStatusEnabled,omitempty"`
IstioIdentityDomain string `json:"istioIdentityDomain,omitempty"`
IstioNamespace string `json:"istioNamespace,omitempty"`
IstioLabels config.IstioLabels `json:"istioLabels,omitempty"`
IstioConfigMap string `json:"istioConfigMap"`
KialiFeatureFlags config.KialiFeatureFlags `json:"kialiFeatureFlags,omitempty"`
Prometheus PrometheusConfig `json:"prometheus,omitempty"`
}

// Config is a REST http.HandlerFunc serving up the Kiali configuration made public to clients.
Expand All @@ -86,7 +85,6 @@ func Config(w http.ResponseWriter, r *http.Request) {
IstioStatusEnabled: config.ExternalServices.Istio.ComponentStatuses.Enabled,
IstioIdentityDomain: config.ExternalServices.Istio.IstioIdentityDomain,
IstioNamespace: config.IstioNamespace,
IstioComponentNamespaces: config.IstioComponentNamespaces,
IstioLabels: config.IstioLabels,
IstioConfigMap: config.ExternalServices.Istio.ConfigMapName,
KialiFeatureFlags: config.KialiFeatureFlags,
Expand Down

0 comments on commit 538efb4

Please sign in to comment.