@@ -73,20 +73,19 @@ type ClusterMonitoringList struct {
73
73
}
74
74
75
75
// ClusterMonitoringSpec defines the desired state of Cluster Monitoring Operator
76
- // +required
77
76
type ClusterMonitoringSpec struct {
78
77
// userDefined set the deployment mode for user-defined monitoring in addition to the default platform monitoring.
79
- // +required
78
+ // userDefined is optional.
79
+ // +optional`
80
80
UserDefined UserDefinedMonitoring `json:"userDefined"`
81
81
// alertmanagerMainConfig allows users to configure how the default Alertmanager instance
82
82
// should be deployed in the `openshift-monitoring` namespace.
83
- // alertmanagerMainConfig is required .
84
- // +required
83
+ // alertmanagerMainConfig is optional .
84
+ // +optional`
85
85
AlertmanagerMainConfig AlertmanagerMainConfig `json:"alertmanagerMainConfig"`
86
86
}
87
87
88
88
// UserDefinedMonitoring config for user-defined projects.
89
- // +required
90
89
type UserDefinedMonitoring struct {
91
90
// mode defines the different configurations of UserDefinedMonitoring
92
91
// Valid values are Disabled and NamespaceIsolated
@@ -108,23 +107,38 @@ const (
108
107
UserDefinedNamespaceIsolated UserDefinedMode = "NamespaceIsolated"
109
108
)
110
109
111
- // alertmanagerMainConfig provides configuration options for the default Alertmanager instance
112
- // that runs in the `openshift-monitoring` namespace. Use this configuration to control
113
- // whether the default Alertmanager is deployed, how it logs, and how its pods are scheduled.
114
- //
115
- // Required: This field must be specified.
110
+ // +union
116
111
type AlertmanagerMainConfig struct {
117
112
// deploymentMode determines whether the default Alertmanager instance should be deployed
118
113
// as part of the monitoring stack.
119
- // mode is required.
120
- // Allowed values are Deployed and Deployed`
114
+ // Allowed values are Deployed and NotDeployed
121
115
// When set to Deployed, the Cluster Monitoring Operator
122
116
// ensures that an Alertmanager instance is created and managed in the `openshift-monitoring` namespace.
123
117
// When set to NotDeployed, the operator will not deploy the Alertmanager instance.
124
118
// Use this field if you want to explicitly opt in or out of running a platform-level Alertmanager.
125
- // +kubebuilder:validation:Enum:=Deployed;NotDeployed;
126
- // +required
127
- DeploymentMode AlertManagerDeployMode `json:"deploymentMode"`
119
+ //
120
+ // This filed is required
121
+ // Allowed values are Deployed and NotDeployed.
122
+ // +unionDiscriminator
123
+ // +kubebuilder:validation:Enum=Deployed;NotDeployed
124
+ // +kubebuilder:validation:Required
125
+ DeploymentMode string `json:"deploymentMode"`
126
+
127
+ // deployed contains configuration options for the deployed Alertmanager instance.
128
+ // +optional
129
+ Deployed * AlertmanagerDeployedConfig `json:"deployed,omitempty"`
130
+
131
+ // notDeployed is an empty struct used to indicate that the Alertmanager should not be deployed.
132
+ // +optional
133
+ NotDeployed * AlertmanagerNotDeployedConfig `json:"notDeployed,omitempty"`
134
+ }
135
+
136
+ // alertmanagerMainConfig provides configuration options for the default Alertmanager instance
137
+ // that runs in the `openshift-monitoring` namespace. Use this configuration to control
138
+ // whether the default Alertmanager is deployed, how it logs, and how its pods are scheduled.
139
+ //
140
+ // Required: This field must be specified.
141
+ type AlertmanagerDeployedConfig struct {
128
142
// userMode controls whether Alertmanager should process configurations from user-defined (non-platform)
129
143
// namespaces for AlertmanagerConfig lookups.
130
144
// Alertmanager will search for AlertmanagerConfig resources in user-defined namespaces.
@@ -202,6 +216,10 @@ type AlertmanagerMainConfig struct {
202
216
VolumeClaimTemplate v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"`
203
217
}
204
218
219
+ type AlertmanagerNotDeployedConfig struct {
220
+ // Empty by design: Alertmanager will not be deployed.
221
+ }
222
+
205
223
// SecretName is a type that represents the name of a Secret in the same namespace.
206
224
// +kubebuilder:validation:MaxLength=253
207
225
type SecretName string
0 commit comments