config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

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"

	EnvServerAddress                    = "SERVER_ADDRESS"
	EnvServerPort                       = "SERVER_PORT"
	EnvServerCredentialsUsername        = "SERVER_CREDENTIALS_USERNAME"
	EnvServerCredentialsPassword        = "SERVER_CREDENTIALS_PASSWORD"
	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"

	EnvJaegerServiceNamespace = "JAEGER_SERVICE_NAMESPACE"
	EnvJaegerService          = "JAEGER_SERVICE"
	EnvJaegerServicePort      = "JAEGER_SERVICE_PORT"

	EnvAppLabelName     = "APP_LABEL_NAME"
	EnvVersionLabelName = "VERSION_LABEL_NAME"

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

	EnvKialiService       = "KIALI_SERVICE"
	IstioVersionSupported = ">= 1.0"
)

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

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 Config

type Config struct {
	Identity         security.Identity `yaml:",omitempty"`
	Server           Server            `yaml:",omitempty"`
	InCluster        bool              `yaml:"in_cluster,omitempty"`
	AppLabelName     string            `yaml:"app_label_name,omitempty"`
	VersionLabelName string            `yaml:"version_label_name,omitempty"`
	ExternalServices ExternalServices  `yaml:"external_services,omitempty"`
	LoginToken       LoginToken        `yaml:"login_token,omitempty"`
	KialiService     string            `yaml:"kiali_service,omitempty"`
	IstioNamespace   string            `yaml:"istio_namespace,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 JaegerConfig

type JaegerConfig struct {
	ServiceNamespace string `yaml:"service_namespace"`
	Service          string `yaml:"service"`
	ServicePort      string `yaml:"service_port"`
}

JaegerConfig describes configuration used for jaeger links

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