utils

package
v0.0.0-...-9414305 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 8 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:"keptn"`
	SplunkEndpoint string `envconfig:"SPLUNK_ENDPOINT" default:"localhost:8089"`
}

EnvConfig holds the configuration of environment variables that this service uses

type Formatter

type Formatter struct {
	Fields           logger.Fields
	BuiltinFormatter logger.Formatter
}

func (*Formatter) Format

func (f *Formatter) Format(entry *logger.Entry) ([]byte, error)

Jump to

Keyboard shortcuts

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