config

package
v0.17.0-snapshot.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2019 License: Apache-2.0 Imports: 13 Imported by: 169

Documentation

Index

Constants

View Source
const (
	EnvInstallationTag = "KIALI_INSTALLATION_TAG"

	EnvIdentityCertFile       = "IDENTITY_CERT_FILE"
	EnvIdentityPrivateKeyFile = "IDENTITY_PRIVATE_KEY_FILE"

	EnvPrometheusServiceURL       = "PROMETHEUS_SERVICE_URL"
	EnvPrometheusCustomMetricsURL = "PROMETHEUS_CUSTOM_METRICS_URL"
	EnvInCluster                  = "IN_CLUSTER"
	EnvIstioIdentityDomain        = "ISTIO_IDENTITY_DOMAIN"
	EnvIstioSidecarAnnotation     = "ISTIO_SIDECAR_ANNOTATION"
	EnvIstioUrlServiceVersion     = "ISTIO_URL_SERVICE_VERSION"
	EnvApiNamespacesExclude       = "API_NAMESPACES_EXCLUDE"

	EnvServerAddress                    = "SERVER_ADDRESS"
	EnvServerPort                       = "SERVER_PORT"
	EnvWebRoot                          = "SERVER_WEB_ROOT"
	EnvServerStaticContentRootDirectory = "SERVER_STATIC_CONTENT_ROOT_DIRECTORY"
	EnvServerCORSAllowAll               = "SERVER_CORS_ALLOW_ALL"
	EnvServerAuditLog                   = "SERVER_AUDIT_LOG"
	EnvServerMetricsPort                = "SERVER_METRICS_PORT"
	EnvServerMetricsEnabled             = "SERVER_METRICS_ENABLED"

	EnvGrafanaDisplayLink              = "GRAFANA_DISPLAY_LINK"
	EnvGrafanaURL                      = "GRAFANA_URL"
	EnvGrafanaServiceNamespace         = "GRAFANA_SERVICE_NAMESPACE"
	EnvGrafanaService                  = "GRAFANA_SERVICE"
	EnvGrafanaWorkloadDashboardPattern = "GRAFANA_WORKLOAD_DASHBOARD_PATTERN"
	EnvGrafanaServiceDashboardPattern  = "GRAFANA_SERVICE_DASHBOARD_PATTERN"
	EnvGrafanaVarNamespace             = "GRAFANA_VAR_NAMESPACE"
	EnvGrafanaVarService               = "GRAFANA_VAR_SERVICE"
	EnvGrafanaVarWorkload              = "GRAFANA_VAR_WORKLOAD"
	EnvGrafanaAPIKey                   = "GRAFANA_API_KEY"
	EnvGrafanaUsername                 = "GRAFANA_USERNAME"
	EnvGrafanaPassword                 = "GRAFANA_PASSWORD"

	EnvJaegerURL     = "JAEGER_URL"
	EnvJaegerService = "JAEGER_SERVICE"

	EnvLoginTokenSigningKey        = "LOGIN_TOKEN_SIGNING_KEY"
	EnvLoginTokenExpirationSeconds = "LOGIN_TOKEN_EXPIRATION_SECONDS"
	EnvIstioNamespace              = "ISTIO_NAMESPACE"

	EnvIstioLabelNameApp     = "ISTIO_LABEL_NAME_APP"
	EnvIstioLabelNameVersion = "ISTIO_LABEL_NAME_VERSION"

	EnvKubernetesBurst         = "KUBERNETES_BURST"
	EnvKubernetesQPS           = "KUBERNETES_QPS"
	EnvKubernetesCacheEnabled  = "KUBERNETES_CACHE_ENABLED"
	EnvKubernetesCacheDuration = "KUBERNETES_CACHE_DURATION"

	EnvAuthStrategy = "AUTH_STRATEGY"
)

Environment vars can define some default values. NOTE: If you add a new variable, don't forget to update README.adoc

View Source
const (
	IstioVersionSupported   = ">= 1.0"
	MaistraVersionSupported = ">= 0.1.0"
)

The versions that Kiali requires

View Source
const (
	AuthStrategyOpenshift = "openshift"
	AuthStrategyLogin     = "login"
	AuthStrategyAnonymous = "anonymous"

	TokenCookieName             = "kiali-token"
	AuthStrategyOpenshiftIssuer = "kiali-openshift"
	AuthStrategyLoginIssuer     = "kiali-login"
)

The valid auth strategies and values for cookie handling

View Source
const (
	LoginSecretUsername   = "/kiali-secret/username"
	LoginSecretPassphrase = "/kiali-secret/passphrase"
)

the paths we expect the login secret to be located

Variables

This section is empty.

Functions

func GetSignedTokenString added in v0.16.0

func GetSignedTokenString(claims jwt.Claims) (string, error)

func Marshal

func Marshal(conf *Config) (yamlString string, err error)

Marshal converts the Config object and returns its YAML string.

func SaveToFile

func SaveToFile(filename string, conf *Config) (err error)

SaveToFile converts the Config object and stores its YAML string into the given file, overwriting any data that is in the file.

func Set

func Set(conf *Config)

Set the global Config

func ValidateToken

func ValidateToken(tokenString string) (string, error)

ValidateToken checks if the input token is still valid

Types

type ApiConfig added in v0.9.1

type ApiConfig struct {
	Namespaces ApiNamespacesConfig
}

Exclude Blacklist holds regex strings defining a blacklist

type ApiNamespacesConfig added in v0.9.1

type ApiNamespacesConfig struct {
	Exclude []string
}

Exclude Blacklist holds regex strings defining a blacklist

type AuthConfig added in v0.16.0

type AuthConfig struct {
	Strategy string `yaml:"strategy,omitempty"`
}

Authentication configuration

type Config

type Config struct {
	Identity         security.Identity `yaml:",omitempty"`
	Server           Server            `yaml:",omitempty"`
	InCluster        bool              `yaml:"in_cluster,omitempty"`
	ExternalServices ExternalServices  `yaml:"external_services,omitempty"`
	LoginToken       LoginToken        `yaml:"login_token,omitempty"`
	IstioNamespace   string            `yaml:"istio_namespace,omitempty"`
	InstallationTag  string            `yaml:"installation_tag,omitempty"`
	IstioLabels      IstioLabels       `yaml:"istio_labels,omitempty"`
	KubernetesConfig KubernetesConfig  `yaml:"kubernetes_config,omitempty"`
	API              ApiConfig         `yaml:"api,omitempty"`
	Auth             AuthConfig        `yaml:"auth,omitempty"`
}

Config defines full YAML configuration.

func Get

func Get() (conf *Config)

Get the global Config

func LoadFromFile

func LoadFromFile(filename string) (conf *Config, err error)

LoadFromFile reads the YAML from the given file, parses the content, and returns its Config object representation.

func NewConfig

func NewConfig() (c *Config)

NewConfig creates a default Config struct

func Unmarshal

func Unmarshal(yamlString string) (conf *Config, err error)

Unmarshal parses the given YAML string and returns its Config object representation.

func (Config) String

func (conf Config) String() (str string)

String marshals the given Config into a YAML string

type ExternalServices

type ExternalServices struct {
	Istio                      IstioConfig   `yaml:"istio,omitempty"`
	PrometheusServiceURL       string        `yaml:"prometheus_service_url,omitempty"`
	PrometheusCustomMetricsURL string        `yaml:"prometheus_custom_metrics_url,omitempty"`
	Grafana                    GrafanaConfig `yaml:"grafana,omitempty"`
	Jaeger                     JaegerConfig  `yaml:"jaeger,omitempty"`
}

ExternalServices holds configurations for other systems that Kiali depends on

type GrafanaConfig

type GrafanaConfig struct {
	DisplayLink              bool   `yaml:"display_link"`
	URL                      string `yaml:"url"`
	ServiceNamespace         string `yaml:"service_namespace"`
	Service                  string `yaml:"service"`
	WorkloadDashboardPattern string `yaml:"workload_dashboard_pattern"`
	ServiceDashboardPattern  string `yaml:"service_dashboard_pattern"`
	VarNamespace             string `yaml:"var_namespace"`
	VarService               string `yaml:"var_service"`
	VarWorkload              string `yaml:"var_workload"`
	APIKey                   string `yaml:"api_key"`
	Username                 string `yaml:"username"`
	Password                 string `yaml:"password"`
}

GrafanaConfig describes configuration used for Grafana links

type IanaClaims added in v0.16.0

type IanaClaims struct {
	SessionId string `json:"sid,omitempty"`
	jwt.StandardClaims
}

Structured version of Claims Section, as referenced at https://tools.ietf.org/html/rfc7519#section-4.1 See examples for how to use this with your own claim types

func GetTokenClaimsIfValid added in v0.16.0

func GetTokenClaimsIfValid(tokenString string) (*IanaClaims, error)

type IstioConfig

type IstioConfig struct {
	UrlServiceVersion      string `yaml:"url_service_version"`
	IstioIdentityDomain    string `yaml:"istio_identity_domain,omitempty"`
	IstioSidecarAnnotation string `yaml:"istio_sidecar_annotation,omitempty"`
}

IstioConfig describes configuration used for istio links

type IstioLabels added in v0.7.0

type IstioLabels struct {
	AppLabelName     string `yaml:"app_label_name,omitempty" json:"appLabelName"`
	VersionLabelName string `yaml:"version_label_name,omitempty" json:"versionLabelName"`
}

IstioLabels holds configuration about the labels required by Istio

type JaegerConfig

type JaegerConfig struct {
	URL     string `yaml:"url"`
	Service string `yaml:"service"`
}

JaegerConfig describes configuration used for jaeger links

type KubernetesConfig added in v0.9.0

type KubernetesConfig struct {
	Burst         int     `yaml:"burst,omitempty"`
	QPS           float32 `yaml:"qps,omitempty"`
	CacheEnabled  bool    `yaml:"cache_enabled,omitempty"`
	CacheDuration int64   `yaml:"cache_duration,omitempty"`
}

Kubernetes client configuration

type LoginToken added in v0.6.0

type LoginToken struct {
	SigningKey        []byte `yaml:"signing_key,omitempty"`
	ExpirationSeconds int64  `yaml:"expiration_seconds,omitempty"`
}

LoginToken holds config used in token-based authentication

type Server

type Server struct {
	Address                    string               `yaml:",omitempty"`
	Port                       int                  `yaml:",omitempty"`
	Credentials                security.Credentials `yaml:",omitempty"`
	WebRoot                    string               `yaml:"web_root,omitempty"`
	StaticContentRootDirectory string               `yaml:"static_content_root_directory,omitempty"`
	CORSAllowAll               bool                 `yaml:"cors_allow_all,omitempty"`
	AuditLog                   bool                 `yaml:"audit_log,omitempty"`
	MetricsPort                int                  `yaml:"metrics_port,omitempty"`
	MetricsEnabled             bool                 `yaml:"metrics_enabled,omitempty"`
}

Server configuration

type TokenGenerated

type TokenGenerated struct {
	Username  string    `json:"username"`
	Token     string    `json:"token"`
	ExpiresOn time.Time `json:"expiresOn"`
}

func GenerateToken

func GenerateToken(username string) (TokenGenerated, error)

GenerateToken generates a signed token with an expiration of <ExpirationSeconds> seconds

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL