Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,35 @@ tests:
spec:
userDefined:
mode: "Disabled"
- name: Should accept configurationSource ConfigMap
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
configurationSource: ConfigMap
expected: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
configurationSource: ConfigMap
- name: Should accept configurationSource CRD
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
configurationSource: CRD
expected: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
configurationSource: CRD
- name: Should reject invalid configurationSource
initial: |
apiVersion: config.openshift.io/v1alpha1
kind: ClusterMonitoring
spec:
configurationSource: Invalid
expectedError: 'spec.configurationSource: Unsupported value: "Invalid": supported values: "ConfigMap", "CRD"'
- name: Should accept userAlertmanagerConfigSelection on alertmanagerConfig customConfig
initial: |
apiVersion: config.openshift.io/v1alpha1
Expand Down
26 changes: 26 additions & 0 deletions config/v1alpha1/types_cluster_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ type ClusterMonitoringList struct {
// ClusterMonitoringSpec defines the desired state of Cluster Monitoring Operator
// +kubebuilder:validation:MinProperties=1
type ClusterMonitoringSpec struct {
// configurationSource is an optional field that selects whether the Cluster Monitoring Operator
// reads its configuration from the cluster-monitoring-config ConfigMap or from this ClusterMonitoring CRD.
// Valid values are "ConfigMap" and "CRD".
// When set to ConfigMap, the operator uses the cluster-monitoring-config ConfigMap in the
// openshift-monitoring namespace as the configuration source.
// When set to CRD, the operator uses this ClusterMonitoring custom resource as the configuration source.
// When omitted, this means no opinion and the platform is left to choose a reasonable default,
// which is subject to change over time.
// The current default value is CRD.
// +optional
// +kubebuilder:validation:Enum=ConfigMap;CRD
ConfigurationSource ConfigurationSource `json:"configurationSource,omitempty"`
// userDefined set the deployment mode for user-defined monitoring in addition to the default platform monitoring.
// userDefined is optional.
// When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.
Expand Down Expand Up @@ -757,6 +769,20 @@ type MonitoringPluginConfig struct {
TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
}

// ConfigurationSource selects the configuration source for the Cluster Monitoring Operator.
// +kubebuilder:validation:Enum=ConfigMap;CRD
// +enum
type ConfigurationSource string

const (
// ConfigurationSourceConfigMap means the operator reads configuration from the
// cluster-monitoring-config ConfigMap in the openshift-monitoring namespace.
ConfigurationSourceConfigMap ConfigurationSource = "ConfigMap"
// ConfigurationSourceCRD means the operator reads configuration from this
// ClusterMonitoring custom resource.
ConfigurationSourceCRD ConfigurationSource = "CRD"
)

// UserDefinedMonitoring config for user-defined projects.
type UserDefinedMonitoring struct {
// mode defines the different configurations of UserDefinedMonitoring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,21 @@ spec:
and forbidden otherwise
rule: 'self.deploymentMode == ''CustomConfig'' ? has(self.customConfig)
: !has(self.customConfig)'
configurationSource:
description: |-
configurationSource is an optional field that selects whether the Cluster Monitoring Operator
reads its configuration from the cluster-monitoring-config ConfigMap or from this ClusterMonitoring CRD.
Valid values are "ConfigMap" and "CRD".
When set to ConfigMap, the operator uses the cluster-monitoring-config ConfigMap in the
openshift-monitoring namespace as the configuration source.
When set to CRD, the operator uses this ClusterMonitoring custom resource as the configuration source.
When omitted, this means no opinion and the platform is left to choose a reasonable default,
which is subject to change over time.
The current default value is CRD.
enum:
- ConfigMap
- CRD
type: string
kubeStateMetricsConfig:
description: |-
kubeStateMetricsConfig is an optional field that can be used to configure the kube-state-metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,21 @@ spec:
and forbidden otherwise
rule: 'self.deploymentMode == ''CustomConfig'' ? has(self.customConfig)
: !has(self.customConfig)'
configurationSource:
description: |-
configurationSource is an optional field that selects whether the Cluster Monitoring Operator
reads its configuration from the cluster-monitoring-config ConfigMap or from this ClusterMonitoring CRD.
Valid values are "ConfigMap" and "CRD".
When set to ConfigMap, the operator uses the cluster-monitoring-config ConfigMap in the
openshift-monitoring namespace as the configuration source.
When set to CRD, the operator uses this ClusterMonitoring custom resource as the configuration source.
When omitted, this means no opinion and the platform is left to choose a reasonable default,
which is subject to change over time.
The current default value is CRD.
enum:
- ConfigMap
- CRD
type: string
kubeStateMetricsConfig:
description: |-
kubeStateMetricsConfig is an optional field that can be used to configure the kube-state-metrics
Expand Down
1 change: 1 addition & 0 deletions config/v1alpha1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -13110,6 +13110,14 @@
"default": {},
"$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.AlertmanagerConfig"
},
"configurationSource": {
"description": "configurationSource is an optional field that selects whether the Cluster Monitoring Operator reads its configuration from the cluster-monitoring-config ConfigMap or from this ClusterMonitoring CRD. Valid values are \"ConfigMap\" and \"CRD\". When set to ConfigMap, the operator uses the cluster-monitoring-config ConfigMap in the openshift-monitoring namespace as the configuration source. When set to CRD, the operator uses this ClusterMonitoring custom resource as the configuration source. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default value is CRD.\n\nPossible enum values:\n - `\"CRD\"` means the operator reads configuration from this ClusterMonitoring custom resource.\n - `\"ConfigMap\"` means the operator reads configuration from the cluster-monitoring-config ConfigMap in the openshift-monitoring namespace.",
"type": "string",
"enum": [
"CRD",
"ConfigMap"
]
},
"kubeStateMetricsConfig": {
"description": "kubeStateMetricsConfig is an optional field that can be used to configure the kube-state-metrics agent that runs in the openshift-monitoring namespace. kube-state-metrics generates metrics about the state of Kubernetes objects such as Deployments, Nodes, and Pods. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.",
"default": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,21 @@ spec:
and forbidden otherwise
rule: 'self.deploymentMode == ''CustomConfig'' ? has(self.customConfig)
: !has(self.customConfig)'
configurationSource:
description: |-
configurationSource is an optional field that selects whether the Cluster Monitoring Operator
reads its configuration from the cluster-monitoring-config ConfigMap or from this ClusterMonitoring CRD.
Valid values are "ConfigMap" and "CRD".
When set to ConfigMap, the operator uses the cluster-monitoring-config ConfigMap in the
openshift-monitoring namespace as the configuration source.
When set to CRD, the operator uses this ClusterMonitoring custom resource as the configuration source.
When omitted, this means no opinion and the platform is left to choose a reasonable default,
which is subject to change over time.
The current default value is CRD.
enum:
- ConfigMap
- CRD
type: string
kubeStateMetricsConfig:
description: |-
kubeStateMetricsConfig is an optional field that can be used to configure the kube-state-metrics
Expand Down