Documentation ¶
Index ¶
- Constants
- Variables
- func Close(c io.Closer)
- func GetConfig() *restgo.Config
- func GetHealthCheck(w http.ResponseWriter, r *http.Request)
- func Retry(schedule wait.Backoff, fn wait.ConditionFunc) error
- func Usage(w http.ResponseWriter, _ *http.Request)
- func ValidateConfigMapKeyName(keyName string) error
- func ValidatePrometheusRuleElements(g *gabs.Container) (bool, error)
- func ValidateVMIPrometheusElements(g *gabs.Container) (bool, error)
- func WaitForEndpointAvailable(action, myURL, host string, headers map[string]string, payload string, ...) error
- type K8s
- func (k *K8s) DeleteAlertmanagerTemplate(w http.ResponseWriter, r *http.Request)
- func (k *K8s) DeletePrometheusRules(w http.ResponseWriter, r *http.Request)
- func (k *K8s) GetAlertmanagerTemplate(w http.ResponseWriter, r *http.Request)
- func (k *K8s) GetAllAlertmanagerTemplatesFileNames(w http.ResponseWriter, r *http.Request)
- func (k *K8s) GetPrometheusConfig(w http.ResponseWriter, r *http.Request)
- func (k *K8s) GetPrometheusRuleNames(w http.ResponseWriter, r *http.Request)
- func (k *K8s) GetPrometheusRuleVersions(w http.ResponseWriter, r *http.Request)
- func (k *K8s) GetPrometheusRules(w http.ResponseWriter, r *http.Request)
- func (k *K8s) GetPrometheusVersions(w http.ResponseWriter, r *http.Request)
- func (k *K8s) NewRouter(config *restgo.Config) *mux.Router
- func (k *K8s) PutAlertmanagerTemplate(w http.ResponseWriter, r *http.Request)
- func (k *K8s) PutPrometheusConfig(w http.ResponseWriter, r *http.Request)
- func (k *K8s) PutPrometheusRules(w http.ResponseWriter, r *http.Request)
- func (k *K8s) PutPrometheusUnnamedRules(w http.ResponseWriter, r *http.Request)
- func (k *K8s) RestartPodsByLabel(label string, waitTime time.Duration, skipValidation string) error
Constants ¶
const AlertmanagerTemplatesConfigMapPath = "spec.alertmanager.templatesConfigMap"
AlertmanagerTemplatesConfigMapPath for Alert Manager configMap.
const K8sPublicIPAddressLabel = "node.info/external.ipaddress"
K8sPublicIPAddressLabel label name for IP address.
const Layout = "2006-01-02T15-04-05"
Layout format of time stamp.
const LevelAll = 0
LevelAll is all log level.
const LevelDebug = 1
LevelDebug is debug log level.
const LevelError = 3
LevelError is error log level.
const LevelFatal = 4
LevelFatal is fatal log level.
const LevelInfo = 2
LevelInfo is info log level.
const LevelMax = LevelFatal
LevelMax is maximum log level.
const LevelMin = LevelAll
LevelMin is minimum log level.
const MaxBackupFiles = 10
MaxBackupFiles is max number of files for backup.
const MaxBackupHours = 48
MaxBackupHours is max hours for backup.
const PrometheusConfigFileName = "prometheus.yml"
PrometheusConfigFileName file name of Prometheus config file.
const PrometheusConfigMapPath = "spec.prometheus.configMap"
PrometheusConfigMapPath path for Prometheus configMap.
const PrometheusRulesConfigMapPath = "spec.prometheus.rulesConfigMap"
PrometheusRulesConfigMapPath path for Prometheus rules configMap.
const PrometheusRulesVersionsConfigMapPath = "spec.prometheus.rulesVersionsConfigMap"
PrometheusRulesVersionsConfigMapPath path for Prometheus rules versions configMap.
const PrometheusVersionsConfigMapPath = "spec.prometheus.versionsConfigMap"
PrometheusVersionsConfigMapPath path for Prometheus versions configMap.
const VMIGroup = "verrazzano.io"
VMIGroup group name for an instance resource.
const VMIMetadataNamePath = "metadata.name"
VMIMetadataNamePath path for metadata name.
const VMIPlural = "verrazzanomonitoringinstances"
VMIPlural plural name for an instance resource.
const VMIVersion = "v1"
VMIVersion version of instance resource.
Variables ¶
var EndpointBackoffSchedule = wait.Backoff{ Steps: 10, Duration: 3 * time.Second, Factor: 2.0, Jitter: 0.0, }
EndpointBackoffSchedule is the schedule used for endpoint polling.
var ListenURL string
ListenURL Cirith listener URL
Functions ¶
func Close ¶
Close calls close on the given Closer, and catches and logs any errors. Useful to call deferred
func GetHealthCheck ¶
func GetHealthCheck(w http.ResponseWriter, r *http.Request)
GetHealthCheck is the /healthcheck router function.
func Retry ¶
func Retry(schedule wait.Backoff, fn wait.ConditionFunc) error
Retry executes the provided function repeatedly, retrying until the function returns done = true, or exceeds the given timeout.
func Usage ¶
func Usage(w http.ResponseWriter, _ *http.Request)
Usage returns the usage for the API.
func ValidateConfigMapKeyName ¶
ValidateConfigMapKeyName validates a given configmap key.
func ValidatePrometheusRuleElements ¶
ValidatePrometheusRuleElements does some basic validation on the rule file.
func ValidateVMIPrometheusElements ¶
ValidateVMIPrometheusElements validates the Prometheus configuration.
Types ¶
type K8s ¶
K8s struct representing kubernetes rest client & clientset
func (*K8s) DeleteAlertmanagerTemplate ¶
func (k *K8s) DeleteAlertmanagerTemplate(w http.ResponseWriter, r *http.Request)
DeleteAlertmanagerTemplate deletes a requested Alert Manager template file.
func (*K8s) DeletePrometheusRules ¶
func (k *K8s) DeletePrometheusRules(w http.ResponseWriter, r *http.Request)
DeletePrometheusRules removes the requested current Alert Rules file. If the optional flag is included, delete all the rules saved backups too.
func (*K8s) GetAlertmanagerTemplate ¶
func (k *K8s) GetAlertmanagerTemplate(w http.ResponseWriter, r *http.Request)
GetAlertmanagerTemplate returns a requested Alert Manager template file.
func (*K8s) GetAllAlertmanagerTemplatesFileNames ¶
func (k *K8s) GetAllAlertmanagerTemplatesFileNames(w http.ResponseWriter, r *http.Request)
GetAllAlertmanagerTemplatesFileNames returns all Alert Manager template files.
func (*K8s) GetPrometheusConfig ¶
func (k *K8s) GetPrometheusConfig(w http.ResponseWriter, r *http.Request)
GetPrometheusConfig returns the Prometheus configuration.
func (*K8s) GetPrometheusRuleNames ¶
func (k *K8s) GetPrometheusRuleNames(w http.ResponseWriter, r *http.Request)
GetPrometheusRuleNames returns a JSON with names of all current Prometheus rules files.
func (*K8s) GetPrometheusRuleVersions ¶
func (k *K8s) GetPrometheusRuleVersions(w http.ResponseWriter, r *http.Request)
GetPrometheusRuleVersions takes the user-provided rule file name and returns a JSON with all available versions of that file.
func (*K8s) GetPrometheusRules ¶
func (k *K8s) GetPrometheusRules(w http.ResponseWriter, r *http.Request)
GetPrometheusRules returns the contents of the requested Alert Rules file. All rules files must end in suffix ".rules" so we can differentiate requests for current vs. saved versions.
func (*K8s) GetPrometheusVersions ¶
func (k *K8s) GetPrometheusVersions(w http.ResponseWriter, r *http.Request)
GetPrometheusVersions returns the Prometheus version.
func (*K8s) PutAlertmanagerTemplate ¶
func (k *K8s) PutAlertmanagerTemplate(w http.ResponseWriter, r *http.Request)
PutAlertmanagerTemplate adds a requested Alert Manager template file.
func (*K8s) PutPrometheusConfig ¶
func (k *K8s) PutPrometheusConfig(w http.ResponseWriter, r *http.Request)
PutPrometheusConfig saves the Prometheus configuration.
func (*K8s) PutPrometheusRules ¶
func (k *K8s) PutPrometheusRules(w http.ResponseWriter, r *http.Request)
PutPrometheusRules updates the requested Alert Rules file with the provided body. If not a new rule, save a backup copy of the current rule.
func (*K8s) PutPrometheusUnnamedRules ¶
func (k *K8s) PutPrometheusUnnamedRules(w http.ResponseWriter, r *http.Request)
PutPrometheusUnnamedRules PUT /prometheus/rules has been deprecated. Return a friendly error message instead.
func (*K8s) RestartPodsByLabel ¶
RestartPodsByLabel simulates a restart by (1) deleting all pods (sequentially) that have the given label, then (2) waiting up to waitTime for at least one *new* pod to be created and reach the READY status (PodPhase == PodRunning && [*]ContainerStatus.Ready == true). Note that even through we are ensure that the containers and pod are running, we cannot ensure the pod is actually ready to service requests. See docs for more information: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/