Skip to content

Commit 95c80bd

Browse files
author
lamai93
committed
Removed prometheus. Updated comment.
1 parent abcae5f commit 95c80bd

File tree

4 files changed

+4
-175
lines changed

4 files changed

+4
-175
lines changed

pkg/apis/deployment/v1alpha/metrics_spec.go

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ package v1alpha
2424
import (
2525
"github.com/arangodb/kube-arangodb/pkg/util"
2626
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
27-
"github.com/pkg/errors"
2827
)
2928

3029
// MetricsAuthenticationSpec contains spec for authentication with arangodb
@@ -33,44 +32,11 @@ type MetricsAuthenticationSpec struct {
3332
JWTTokenSecretName *string `json:"jwtTokenSecretName,omitempty"`
3433
}
3534

36-
// MetricsMonitorResourceMode specifies the type of ServiceMonitor resource to be installed
37-
type MetricsMonitorResourceMode string
38-
39-
const (
40-
// MetricsMonitorResourceModeAuto detects if the CRD for ServiceMonitor is available and creates the resource if so (default)
41-
MetricsMonitorResourceModeAuto MetricsMonitorResourceMode = "Auto"
42-
// MetricsMonitorResourceModeNone never creates the resource
43-
MetricsMonitorResourceModeNone MetricsMonitorResourceMode = "None"
44-
// MetricsMonitorResourceModeAlways always creates the resource and fails if the CRD is not available
45-
MetricsMonitorResourceModeAlways MetricsMonitorResourceMode = "Always"
46-
)
47-
48-
// IsAuto returns true if mode is MetricsMonitorResourceModeAuto
49-
func (t MetricsMonitorResourceMode) IsAuto() bool {
50-
return t == MetricsMonitorResourceModeAuto
51-
}
52-
53-
// IsNone returns true if mode is MetricsMonitorResourceModeNone
54-
func (t MetricsMonitorResourceMode) IsNone() bool {
55-
return t == MetricsMonitorResourceModeNone
56-
}
57-
58-
// IsAlways returns true if mode is MetricsMonitorResourceModeAlways
59-
func (t MetricsMonitorResourceMode) IsAlways() bool {
60-
return t == MetricsMonitorResourceModeAlways
61-
}
62-
63-
// MetricsPrometheusSpec contains metrics for prometheus
64-
type MetricsPrometheusSpec struct {
65-
MonitorResource *MetricsMonitorResourceMode `json:"monitorResource,omitempty"`
66-
}
67-
6835
// MetricsSpec contains spec for arangodb exporter
6936
type MetricsSpec struct {
7037
Enabled *bool `json:"enabled,omitempty"`
7138
Image *string `json:"image,omitempty"`
7239
Authentication MetricsAuthenticationSpec `json:"authentication,omitempty"`
73-
Prometheus MetricsPrometheusSpec `json:"prometheus,omitempty"`
7440
}
7541

7642
// IsEnabled returns whether metrics are enabled or not
@@ -96,7 +62,6 @@ func (s *MetricsSpec) SetDefaults(defaultTokenName string, isAuthenticated bool)
9662
if s.GetJWTTokenSecretName() == "" {
9763
s.Authentication.JWTTokenSecretName = util.NewString(defaultTokenName)
9864
}
99-
s.Prometheus.SetDefaults()
10065
}
10166

10267
// GetJWTTokenSecretName returns the token secret name or empty string
@@ -120,7 +85,6 @@ func (s *MetricsSpec) SetDefaultsFrom(source MetricsSpec) {
12085
if s.Authentication.JWTTokenSecretName == nil {
12186
s.Authentication.JWTTokenSecretName = util.NewStringOrNil(source.Authentication.JWTTokenSecretName)
12287
}
123-
s.Prometheus.SetDefaultsFrom(source.Prometheus)
12488
}
12589

12690
// Validate the given spec
@@ -132,73 +96,10 @@ func (s *MetricsSpec) Validate() error {
13296
}
13397
}
13498

135-
if err := s.Prometheus.Validate(); err != nil {
136-
return err
137-
}
138-
13999
return nil
140100
}
141101

142102
// ResetImmutableFields replaces all immutable fields in the given target with values from the source spec.
143103
func (s MetricsSpec) ResetImmutableFields(fieldPrefix string, target *MetricsSpec) []string {
144104
return nil
145105
}
146-
147-
// SetDefaults sets default values
148-
func (p *MetricsPrometheusSpec) SetDefaults() {
149-
}
150-
151-
// SetDefaultsFrom fills unspecified fields with a value from given source spec.
152-
func (p *MetricsPrometheusSpec) SetDefaultsFrom(source MetricsPrometheusSpec) {
153-
if p.MonitorResource == nil {
154-
p.MonitorResource = NewMetricsMonitorResourceModeOrNil(source.MonitorResource)
155-
}
156-
}
157-
158-
// Validate the given spec
159-
func (p *MetricsPrometheusSpec) Validate() error {
160-
if p.MonitorResource != nil {
161-
return p.MonitorResource.Validate()
162-
}
163-
return nil
164-
}
165-
166-
// Validate the given spec
167-
func (t MetricsMonitorResourceMode) Validate() error {
168-
switch t {
169-
case MetricsMonitorResourceModeAuto, MetricsMonitorResourceModeNone, MetricsMonitorResourceModeAlways:
170-
return nil
171-
default:
172-
return maskAny(errors.Wrapf(ValidationError, "Unknown monitor resource mode: '%s'", string(t)))
173-
}
174-
}
175-
176-
// NewMetricsMonitorResourceMode returns a reference to a string with given value.
177-
func NewMetricsMonitorResourceMode(input MetricsMonitorResourceMode) *MetricsMonitorResourceMode {
178-
return &input
179-
}
180-
181-
// NewMetricsMonitorResourceModeOrNil returns nil if input is nil, otherwise returns a clone of the given value.
182-
func NewMetricsMonitorResourceModeOrNil(input *MetricsMonitorResourceMode) *MetricsMonitorResourceMode {
183-
if input == nil {
184-
return nil
185-
}
186-
187-
return NewMetricsMonitorResourceMode(*input)
188-
}
189-
190-
// MetricsMonitorResourceModeOrDefault returns the default value (or empty string) if input is nil, otherwise returns the referenced value.
191-
func MetricsMonitorResourceModeOrDefault(input *MetricsMonitorResourceMode, defaultValue ...MetricsMonitorResourceMode) MetricsMonitorResourceMode {
192-
if input == nil {
193-
if len(defaultValue) > 0 {
194-
return defaultValue[0]
195-
}
196-
return ""
197-
}
198-
return *input
199-
}
200-
201-
// GetMode returns the given mode or the default value if it is nil
202-
func (t *MetricsMonitorResourceMode) GetMode() MetricsMonitorResourceMode {
203-
return MetricsMonitorResourceModeOrDefault(t, MetricsMonitorResourceModeAuto)
204-
}

pkg/apis/deployment/v1alpha/zz_generated.deepcopy.go

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/deployment/resources/monitoring.go

Lines changed: 0 additions & 50 deletions
This file was deleted.

pkg/util/k8sutil/pods.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ func IsPodReady(pod *v1.Pod) bool {
9494
return condition != nil && condition.Status == v1.ConditionTrue
9595
}
9696

97-
// IsPodSucceeded returns true if all containers of the pod
98-
// have terminated with exit code 0.
97+
// IsPodSucceeded returns true if the arangodb container of the pod
98+
// has terminated with exit code 0.
9999
func IsPodSucceeded(pod *v1.Pod) bool {
100100
if pod.Status.Phase == v1.PodSucceeded {
101101
return true
@@ -114,8 +114,8 @@ func IsPodSucceeded(pod *v1.Pod) bool {
114114
}
115115
}
116116

117-
// IsPodFailed returns true if all containers of the pod
118-
// have terminated and at least one of them wih a non-zero exit code.
117+
// IsPodFailed returns true if the arangodb container of the pod
118+
// has terminated wih a non-zero exit code.
119119
func IsPodFailed(pod *v1.Pod) bool {
120120
if pod.Status.Phase == v1.PodFailed {
121121
return true

0 commit comments

Comments
 (0)