config

package
v0.0.0-...-c6334f4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigFileName stores file of config
	ConfigFileName = ".kube/kubewatch.yaml"

	// ConfigSample is a sample configuration file.
	ConfigSample = yannotated
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// Handlers know how to send notifications to specific services.
	Handler Handler `json:"handler"`

	// Resources to watch.
	Resource Resource `json:"resource"`

	// For watching specific namespace, leave it empty for watching all.
	// this config is ignored when watching namespaces
	Namespace string `json:"namespace,omitempty"`
}

Config struct contains kubewatch configuration

func New

func New() (*Config, error)

New creates new config object

func (*Config) CheckMissingResourceEnvvars

func (c *Config) CheckMissingResourceEnvvars()

CheckMissingResourceEnvvars will read the environment for equivalent config variables to set

func (*Config) Load

func (c *Config) Load() error

Load loads configuration from config file

func (*Config) Write

func (c *Config) Write() error

type Flock

type Flock struct {
	// URL of the flock API.
	Url string `json:"url"`
}

Flock contains flock configuration

type Handler

type Handler struct {
	Slack      Slack      `json:"slack"`
	Hipchat    Hipchat    `json:"hipchat"`
	Mattermost Mattermost `json:"mattermost"`
	Flock      Flock      `json:"flock"`
	Webhook    Webhook    `json:"webhook"`
	MSTeams    MSTeams    `json:"msteams"`
	SMTP       SMTP       `json:"smtp"`
}

Handler contains handler configuration

type Hipchat

type Hipchat struct {
	// Hipchat token.
	Token string `json:"token"`
	// Room name.
	Room string `json:"room"`
	// URL of the hipchat server.
	Url string `json:"url"`
}

Hipchat contains hipchat configuration

type MSTeams

type MSTeams struct {
	// MSTeams API Webhook URL.
	WebhookURL string `json:"webhookurl"`
}

MSTeams contains MSTeams configuration

type Mattermost

type Mattermost struct {
	Channel  string `json:"room"`
	Url      string `json:"url"`
	Username string `json:"username"`
}

Mattermost contains mattermost configuration

type Resource

type Resource struct {
	Deployment            bool `json:"deployment"`
	ReplicationController bool `json:"rc"`
	ReplicaSet            bool `json:"rs"`
	DaemonSet             bool `json:"ds"`
	Services              bool `json:"svc"`
	Pod                   bool `json:"po"`
	Job                   bool `json:"job"`
	Node                  bool `json:"node"`
	ClusterRole           bool `json:"clusterrole"`
	ServiceAccount        bool `json:"sa"`
	PersistentVolume      bool `json:"pv"`
	Namespace             bool `json:"ns"`
	Secret                bool `json:"secret"`
	ConfigMap             bool `json:"configmap"`
	Ingress               bool `json:"ing"`
}

Resource contains resource configuration

type SMTP

type SMTP struct {
	// Destination e-mail address.
	To string `json:"to" yaml:"to,omitempty"`
	// Sender e-mail address .
	From string `json:"from" yaml:"from,omitempty"`
	// Smarthost, aka "SMTP server"; address of server used to send email.
	Smarthost string `json:"smarthost" yaml:"smarthost,omitempty"`
	// Subject of the outgoing emails.
	Subject string `json:"subject" yaml:"subject,omitempty"`
	// Extra e-mail headers to be added to all outgoing messages.
	Headers map[string]string `json:"headers" yaml:"headers,omitempty"`
	// Authentication parameters.
	Auth SMTPAuth `json:"auth" yaml:"auth,omitempty"`
	// If "true" forces secure SMTP protocol (AKA StartTLS).
	RequireTLS bool `json:"requireTLS" yaml:"requireTLS"`
	// SMTP hello field (optional)
	Hello string `json:"hello" yaml:"hello,omitempty"`
}

SMTP contains SMTP configuration.

type SMTPAuth

type SMTPAuth struct {
	// Username for PLAN and LOGIN auth mechanisms.
	Username string `json:"username" yaml:"username,omitempty"`
	// Password for PLAIN and LOGIN auth mechanisms.
	Password string `json:"password" yaml:"password,omitempty"`
	// Identity for PLAIN auth mechanism
	Identity string `json:"identity" yaml:"identity,omitempty"`
	// Secret for CRAM-MD5 auth mechanism
	Secret string `json:"secret" yaml:"secret,omitempty"`
}

type Slack

type Slack struct {
	// Slack "legacy" API token.
	Token string `json:"token"`
	// Slack channel.
	Channel string `json:"channel"`
	// Title of the message.
	Title string `json:"title"`
}

Slack contains slack configuration

type Webhook

type Webhook struct {
	// Webhook URL.
	Url  string `json:"url"`
	Env  string `json:"env"`
	Type string `json:"type"`
}

Webhook contains webhook configuration

Jump to

Keyboard shortcuts

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