mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-16 01:06:27 +00:00
Add mode
field in PrometheusAgent CRD (#6640)
* Add mode field in PrometheusAgent CRD
This commit is contained in:
parent
77e92ecd4e
commit
fa37a770ef
11 changed files with 97 additions and 5 deletions
28
Documentation/api.md
generated
28
Documentation/api.md
generated
|
@ -16133,6 +16133,20 @@ PrometheusAgentSpec
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
<code>mode</code><br/>
|
||||||
|
<em>
|
||||||
|
string
|
||||||
|
</em>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<em>(Optional)</em>
|
||||||
|
<p>Mode defines how the Prometheus operator deploys the PrometheusAgent pod(s).
|
||||||
|
For now this field has no effect.</p>
|
||||||
|
<p>(Alpha) Using this field requires the <code>PrometheusAgentDaemonSet</code> feature gate to be enabled.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
<code>podMetadata</code><br/>
|
<code>podMetadata</code><br/>
|
||||||
<em>
|
<em>
|
||||||
<a href="#monitoring.coreos.com/v1.EmbeddedObjectMetadata">
|
<a href="#monitoring.coreos.com/v1.EmbeddedObjectMetadata">
|
||||||
|
@ -22476,6 +22490,20 @@ int
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
<code>mode</code><br/>
|
||||||
|
<em>
|
||||||
|
string
|
||||||
|
</em>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<em>(Optional)</em>
|
||||||
|
<p>Mode defines how the Prometheus operator deploys the PrometheusAgent pod(s).
|
||||||
|
For now this field has no effect.</p>
|
||||||
|
<p>(Alpha) Using this field requires the <code>PrometheusAgentDaemonSet</code> feature gate to be enabled.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
<code>podMetadata</code><br/>
|
<code>podMetadata</code><br/>
|
||||||
<em>
|
<em>
|
||||||
<a href="#monitoring.coreos.com/v1.EmbeddedObjectMetadata">
|
<a href="#monitoring.coreos.com/v1.EmbeddedObjectMetadata">
|
||||||
|
|
|
@ -52,7 +52,7 @@ Usage of ./operator:
|
||||||
-enable-config-reloader-probes
|
-enable-config-reloader-probes
|
||||||
Enable liveness and readiness for the config-reloader container. Default: false
|
Enable liveness and readiness for the config-reloader container. Default: false
|
||||||
-feature-gates value
|
-feature-gates value
|
||||||
Feature gates are a set of key=value pairs that describe Prometheus-Operator features. Available features: ["PrometheusAgentDaemonset"].
|
Feature gates are a set of key=value pairs that describe Prometheus-Operator features. Available features: ["PrometheusAgentDaemonSet"].
|
||||||
-key-file string
|
-key-file string
|
||||||
- NOT RECOMMENDED FOR PRODUCTION - Path to private TLS certificate file.
|
- NOT RECOMMENDED FOR PRODUCTION - Path to private TLS certificate file.
|
||||||
-kubelet-node-address-priority value
|
-kubelet-node-address-priority value
|
||||||
|
|
11
bundle.yaml
generated
11
bundle.yaml
generated
|
@ -21568,6 +21568,17 @@ spec:
|
||||||
enabling the StatefulSetMinReadySeconds feature gate.
|
enabling the StatefulSetMinReadySeconds feature gate.
|
||||||
format: int32
|
format: int32
|
||||||
type: integer
|
type: integer
|
||||||
|
mode:
|
||||||
|
description: |-
|
||||||
|
Mode defines how the Prometheus operator deploys the PrometheusAgent pod(s).
|
||||||
|
For now this field has no effect.
|
||||||
|
|
||||||
|
|
||||||
|
(Alpha) Using this field requires the `PrometheusAgentDaemonSet` feature gate to be enabled.
|
||||||
|
enum:
|
||||||
|
- StatefulSet
|
||||||
|
- DaemonSet
|
||||||
|
type: string
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
@ -4644,6 +4644,17 @@ spec:
|
||||||
enabling the StatefulSetMinReadySeconds feature gate.
|
enabling the StatefulSetMinReadySeconds feature gate.
|
||||||
format: int32
|
format: int32
|
||||||
type: integer
|
type: integer
|
||||||
|
mode:
|
||||||
|
description: |-
|
||||||
|
Mode defines how the Prometheus operator deploys the PrometheusAgent pod(s).
|
||||||
|
For now this field has no effect.
|
||||||
|
|
||||||
|
|
||||||
|
(Alpha) Using this field requires the `PrometheusAgentDaemonSet` feature gate to be enabled.
|
||||||
|
enum:
|
||||||
|
- StatefulSet
|
||||||
|
- DaemonSet
|
||||||
|
type: string
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
@ -4645,6 +4645,17 @@ spec:
|
||||||
enabling the StatefulSetMinReadySeconds feature gate.
|
enabling the StatefulSetMinReadySeconds feature gate.
|
||||||
format: int32
|
format: int32
|
||||||
type: integer
|
type: integer
|
||||||
|
mode:
|
||||||
|
description: |-
|
||||||
|
Mode defines how the Prometheus operator deploys the PrometheusAgent pod(s).
|
||||||
|
For now this field has no effect.
|
||||||
|
|
||||||
|
|
||||||
|
(Alpha) Using this field requires the `PrometheusAgentDaemonSet` feature gate to be enabled.
|
||||||
|
enum:
|
||||||
|
- StatefulSet
|
||||||
|
- DaemonSet
|
||||||
|
type: string
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
@ -3917,6 +3917,14 @@
|
||||||
"format": "int32",
|
"format": "int32",
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"mode": {
|
||||||
|
"description": "Mode defines how the Prometheus operator deploys the PrometheusAgent pod(s).\nFor now this field has no effect.\n\n\n(Alpha) Using this field requires the `PrometheusAgentDaemonSet` feature gate to be enabled.",
|
||||||
|
"enum": [
|
||||||
|
"StatefulSet",
|
||||||
|
"DaemonSet"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"nodeSelector": {
|
"nodeSelector": {
|
||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|
|
@ -91,5 +91,14 @@ func (l *PrometheusAgentList) DeepCopyObject() runtime.Object {
|
||||||
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
// +k8s:openapi-gen=true
|
// +k8s:openapi-gen=true
|
||||||
type PrometheusAgentSpec struct {
|
type PrometheusAgentSpec struct {
|
||||||
|
// Mode defines how the Prometheus operator deploys the PrometheusAgent pod(s).
|
||||||
|
// For now this field has no effect.
|
||||||
|
//
|
||||||
|
// (Alpha) Using this field requires the `PrometheusAgentDaemonSet` feature gate to be enabled.
|
||||||
|
//
|
||||||
|
// +kubebuilder:validation:Enum=StatefulSet;DaemonSet
|
||||||
|
// +optional
|
||||||
|
Mode *string `json:"mode,omitempty"`
|
||||||
|
|
||||||
monitoringv1.CommonPrometheusFields `json:",inline"`
|
monitoringv1.CommonPrometheusFields `json:",inline"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1548,6 +1548,11 @@ func (in *PrometheusAgentList) DeepCopy() *PrometheusAgentList {
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *PrometheusAgentSpec) DeepCopyInto(out *PrometheusAgentSpec) {
|
func (in *PrometheusAgentSpec) DeepCopyInto(out *PrometheusAgentSpec) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
if in.Mode != nil {
|
||||||
|
in, out := &in.Mode, &out.Mode
|
||||||
|
*out = new(string)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
in.CommonPrometheusFields.DeepCopyInto(&out.CommonPrometheusFields)
|
in.CommonPrometheusFields.DeepCopyInto(&out.CommonPrometheusFields)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import (
|
||||||
// PrometheusAgentSpecApplyConfiguration represents an declarative configuration of the PrometheusAgentSpec type for use
|
// PrometheusAgentSpecApplyConfiguration represents an declarative configuration of the PrometheusAgentSpec type for use
|
||||||
// with apply.
|
// with apply.
|
||||||
type PrometheusAgentSpecApplyConfiguration struct {
|
type PrometheusAgentSpecApplyConfiguration struct {
|
||||||
|
Mode *string `json:"mode,omitempty"`
|
||||||
v1.CommonPrometheusFieldsApplyConfiguration `json:",inline"`
|
v1.CommonPrometheusFieldsApplyConfiguration `json:",inline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +37,14 @@ func PrometheusAgentSpec() *PrometheusAgentSpecApplyConfiguration {
|
||||||
return &PrometheusAgentSpecApplyConfiguration{}
|
return &PrometheusAgentSpecApplyConfiguration{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithMode sets the Mode field in the declarative configuration to the given value
|
||||||
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
|
// If called multiple times, the Mode field is set to the value of the last call.
|
||||||
|
func (b *PrometheusAgentSpecApplyConfiguration) WithMode(value string) *PrometheusAgentSpecApplyConfiguration {
|
||||||
|
b.Mode = &value
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
// WithPodMetadata sets the PodMetadata field in the declarative configuration to the given value
|
// WithPodMetadata sets the PodMetadata field in the declarative configuration to the given value
|
||||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||||
// If called multiple times, the PodMetadata field is set to the value of the last call.
|
// If called multiple times, the PodMetadata field is set to the value of the last call.
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
|
|
||||||
// At the moment, the are no feature gates available.
|
// At the moment, the are no feature gates available.
|
||||||
var defaultFeatureGates = map[string]bool{
|
var defaultFeatureGates = map[string]bool{
|
||||||
"PrometheusAgentDaemonset": false,
|
"PrometheusAgentDaemonSet": false,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateFeatureGates merges the feature gate default values with
|
// ValidateFeatureGates merges the feature gate default values with
|
||||||
|
|
|
@ -31,7 +31,7 @@ func TestDefaultFeatureGates(t *testing.T) {
|
||||||
func TestMapToString(t *testing.T) {
|
func TestMapToString(t *testing.T) {
|
||||||
m := mapToString(defaultFeatureGates)
|
m := mapToString(defaultFeatureGates)
|
||||||
|
|
||||||
require.True(t, strings.Contains(m, "PrometheusAgentDaemonset=false"))
|
require.True(t, strings.Contains(m, "PrometheusAgentDaemonSet=false"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateFeatureGatesWithNotSupportFeature(t *testing.T) {
|
func TestValidateFeatureGatesWithNotSupportFeature(t *testing.T) {
|
||||||
|
@ -39,7 +39,7 @@ func TestValidateFeatureGatesWithNotSupportFeature(t *testing.T) {
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
require.Equal(t, "", m)
|
require.Equal(t, "", m)
|
||||||
|
|
||||||
m, err = ValidateFeatureGates(k8sflag.NewMapStringBool(&map[string]bool{"PrometheusAgentDaemonset": true}))
|
m, err = ValidateFeatureGates(k8sflag.NewMapStringBool(&map[string]bool{"PrometheusAgentDaemonSet": true}))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.True(t, strings.Contains(m, "PrometheusAgentDaemonset=true"))
|
require.True(t, strings.Contains(m, "PrometheusAgentDaemonSet=true"))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue