config

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2018 License: Apache-2.0 Imports: 13 Imported by: 169

Documentation

Index

Constants

View Source
const (
	EnvIdentityCertFile       = "IDENTITY_CERT_FILE"
	EnvIdentityPrivateKeyFile = "IDENTITY_PRIVATE_KEY_FILE"

	EnvPrometheusServiceURL   = "PROMETHEUS_SERVICE_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"
	EnvServerCredentialsUsername        = "SERVER_CREDENTIALS_USERNAME"
	EnvServerCredentialsPassword        = "SERVER_CREDENTIALS_PASSWORD"
	EnvWebRoot                          = "SERVER_WEB_ROOT"
	EnvServerStaticContentRootDirectory = "SERVER_STATIC_CONTENT_ROOT_DIRECTORY"
	EnvServerCORSAllowAll               = "SERVER_CORS_ALLOW_ALL"

	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"

	EnvJaegerURL = "JAEGER_URL"

	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"
)

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

Variables

This section is empty.

Functions

func AuthenticationHandler

func AuthenticationHandler(next http.Handler) http.Handler

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) 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 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"`
	IstioLabels      IstioLabels       `yaml:"istio_labels,omitempty"`
	KubernetesConfig KubernetesConfig  `yaml:"kubernetes_config,omitempty"`
	Api              ApiConfig         `yaml:"api,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"`
	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"`
}

GrafanaConfig describes configuration used for Grafana links

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"`
	VersionLabelName string `yaml:"version_label_name,omitempty"`
}

IstioLabels holds configuration about the labels required by Istio

type JaegerConfig

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

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"`
}

Server configuration

type TokenClaim

type TokenClaim struct {
	User string `json:"username"`
	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

type TokenGenerated

type TokenGenerated struct {
	// The authentication token
	// A string with the authentication token for the user
	//
	// example: zI1NiIsIsR5cCI6IkpXVCJ9.ezJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNTI5NTIzNjU0fQ.PPZvRGnR6VA4v7FmgSfQcGQr-VD
	// required: true
	Token string `json:"token"`
	// The expired time for the token
	// A string with the Datetime when the token will be expired
	//
	// example: 2018-06-20 19:40:54.116369887 +0000 UTC m=+43224.838320603
	// required: true
	ExpiredAt string `json:"expired_at"`
}

TokenGenerated tokenGenerated

This is used for returning the token

swagger:model TokenGenerated

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