utils

package
v0.0.0-...-573eebf Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "splunk-sli-provider"

ServiceName holds the name of this service

View Source
const SliResourceURI = "splunk/sli.yaml"

SliResourceURI holds the name of the SLI file that this service uses

Variables

This section is empty.

Functions

func EnvVarOrDefault

func EnvVarOrDefault(envName, defaultVal string) string

EnvVarOrDefault returns the value of the environment variable named "envName" if found or "defaultVal" otherwise

func GetKubeClient

func GetKubeClient() (*kubernetes.Clientset, error)

GetKubeClient returns a k8s ClientSet using the in-cluster config

func ListK8sServicesByLabel

func ListK8sServicesByLabel(svcLabelSelector, namespace string) (*v1.ServiceList, error)

ListK8sServicesByLabel returns a k8s service list matching the passed labelSelector in the specified namespace

func ReadK8sSecretAsString

func ReadK8sSecretAsString(namespace string, secretName string, secretKey string) (string, error)

ReadK8sSecretAsString returns the value of secretKey within a secret secretName within namespace namespace

Types

type EnvConfig

type EnvConfig struct {
	// Port on which to listen for cloudevents
	Port                          int    `envconfig:"RCV_PORT" default:"8080"`
	Path                          string `envconfig:"RCV_PATH" default:"/events"`
	ConfigurationServiceURL       string `envconfig:"CONFIGURATION_SERVICE" default:""`
	SplunkNamespace               string `envconfig:"SPLUNK_NS" default:""`
	SplunkConfigMap               string `envconfig:"SPLUNK_CM" default:""`
	SplunkLabels                  string `envconfig:"SPLUNK_LABELS" default:""`
	AlertManagerLabels            string `envconfig:"ALERT_MANAGER_LABELS" default:""`
	AlertManagerNamespace         string `envconfig:"ALERT_MANAGER_NS" default:""`
	AlertManagerConfigMap         string `envconfig:"ALERT_MANAGER_CM" default:""`
	AlertManagerTemplateConfigMap string `envconfig:"ALERT_MANAGER_TEMPLATE_CM" default:"alertmanager-templates"`
	SplunkConfigFileName          string `envconfig:"SPLUNK_CONFIG_FILENAME" default:"splunk.yml"`
	AlertManagerConfigFileName    string `envconfig:"ALERT_MANAGER_CONFIG_FILENAME" default:"alertmanager.yml"`
	PodNamespace                  string `envconfig:"POD_NAMESPACE" default:""`
	SplunkEndpoint                string `envconfig:"SPLUNK_ENDPOINT" default:""`
	K8sNamespace                  string `envconfig:"K8S_NAMESPACE" required:"true"`
}

EnvConfig holds the configuration of environment variables that this service uses

Directories

Path Synopsis
Package prometheus contains copied code parts of the prometheus project (https://github.com/prometheus/prometheus) See the description of the different structures to get more information on where they have been extracted These definitions should match the structs in the supported prometheus version
Package prometheus contains copied code parts of the prometheus project (https://github.com/prometheus/prometheus) See the description of the different structures to get more information on where they have been extracted These definitions should match the structs in the supported prometheus version
fake
Package fake is a generated GoMock package.
Package fake is a generated GoMock package.

Jump to

Keyboard shortcuts

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