-
Notifications
You must be signed in to change notification settings - Fork 6
/
debuggingconfiguration_types.go
120 lines (88 loc) · 4.03 KB
/
debuggingconfiguration_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
Copyright 2022. projectsveltos.io. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
DebuggingConfigurationKind = "DebuggingConfiguration"
)
// +kubebuilder:validation:Enum:=LogLevelNotSet;LogLevelInfo;LogLevelDebug;LogLevelVerbose
type LogLevel string
const (
// LogLevelNotSet indicates log severity is not set. Default configuration will apply.
LogLevelNotSet = LogLevel("LogLevelNotSet")
// LogLevelInfo indicates log severity info (V(0)) is set
LogLevelInfo = LogLevel("LogLevelInfo")
// LogLevelDebug indicates log severity debug (V(5)) is set
LogLevelDebug = LogLevel("LogLevelDebug")
// LogLevelVerbose indicates log severity debug (V(10)) is set
LogLevelVerbose = LogLevel("LogLevelVerbose")
)
//nolint:lll // kubebuilder marker
// +kubebuilder:validation:Enum:=AddonManager;Classifier;ClassifierAgent;SveltosClusterManager;DriftDetectionManager;AccessManager;HealthCheckManager;EventManager;ShardController;UIBackend
type Component string
const (
// ComponentAddonManager is the addon-manager pod
ComponentAddonManager = Component("AddonManager")
// Classifier is the classifier pod
ComponentClassifier = Component("Classifier")
// ClassifierAgent is the classifier agent pod
ComponentClassifierAgent = Component("ClassifierAgent")
// ComponentSveltosClusterManager is the sveltoscluster-manager pod
ComponentSveltosClusterManager = Component("SveltosClusterManager")
// ComponentDriftDetectionManager is the drift-detection-manager pod
ComponentDriftDetectionManager = Component("DriftDetectionManager")
// ComponentAccessManager is the access-manager pod
ComponentAccessManager = Component("AccessManager")
// ComponentHealthCheckManager is the healthcheck-manager pod
ComponentHealthCheckManager = Component("HealthCheckManager")
// ComponentEventManager is the event-manager pod
ComponentEventManager = Component("EventManager")
// ComponentShardController is the shard-controller pod
ComponentShardController = Component("ShardController")
// ComponentUIBackend is the ui backend pod
ComponentUIBackend = Component("UIBaeckend")
)
// ComponentConfiguration is the debugging configuration to be applied to a Sveltos component.
type ComponentConfiguration struct {
// Component indicates which Sveltos component the configuration applies to.
Component Component `json:"component"`
// LogLevel is the log severity above which logs are sent to the stdout. [Default: Info]
LogLevel LogLevel `json:"logLevel,omitempty"`
}
// DebuggingConfigurationSpec defines the desired state of DebuggingConfiguration
type DebuggingConfigurationSpec struct {
// Configuration contains debugging configuration as granular as per component.
// +listType=atomic
// +optional
Configuration []ComponentConfiguration `json:"configuration,omitempty"`
}
//+kubebuilder:object:root=true
//+kubebuilder:resource:path=debuggingconfigurations,scope=Cluster
// DebuggingConfiguration is the Schema for the debuggingconfigurations API
type DebuggingConfiguration struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DebuggingConfigurationSpec `json:"spec,omitempty"`
}
//+kubebuilder:object:root=true
// DebuggingConfigurationList contains a list of DebuggingConfiguration
type DebuggingConfigurationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []DebuggingConfiguration `json:"items"`
}
func init() {
SchemeBuilder.Register(&DebuggingConfiguration{}, &DebuggingConfigurationList{})
}