Documentation
¶
Index ¶
- Constants
- Variables
- func All(vs []string, f func(string) bool) bool
- func Any(vs []string, f func(string) bool) bool
- func AppendIfMissing(slice []string, i string) []string
- func Check(e error)
- func Checkf(e error, msg string)
- func Filter(vs []string, f func(string) bool) []string
- func HasSuffixes(word string, suffixes []string) bool
- func Include(vs []string, t string) bool
- func Index(vs []string, t string) int
- func IsEmpty(value string) bool
- func IsInPrivilegedNsList(namespace string) bool
- func MakeConfig() (*types.Config, error)
- func Map(vs []string, f func(string) string) []string
- func PrometheusMiddleware(next http.Handler) http.Handler
- func Union(a map[string]string, b map[string]string) map[string]string
- type LogWrapper
Constants ¶
View Source
const ( // TODO Add Environment variable ECDSAPublicPath = "/var/run/secrets/ecdsa/ecdsa-public.pem" ECDSAKeyPath = "/var/run/secrets/ecdsa/ecdsa-key.pem" TlsCertPath = "/var/run/secrets/certs/tls.crt" TlsKeyPath = "/var/run/secrets/certs/tls.key" TlsCaFile = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" TokenFile = "/var/run/secrets/kubernetes.io/serviceaccount/token" Dns1123LabelFmt string = "^[a-z0-9][-a-z0-9]*$" DNS1123LabelMaxLength int = 63 )
View Source
const ( Empty = "" KubiResourcePrefix = "kubi" KubiClusterRoleBindingReaderName = "kubi-reader" KubiDefaultNetworkPolicyName = "kubi-default" KubiClusterRoleAppName = "namespaced-service" KubiRoleBindingAppName = "namespaced-service-binding" KubiServiceAccountAppName = "service" KubiRoleBindingDefaultName = "default-sa" KubiServiceAccountDefaultName = "default" AuthenticatedGroup = "system:authenticated" AdminGroup = "system:masters" ApplicationMaster = "application:masters" ServiceMaster = "service:masters" ApplicationViewer = "application:view" OPSMaster = "ops:masters" KubiStageScratch = "scratch" KubiStageStaging = "staging" KubiStageStable = "stable" KubiLocatorIntranet = "intranet" KubiLocatorExtranet = "extranet" KubiEnvironmentProduction = "production" KubiEnvironmentShortProduction = "prd" KubiEnvironmentIntegration = "integration" KubiEnvironmentShortInt = "int" KubiEnvironmentUAT = "uat" KubiEnvironmentPreproduction = "preproduction" KubiEnvironmentShortPreproduction = "pprd" KubiEnvironmentDevelopment = "development" KubiEnvironmentShortDevelopment = "dev" KubiTenantUndeterminable = "undeterminable" )
Variables ¶
View Source
var AllEnvironments = []string{ KubiEnvironmentProduction, KubiEnvironmentShortProduction, KubiEnvironmentIntegration, KubiEnvironmentShortInt, KubiEnvironmentUAT, KubiEnvironmentPreproduction, KubiEnvironmentShortPreproduction, KubiEnvironmentDevelopment, KubiEnvironmentShortDevelopment, }
View Source
var BlacklistedNamespaces = []string{ "kube-system", "kube-public", "ingress-nginx", "admin", "default", KubiResourcePrefix, }
View Source
var Config *types.Config
View Source
var DefaultWatchOptionModifier = func(options *v1.ListOptions) { options.ResourceVersion = "" options.FieldSelector = fields.Everything().String() }
Modifier that Fix too old resource version issues
View Source
var Histogram = promauto.NewHistogramVec(prometheus.HistogramOpts{ Name: "kubi_http_requests", Help: "Time per requests", Buckets: []float64{1, 2, 5, 6, 10}, }, []string{"path"}) // this will be partitioned by the HTTP code.
View Source
var LdapMapping = map[string]string{ KubiEnvironmentShortDevelopment: KubiEnvironmentDevelopment, KubiEnvironmentShortInt: KubiEnvironmentIntegration, KubiEnvironmentUAT: KubiEnvironmentUAT, KubiEnvironmentShortPreproduction: KubiEnvironmentPreproduction, KubiEnvironmentShortProduction: KubiEnvironmentProduction, }
View Source
var Log = LogWrapper{ Info: LogOther.Info, Warn: LogOther.Warn, Debug: LogOther.Debug, Error: LogErr.Error, Fatal: LogErr.Fatal, }
View Source
var LogErr = zerolog.New(errorLogger).With().Timestamp().Logger()
View Source
var LogOther = zerolog.New(consoleLogger).With().Timestamp().Logger()
View Source
var NamespaceCreation = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "kubi_namespace_creation", Help: "Number of namespace created", }, []string{"status", "name"})
View Source
var NetworkPolicyCreation = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "kubi_network_policy_creation", Help: "Number of network policy created", }, []string{"status", "target_namespace", "name"})
View Source
var ProjectCreation = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "kubi_project_creation", Help: "Number of project created", }, []string{"status", "name"})
View Source
var RoleBindingsCreation = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "kubi_rolebindings_creation", Help: "Number of role bindings created", }, []string{"status", "target_namespace", "name"})
View Source
var ServiceAccountCreation = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "kubi_service_account_creation", Help: "Number of service account created", }, []string{"status", "target_namespace", "name"})
View Source
var TokenCounter = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "kubi_valid_token_total", Help: "Total number of tokens issued", }, []string{"status"})
View Source
var WhitelistedRoles = []string{
"admin",
"service",
"user",
}
Functions ¶
func AppendIfMissing ¶
func Filter ¶
Filter returns a new slice containing all strings in the slice that satisfy the predicate `f`.
func HasSuffixes ¶
Test if a string a one of suffixes array present.
func IsInPrivilegedNsList ¶ added in v1.24.2
func MakeConfig ¶
Build the configuration from environment variable and validate that is consistent. If false, the program exit with validation message. The validation is not error safe but it limit misconfiguration ( lack of parameter ).
Types ¶
Click to show internal directories.
Click to hide internal directories.