From 703bd6143a7adc0d9e25ebb9f34bf02634e9d91f Mon Sep 17 00:00:00 2001 From: mercybassey Date: Thu, 3 Oct 2024 20:09:23 +0100 Subject: [PATCH 1/3] Added few validation rules --- apis/v1beta1/opentelemetrycollector_types.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apis/v1beta1/opentelemetrycollector_types.go b/apis/v1beta1/opentelemetrycollector_types.go index dd20af943d..8d1ed7dd0b 100644 --- a/apis/v1beta1/opentelemetrycollector_types.go +++ b/apis/v1beta1/opentelemetrycollector_types.go @@ -90,10 +90,10 @@ type OpenTelemetryCollectorSpec struct { // +optional TargetAllocator TargetAllocatorEmbedded `json:"targetAllocator,omitempty"` // Mode represents how the collector should be deployed (deployment, daemonset, statefulset or sidecar) - // +optional + // +kubebuilder:validation:Enum=ModeDeployment;ModeDaemonSet;ModeStatefulSet;ModeSidecar Mode Mode `json:"mode,omitempty"` // UpgradeStrategy represents how the operator will handle upgrades to the CR when a newer version of the operator is deployed - // +optional + // +kubebuilder:validation:Enum=UpgradeStrategyAutomatic UpgradeStrategy UpgradeStrategy `json:"upgradeStrategy"` // Config is the raw JSON to be used as the collector's configuration. Refer to the OpenTelemetry Collector documentation for details. // The empty objects e.g. batch: should be written as batch: {} otherwise they won't work with kustomize or kubectl edit. @@ -110,14 +110,17 @@ type OpenTelemetryCollectorSpec struct { // functionality is only available if one of the valid modes is set. // Valid modes are: deployment, daemonset and statefulset. // +optional + // +kubebuilder:validation:Enum=ModeDeployment;ModeDaemonSet;ModeStatefulSet; Ingress Ingress `json:"ingress,omitempty"` // Liveness config for the OpenTelemetry Collector except the probe handler which is auto generated from the health extension of the collector. // It is only effective when healthcheckextension is configured in the OpenTelemetry Collector pipeline. // +optional + // +kubebuilder:validation:Required LivenessProbe *Probe `json:"livenessProbe,omitempty"` // Readiness config for the OpenTelemetry Collector except the probe handler which is auto generated from the health extension of the collector. // It is only effective when healthcheckextension is configured in the OpenTelemetry Collector pipeline. // +optional + // +kubebuilder:validation:Required ReadinessProbe *Probe `json:"readinessProbe,omitempty"` // ObservabilitySpec defines how telemetry data gets handled. @@ -135,11 +138,13 @@ type OpenTelemetryCollectorSpec struct { // https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec // This is only applicable to Daemonset mode. // +optional + // +kubebuilder:validation:Enum=ModeDaemonset DaemonSetUpdateStrategy appsv1.DaemonSetUpdateStrategy `json:"daemonSetUpdateStrategy,omitempty"` // UpdateStrategy represents the strategy the operator will take replacing existing Deployment pods with new pods // https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/deployment-v1/#DeploymentSpec // This is only applicable to Deployment mode. // +optional + // +kubebuilder:validation:Enum=ModeDeployment DeploymentUpdateStrategy appsv1.DeploymentStrategy `json:"deploymentUpdateStrategy,omitempty"` } From e324a7fcfa566b745c0fae590d32015f49d7c4bb Mon Sep 17 00:00:00 2001 From: mercybassey Date: Sun, 6 Oct 2024 14:42:58 +0100 Subject: [PATCH 2/3] Added more validation rules --- apis/v1beta1/opentelemetrycollector_types.go | 33 ++++++-- ...emetry-operator.clusterserviceversion.yaml | 4 +- ...ntelemetry.io_opentelemetrycollectors.yaml | 80 +++++++++++++++---- ...emetry-operator.clusterserviceversion.yaml | 4 +- ...ntelemetry.io_opentelemetrycollectors.yaml | 80 +++++++++++++++---- ...ntelemetry.io_opentelemetrycollectors.yaml | 80 +++++++++++++++---- config/manager/kustomization.yaml | 6 ++ docs/api.md | 61 ++++++++++---- 8 files changed, 275 insertions(+), 73 deletions(-) diff --git a/apis/v1beta1/opentelemetrycollector_types.go b/apis/v1beta1/opentelemetrycollector_types.go index 8d1ed7dd0b..33188c132f 100644 --- a/apis/v1beta1/opentelemetrycollector_types.go +++ b/apis/v1beta1/opentelemetrycollector_types.go @@ -90,14 +90,17 @@ type OpenTelemetryCollectorSpec struct { // +optional TargetAllocator TargetAllocatorEmbedded `json:"targetAllocator,omitempty"` // Mode represents how the collector should be deployed (deployment, daemonset, statefulset or sidecar) - // +kubebuilder:validation:Enum=ModeDeployment;ModeDaemonSet;ModeStatefulSet;ModeSidecar + // +kubebuilder:default=deployment + // +kubebuilder:validation:Enum=deployment;daemonset;statefulset;sidecar Mode Mode `json:"mode,omitempty"` // UpgradeStrategy represents how the operator will handle upgrades to the CR when a newer version of the operator is deployed - // +kubebuilder:validation:Enum=UpgradeStrategyAutomatic + // +kubebuilder:default=automatic + // +kubebuilder:validation:Enum=automatic;manual UpgradeStrategy UpgradeStrategy `json:"upgradeStrategy"` // Config is the raw JSON to be used as the collector's configuration. Refer to the OpenTelemetry Collector documentation for details. // The empty objects e.g. batch: should be written as batch: {} otherwise they won't work with kustomize or kubectl edit. // +required + // +kubebuilder:validation:required // +kubebuilder:pruning:PreserveUnknownFields Config Config `json:"config"` // ConfigVersions defines the number versions to keep for the collector config. Each config version is stored in a separate ConfigMap. @@ -110,17 +113,15 @@ type OpenTelemetryCollectorSpec struct { // functionality is only available if one of the valid modes is set. // Valid modes are: deployment, daemonset and statefulset. // +optional - // +kubebuilder:validation:Enum=ModeDeployment;ModeDaemonSet;ModeStatefulSet; + // +kubebuilder:validation:Enum=deployment;daemonSet;statefulSet; Ingress Ingress `json:"ingress,omitempty"` // Liveness config for the OpenTelemetry Collector except the probe handler which is auto generated from the health extension of the collector. // It is only effective when healthcheckextension is configured in the OpenTelemetry Collector pipeline. // +optional - // +kubebuilder:validation:Required LivenessProbe *Probe `json:"livenessProbe,omitempty"` // Readiness config for the OpenTelemetry Collector except the probe handler which is auto generated from the health extension of the collector. // It is only effective when healthcheckextension is configured in the OpenTelemetry Collector pipeline. // +optional - // +kubebuilder:validation:Required ReadinessProbe *Probe `json:"readinessProbe,omitempty"` // ObservabilitySpec defines how telemetry data gets handled. @@ -138,13 +139,13 @@ type OpenTelemetryCollectorSpec struct { // https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec // This is only applicable to Daemonset mode. // +optional - // +kubebuilder:validation:Enum=ModeDaemonset + // +kubebuilder:validation:Enum=daemonset DaemonSetUpdateStrategy appsv1.DaemonSetUpdateStrategy `json:"daemonSetUpdateStrategy,omitempty"` // UpdateStrategy represents the strategy the operator will take replacing existing Deployment pods with new pods // https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/deployment-v1/#DeploymentSpec // This is only applicable to Deployment mode. // +optional - // +kubebuilder:validation:Enum=ModeDeployment + // +kubebuilder:validation:Enum=deployment DeploymentUpdateStrategy appsv1.DeploymentStrategy `json:"deploymentUpdateStrategy,omitempty"` } @@ -155,6 +156,7 @@ type TargetAllocatorEmbedded struct { // other than 1 if a strategy that allows for high availability is chosen. Currently, the only allocation strategy // that can be run in a high availability mode is consistent-hashing. // +optional + // +kubebuilder:validation:Minimum=1 Replicas *int32 `json:"replicas,omitempty"` // NodeSelector to schedule OpenTelemetry TargetAllocator pods. // +optional @@ -168,12 +170,14 @@ type TargetAllocatorEmbedded struct { // WARNING: The per-node strategy currently ignores targets without a Node, like control plane components. // +optional // +kubebuilder:default:=consistent-hashing + // +kubebuilder:validation:Enum=consistent-hashing;least-weighted;per-node AllocationStrategy TargetAllocatorAllocationStrategy `json:"allocationStrategy,omitempty"` // FilterStrategy determines how to filter targets before allocating them among the collectors. // The only current option is relabel-config (drops targets based on prom relabel_config). // The default is relabel-config. // +optional // +kubebuilder:default:=relabel-config + // +kubebuilder:validation:Enum=relabel-config FilterStrategy TargetAllocatorFilterStrategy `json:"filterStrategy,omitempty"` // ServiceAccount indicates the name of an existing service account to use with this instance. When set, // the operator will not automatically create a ServiceAccount for the TargetAllocator. @@ -234,23 +238,33 @@ type Probe struct { // Defaults to 0 seconds. Minimum value is 0. // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes // +optional + // +kubebuilder:default=0 + // +kubebuilder:validation:Minimum=0 InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"` // Number of seconds after which the probe times out. // Defaults to 1 second. Minimum value is 1. // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes // +optional + // // +kubebuilder:default=1 + // +kubebuilder:validation:Minimum=1 TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` // How often (in seconds) to perform the probe. // Default to 10 seconds. Minimum value is 1. // +optional + // +kubebuilder:default=10 + // +kubebuilder:validation:Minimum=1 PeriodSeconds *int32 `json:"periodSeconds,omitempty"` // Minimum consecutive successes for the probe to be considered successful after having failed. // Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. // +optional + // +kubebuilder:default=1 + // +kubebuilder:validation:Minimum=1 SuccessThreshold *int32 `json:"successThreshold,omitempty"` // Minimum consecutive failures for the probe to be considered failed after having succeeded. // Defaults to 3. Minimum value is 1. // +optional + // +kubebuilder:default=3 + // +kubebuilder:validation:Minimum=1 FailureThreshold *int32 `json:"failureThreshold,omitempty"` // Optional duration in seconds the pod needs to terminate gracefully upon probe failure. // The grace period is the duration in seconds after the processes running in the pod are sent @@ -263,6 +277,7 @@ type Probe struct { // This is a beta field and requires enabling ProbeTerminationGracePeriod feature gate. // Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset. // +optional + // +kubebuilder:validation:Minimum=1 TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` } @@ -299,11 +314,13 @@ type ScaleSubresourceStatus struct { // The selector used to match the OpenTelemetryCollector's // deployment or statefulSet pods. // +optional + // +kubebuilder:validation:Enum=deployment;statefulset Selector string `json:"selector,omitempty"` // The total number non-terminated pods targeted by this // OpenTelemetryCollector's deployment or statefulSet. // +optional + // +kubebuilder:validation:Minimum=0 Replicas int32 `json:"replicas,omitempty"` // StatusReplicas is the number of pods targeted by this OpenTelemetryCollector's with a Ready Condition / @@ -315,6 +332,8 @@ type ScaleSubresourceStatus struct { type ConfigMapsSpec struct { // Configmap defines name and path where the configMaps should be mounted. + // +kubebuilder:validation:Required + // +kubebuilder:validation:MinLength=3 Name string `json:"name"` MountPath string `json:"mountpath"` } diff --git a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml index 3b1454f8d6..1f071359ce 100644 --- a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -99,7 +99,7 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-09-19T17:15:52Z" + createdAt: "2024-10-06T07:35:12Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 @@ -479,7 +479,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.serviceAccountName - image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.109.0 + image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.109.0-14-g703bd614 livenessProbe: httpGet: path: /healthz diff --git a/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml b/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml index 594e0f4aea..ea9af5a153 100644 --- a/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml +++ b/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml @@ -5930,6 +5930,8 @@ spec: type: object type: array daemonSetUpdateStrategy: + enum: + - daemonset properties: rollingUpdate: properties: @@ -5948,6 +5950,8 @@ spec: type: string type: object deploymentUpdateStrategy: + enum: + - deployment properties: rollingUpdate: properties: @@ -6063,6 +6067,10 @@ spec: imagePullPolicy: type: string ingress: + enum: + - deployment + - daemonSet + - statefulSet properties: annotations: additionalProperties: @@ -6918,22 +6926,32 @@ spec: livenessProbe: properties: failureThreshold: + default: 3 format: int32 + minimum: 1 type: integer initialDelaySeconds: + default: 0 format: int32 + minimum: 0 type: integer periodSeconds: + default: 10 format: int32 + minimum: 1 type: integer successThreshold: + default: 1 format: int32 + minimum: 1 type: integer terminationGracePeriodSeconds: format: int64 + minimum: 1 type: integer timeoutSeconds: format: int32 + minimum: 1 type: integer type: object managementState: @@ -6943,11 +6961,18 @@ spec: - unmanaged type: string mode: - enum: - - daemonset - - deployment - - sidecar - - statefulset + allOf: + - enum: + - daemonset + - deployment + - sidecar + - statefulset + - enum: + - deployment + - daemonset + - statefulset + - sidecar + default: deployment type: string nodeSelector: additionalProperties: @@ -7114,22 +7139,32 @@ spec: readinessProbe: properties: failureThreshold: + default: 3 format: int32 + minimum: 1 type: integer initialDelaySeconds: + default: 0 format: int32 + minimum: 0 type: integer periodSeconds: + default: 10 format: int32 + minimum: 1 type: integer successThreshold: + default: 1 format: int32 + minimum: 1 type: integer terminationGracePeriodSeconds: format: int64 + minimum: 1 type: integer timeoutSeconds: format: int32 + minimum: 1 type: integer type: object replicas: @@ -7686,11 +7721,16 @@ spec: type: object type: object allocationStrategy: + allOf: + - enum: + - least-weighted + - consistent-hashing + - per-node + - enum: + - consistent-hashing + - least-weighted + - per-node default: consistent-hashing - enum: - - least-weighted - - consistent-hashing - - per-node type: string enabled: type: boolean @@ -7761,10 +7801,13 @@ spec: type: object type: array filterStrategy: + allOf: + - enum: + - "" + - relabel-config + - enum: + - relabel-config default: relabel-config - enum: - - "" - - relabel-config type: string image: type: string @@ -7935,6 +7978,7 @@ spec: type: object replicas: format: int32 + minimum: 1 type: integer resources: properties: @@ -8188,9 +8232,14 @@ spec: type: object type: array upgradeStrategy: - enum: - - automatic - - none + allOf: + - enum: + - automatic + - none + - enum: + - automatic + - manual + default: automatic type: string volumeClaimTemplates: items: @@ -9201,6 +9250,7 @@ spec: required: - config - managementState + - upgradeStrategy type: object status: properties: diff --git a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml index 70db688513..6c578cb764 100644 --- a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -99,7 +99,7 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-09-19T17:16:12Z" + createdAt: "2024-10-06T07:35:23Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 @@ -483,7 +483,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.serviceAccountName - image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.109.0 + image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.109.0-14-g703bd614 livenessProbe: httpGet: path: /healthz diff --git a/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml b/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml index 594e0f4aea..ea9af5a153 100644 --- a/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml +++ b/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml @@ -5930,6 +5930,8 @@ spec: type: object type: array daemonSetUpdateStrategy: + enum: + - daemonset properties: rollingUpdate: properties: @@ -5948,6 +5950,8 @@ spec: type: string type: object deploymentUpdateStrategy: + enum: + - deployment properties: rollingUpdate: properties: @@ -6063,6 +6067,10 @@ spec: imagePullPolicy: type: string ingress: + enum: + - deployment + - daemonSet + - statefulSet properties: annotations: additionalProperties: @@ -6918,22 +6926,32 @@ spec: livenessProbe: properties: failureThreshold: + default: 3 format: int32 + minimum: 1 type: integer initialDelaySeconds: + default: 0 format: int32 + minimum: 0 type: integer periodSeconds: + default: 10 format: int32 + minimum: 1 type: integer successThreshold: + default: 1 format: int32 + minimum: 1 type: integer terminationGracePeriodSeconds: format: int64 + minimum: 1 type: integer timeoutSeconds: format: int32 + minimum: 1 type: integer type: object managementState: @@ -6943,11 +6961,18 @@ spec: - unmanaged type: string mode: - enum: - - daemonset - - deployment - - sidecar - - statefulset + allOf: + - enum: + - daemonset + - deployment + - sidecar + - statefulset + - enum: + - deployment + - daemonset + - statefulset + - sidecar + default: deployment type: string nodeSelector: additionalProperties: @@ -7114,22 +7139,32 @@ spec: readinessProbe: properties: failureThreshold: + default: 3 format: int32 + minimum: 1 type: integer initialDelaySeconds: + default: 0 format: int32 + minimum: 0 type: integer periodSeconds: + default: 10 format: int32 + minimum: 1 type: integer successThreshold: + default: 1 format: int32 + minimum: 1 type: integer terminationGracePeriodSeconds: format: int64 + minimum: 1 type: integer timeoutSeconds: format: int32 + minimum: 1 type: integer type: object replicas: @@ -7686,11 +7721,16 @@ spec: type: object type: object allocationStrategy: + allOf: + - enum: + - least-weighted + - consistent-hashing + - per-node + - enum: + - consistent-hashing + - least-weighted + - per-node default: consistent-hashing - enum: - - least-weighted - - consistent-hashing - - per-node type: string enabled: type: boolean @@ -7761,10 +7801,13 @@ spec: type: object type: array filterStrategy: + allOf: + - enum: + - "" + - relabel-config + - enum: + - relabel-config default: relabel-config - enum: - - "" - - relabel-config type: string image: type: string @@ -7935,6 +7978,7 @@ spec: type: object replicas: format: int32 + minimum: 1 type: integer resources: properties: @@ -8188,9 +8232,14 @@ spec: type: object type: array upgradeStrategy: - enum: - - automatic - - none + allOf: + - enum: + - automatic + - none + - enum: + - automatic + - manual + default: automatic type: string volumeClaimTemplates: items: @@ -9201,6 +9250,7 @@ spec: required: - config - managementState + - upgradeStrategy type: object status: properties: diff --git a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml index 05baaaa5df..cc0996eccf 100644 --- a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml +++ b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml @@ -5916,6 +5916,8 @@ spec: type: object type: array daemonSetUpdateStrategy: + enum: + - daemonset properties: rollingUpdate: properties: @@ -5934,6 +5936,8 @@ spec: type: string type: object deploymentUpdateStrategy: + enum: + - deployment properties: rollingUpdate: properties: @@ -6049,6 +6053,10 @@ spec: imagePullPolicy: type: string ingress: + enum: + - deployment + - daemonSet + - statefulSet properties: annotations: additionalProperties: @@ -6904,22 +6912,32 @@ spec: livenessProbe: properties: failureThreshold: + default: 3 format: int32 + minimum: 1 type: integer initialDelaySeconds: + default: 0 format: int32 + minimum: 0 type: integer periodSeconds: + default: 10 format: int32 + minimum: 1 type: integer successThreshold: + default: 1 format: int32 + minimum: 1 type: integer terminationGracePeriodSeconds: format: int64 + minimum: 1 type: integer timeoutSeconds: format: int32 + minimum: 1 type: integer type: object managementState: @@ -6929,11 +6947,18 @@ spec: - unmanaged type: string mode: - enum: - - daemonset - - deployment - - sidecar - - statefulset + allOf: + - enum: + - daemonset + - deployment + - sidecar + - statefulset + - enum: + - deployment + - daemonset + - statefulset + - sidecar + default: deployment type: string nodeSelector: additionalProperties: @@ -7100,22 +7125,32 @@ spec: readinessProbe: properties: failureThreshold: + default: 3 format: int32 + minimum: 1 type: integer initialDelaySeconds: + default: 0 format: int32 + minimum: 0 type: integer periodSeconds: + default: 10 format: int32 + minimum: 1 type: integer successThreshold: + default: 1 format: int32 + minimum: 1 type: integer terminationGracePeriodSeconds: format: int64 + minimum: 1 type: integer timeoutSeconds: format: int32 + minimum: 1 type: integer type: object replicas: @@ -7672,11 +7707,16 @@ spec: type: object type: object allocationStrategy: + allOf: + - enum: + - least-weighted + - consistent-hashing + - per-node + - enum: + - consistent-hashing + - least-weighted + - per-node default: consistent-hashing - enum: - - least-weighted - - consistent-hashing - - per-node type: string enabled: type: boolean @@ -7747,10 +7787,13 @@ spec: type: object type: array filterStrategy: + allOf: + - enum: + - "" + - relabel-config + - enum: + - relabel-config default: relabel-config - enum: - - "" - - relabel-config type: string image: type: string @@ -7921,6 +7964,7 @@ spec: type: object replicas: format: int32 + minimum: 1 type: integer resources: properties: @@ -8174,9 +8218,14 @@ spec: type: object type: array upgradeStrategy: - enum: - - automatic - - none + allOf: + - enum: + - automatic + - none + - enum: + - automatic + - manual + default: automatic type: string volumeClaimTemplates: items: @@ -9187,6 +9236,7 @@ spec: required: - config - managementState + - upgradeStrategy type: object status: properties: diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 5c5f0b84cb..f75de513a1 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -1,2 +1,8 @@ resources: - manager.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +images: +- name: controller + newName: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator + newTag: 0.109.0-14-g703bd614 diff --git a/docs/api.md b/docs/api.md index 24d16da3f4..9c0c64bb4f 100644 --- a/docs/api.md +++ b/docs/api.md @@ -30916,6 +30916,15 @@ Default is managed.
Default: managed
true + + upgradeStrategy + string + + UpgradeStrategy represents how the operator will handle upgrades to the CR when a newer version of the operator is deployed
+
+ Default: automatic
+ + true additionalContainers []object @@ -30981,6 +30990,8 @@ Each ConfigMap will be added to the Collector's Deployments as a volume named `c UpdateStrategy represents the strategy the operator will take replacing existing DaemonSet pods with new pods https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec This is only applicable to Daemonset mode.
+
+ Enum: daemonset
false @@ -30990,6 +31001,8 @@ This is only applicable to Daemonset mode.
UpdateStrategy represents the strategy the operator will take replacing existing Deployment pods with new pods https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/deployment-v1/#DeploymentSpec This is only applicable to Deployment mode.
+
+ Enum: deployment
false @@ -31034,6 +31047,8 @@ This is only applicable to Deployment mode.
Ingress is used to specify how OpenTelemetry Collector is exposed. This functionality is only available if one of the valid modes is set. Valid modes are: deployment, daemonset and statefulset.
+
+ Enum: deployment, daemonSet, statefulSet
false @@ -31081,11 +31096,11 @@ It is only effective when healthcheckextension is configured in the OpenTelemetr false mode - enum + string Mode represents how the collector should be deployed (deployment, daemonset, statefulset or sidecar)

- Enum: daemonset, deployment, sidecar, statefulset
+ Default: deployment
false @@ -31244,15 +31259,6 @@ https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constrain This only works with the following OpenTelemetryCollector mode's: statefulset, and deployment.
false - - upgradeStrategy - enum - - UpgradeStrategy represents how the operator will handle upgrades to the CR when a newer version of the operator is deployed
-
- Enum: automatic, none
- - false volumeClaimTemplates []object @@ -40734,6 +40740,8 @@ It is only effective when healthcheckextension is configured in the OpenTelemetr Defaults to 3. Minimum value is 1.

Format: int32
+ Default: 3
+ Minimum: 1
false @@ -40745,6 +40753,8 @@ Defaults to 0 seconds. Minimum value is 0. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes

Format: int32
+ Default: 0
+ Minimum: 0
false @@ -40755,6 +40765,8 @@ More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#cont Default to 10 seconds. Minimum value is 1.

Format: int32
+ Default: 10
+ Minimum: 1
false @@ -40765,6 +40777,8 @@ Default to 10 seconds. Minimum value is 1.
Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.

Format: int32
+ Default: 1
+ Minimum: 1
false @@ -40783,6 +40797,7 @@ This is a beta field and requires enabling ProbeTerminationGracePeriod feature g Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.

Format: int64
+ Minimum: 1
false @@ -40791,9 +40806,11 @@ Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.
Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. -More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
+More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes +// +kubebuilder:default=1

Format: int32
+ Minimum: 1
false @@ -41521,6 +41538,8 @@ It is only effective when healthcheckextension is configured in the OpenTelemetr Defaults to 3. Minimum value is 1.

Format: int32
+ Default: 3
+ Minimum: 1
false @@ -41532,6 +41551,8 @@ Defaults to 0 seconds. Minimum value is 0. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes

Format: int32
+ Default: 0
+ Minimum: 0
false @@ -41542,6 +41563,8 @@ More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#cont Default to 10 seconds. Minimum value is 1.

Format: int32
+ Default: 10
+ Minimum: 1
false @@ -41552,6 +41575,8 @@ Default to 10 seconds. Minimum value is 1.
Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1.

Format: int32
+ Default: 1
+ Minimum: 1
false @@ -41570,6 +41595,7 @@ This is a beta field and requires enabling ProbeTerminationGracePeriod feature g Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.

Format: int64
+ Minimum: 1
false @@ -41578,9 +41604,11 @@ Minimum value is 1. spec.terminationGracePeriodSeconds is used if unset.
Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. -More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
+More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes +// +kubebuilder:default=1

Format: int32
+ Minimum: 1
false @@ -42094,14 +42122,13 @@ TargetAllocator indicates a value which determines whether to spawn a target all false allocationStrategy - enum + string AllocationStrategy determines which strategy the target allocator should use for allocation. The current options are least-weighted, consistent-hashing and per-node. The default is consistent-hashing. WARNING: The per-node strategy currently ignores targets without a Node, like control plane components.

- Enum: least-weighted, consistent-hashing, per-node
Default: consistent-hashing
false @@ -42122,13 +42149,12 @@ consumed in the config file for the TargetAllocator.
false filterStrategy - enum + string FilterStrategy determines how to filter targets before allocating them among the collectors. The only current option is relabel-config (drops targets based on prom relabel_config). The default is relabel-config.

- Enum: , relabel-config
Default: relabel-config
false @@ -42187,6 +42213,7 @@ other than 1 if a strategy that allows for high availability is chosen. Currentl that can be run in a high availability mode is consistent-hashing.

Format: int32
+ Minimum: 1
false From b484a01ccf278d17d061992974c345caa474e409 Mon Sep 17 00:00:00 2001 From: mercybassey Date: Mon, 7 Oct 2024 12:08:37 +0100 Subject: [PATCH 3/3] removed extra --- apis/v1beta1/opentelemetrycollector_types.go | 2 +- .../opentelemetry-operator.clusterserviceversion.yaml | 4 ++-- .../manifests/opentelemetry.io_opentelemetrycollectors.yaml | 5 +++++ .../opentelemetry-operator.clusterserviceversion.yaml | 4 ++-- .../manifests/opentelemetry.io_opentelemetrycollectors.yaml | 5 +++++ .../crd/bases/opentelemetry.io_opentelemetrycollectors.yaml | 5 +++++ config/manager/kustomization.yaml | 2 +- docs/api.md | 5 ++++- 8 files changed, 25 insertions(+), 7 deletions(-) diff --git a/apis/v1beta1/opentelemetrycollector_types.go b/apis/v1beta1/opentelemetrycollector_types.go index 33188c132f..fb6940c992 100644 --- a/apis/v1beta1/opentelemetrycollector_types.go +++ b/apis/v1beta1/opentelemetrycollector_types.go @@ -113,7 +113,7 @@ type OpenTelemetryCollectorSpec struct { // functionality is only available if one of the valid modes is set. // Valid modes are: deployment, daemonset and statefulset. // +optional - // +kubebuilder:validation:Enum=deployment;daemonSet;statefulSet; + // +kubebuilder:validation:Enum=deployment;daemonSet;statefulSet Ingress Ingress `json:"ingress,omitempty"` // Liveness config for the OpenTelemetry Collector except the probe handler which is auto generated from the health extension of the collector. // It is only effective when healthcheckextension is configured in the OpenTelemetry Collector pipeline. diff --git a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml index 1f071359ce..d17474cbce 100644 --- a/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/community/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -99,7 +99,7 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-10-06T07:35:12Z" + createdAt: "2024-10-06T13:43:33Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 @@ -479,7 +479,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.serviceAccountName - image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.109.0-14-g703bd614 + image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.109.0-15-ge324a7fc livenessProbe: httpGet: path: /healthz diff --git a/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml b/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml index ea9af5a153..b41bd4e8d6 100644 --- a/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml +++ b/bundle/community/manifests/opentelemetry.io_opentelemetrycollectors.yaml @@ -5923,6 +5923,7 @@ spec: mountpath: type: string name: + minLength: 3 type: string required: - mountpath @@ -9260,8 +9261,12 @@ spec: properties: replicas: format: int32 + minimum: 0 type: integer selector: + enum: + - deployment + - statefulset type: string statusReplicas: type: string diff --git a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml index 6c578cb764..7825eb03a9 100644 --- a/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/openshift/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -99,7 +99,7 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-10-06T07:35:23Z" + createdAt: "2024-10-06T13:43:46Z" description: Provides the OpenTelemetry components, including the Collector operators.operatorframework.io/builder: operator-sdk-v1.29.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 @@ -483,7 +483,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.serviceAccountName - image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.109.0-14-g703bd614 + image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.109.0-15-ge324a7fc livenessProbe: httpGet: path: /healthz diff --git a/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml b/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml index ea9af5a153..b41bd4e8d6 100644 --- a/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml +++ b/bundle/openshift/manifests/opentelemetry.io_opentelemetrycollectors.yaml @@ -5923,6 +5923,7 @@ spec: mountpath: type: string name: + minLength: 3 type: string required: - mountpath @@ -9260,8 +9261,12 @@ spec: properties: replicas: format: int32 + minimum: 0 type: integer selector: + enum: + - deployment + - statefulset type: string statusReplicas: type: string diff --git a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml index cc0996eccf..f66002c5ca 100644 --- a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml +++ b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml @@ -5909,6 +5909,7 @@ spec: mountpath: type: string name: + minLength: 3 type: string required: - mountpath @@ -9246,8 +9247,12 @@ spec: properties: replicas: format: int32 + minimum: 0 type: integer selector: + enum: + - deployment + - statefulset type: string statusReplicas: type: string diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index f75de513a1..ea8457a1de 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -5,4 +5,4 @@ kind: Kustomization images: - name: controller newName: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - newTag: 0.109.0-14-g703bd614 + newTag: 0.109.0-15-ge324a7fc diff --git a/docs/api.md b/docs/api.md index 9c0c64bb4f..6fb975d742 100644 --- a/docs/api.md +++ b/docs/api.md @@ -50578,14 +50578,17 @@ Scale is the OpenTelemetryCollector's scale subresource status. OpenTelemetryCollector's deployment or statefulSet.

Format: int32
+ Minimum: 0
false selector - string + enum The selector used to match the OpenTelemetryCollector's deployment or statefulSet pods.
+
+ Enum: deployment, statefulset
false