1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 11:48:53 +00:00

client: Fix validation for AlertingSpec

This commit is contained in:
Frederic Branczyk 2018-03-09 13:32:40 +01:00
parent 6b355ee73e
commit 12b94fc54f
No known key found for this signature in database
GPG key ID: 7741A52782A90069
5 changed files with 13 additions and 5 deletions
Documentation
pkg
test/framework

View file

@ -205,7 +205,7 @@ Specification of the desired behavior of the Prometheus cluster. More info: http
| routePrefix | The route prefix Prometheus registers HTTP handlers for. This is useful, if using ExternalURL and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`. | string | false |
| storage | Storage spec to specify how storage shall be used. | *[StorageSpec](#storagespec) | false |
| ruleSelector | A selector to select which ConfigMaps to mount for loading rule files from. | *[metav1.LabelSelector](https://v1-6.docs.kubernetes.io/docs/api-reference/v1.6/#labelselector-v1-meta) | false |
| alerting | Define details regarding alerting. | [AlertingSpec](#alertingspec) | false |
| alerting | Define details regarding alerting. | *[AlertingSpec](#alertingspec) | false |
| resources | Define resources requests and limits for single Pods. | [v1.ResourceRequirements](https://v1-6.docs.kubernetes.io/docs/api-reference/v1.6/#resourcerequirements-v1-core) | false |
| nodeSelector | Define which Nodes the Pods are scheduled on. | map[string]string | false |
| serviceAccountName | ServiceAccountName is the name of the ServiceAccount to use to run the Prometheus Pods. | string | false |

View file

@ -98,7 +98,7 @@ type PrometheusSpec struct {
// A selector to select which ConfigMaps to mount for loading rule files from.
RuleSelector *metav1.LabelSelector `json:"ruleSelector,omitempty"`
// Define details regarding alerting.
Alerting AlertingSpec `json:"alerting,omitempty"`
Alerting *AlertingSpec `json:"alerting,omitempty"`
// Define resources requests and limits for single Pods.
Resources v1.ResourceRequirements `json:"resources,omitempty"`
// Define which Nodes the Pods are scheduled on.

View file

@ -564,7 +564,15 @@ func (in *PrometheusSpec) DeepCopyInto(out *PrometheusSpec) {
(*in).DeepCopyInto(*out)
}
}
in.Alerting.DeepCopyInto(&out.Alerting)
if in.Alerting != nil {
in, out := &in.Alerting, &out.Alerting
if *in == nil {
*out = nil
} else {
*out = new(AlertingSpec)
(*in).DeepCopyInto(*out)
}
}
in.Resources.DeepCopyInto(&out.Resources)
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector

View file

@ -92,7 +92,7 @@ func generateTestConfig(version string) ([]byte, error) {
Namespace: "default",
},
Spec: monitoringv1.PrometheusSpec{
Alerting: monitoringv1.AlertingSpec{
Alerting: &monitoringv1.AlertingSpec{
Alertmanagers: []monitoringv1.AlertmanagerEndpoints{
{
Name: "alertmanager-main",

View file

@ -92,7 +92,7 @@ func (f *Framework) MakeBasicPrometheusV1alpha1(ns, name, group string, replicas
}
func (f *Framework) AddAlertingToPrometheus(p *monitoringv1.Prometheus, ns, name string) {
p.Spec.Alerting = monitoringv1.AlertingSpec{
p.Spec.Alerting = &monitoringv1.AlertingSpec{
Alertmanagers: []monitoringv1.AlertmanagerEndpoints{
monitoringv1.AlertmanagerEndpoints{
Namespace: ns,