You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some of the Perses CRD spec fields such as spec.config.ephemeral_dashboard.cleanup_interval, spec.config.provisioning.interval uses model.Duration from prometheus/common/time.go.
prometheus/common/time.go has a custom JSON serialisation that converts implicitly to type:string. This conflicts with the Kubernetes API's expectation of a type: integer instead. This mismatch prevents the perses_controller from updating Perses resources, resulting in validation errors like:
time="2024-10-18T14:39:38+02:00" level=info msg="Adding Finalizer for Perses" module=perses_controller
time="2024-10-18T14:39:43+02:00" level=error msg="Failed to update custom resource to add finalizer" error="Perses.perses.dev \"perses-sample\" is invalid: spec.config.ephemeral_dashboard.cleanup_interval: Invalid value: \"string\": spec.config.ephemeral_dashboard.cleanup_interval in body must be of type integer: \"string\"" module=perses_controller
This occurs because the prometheus/commonpackage marshals model.Duration` to a string:
---
apiVersion: apiextensions.k8s.io/v1kind: CustomResourceDefinitionmetadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0name: perses.perses.devspec:
# ... (other parts of the CRD)versions:
- name: v1alpha1schema:
openAPIV3Schema:
description: Perses is the Schema for the perses APIproperties:
# ... (other properties)spec:
description: PersesSpec defines the desired state of Persesproperties:
config:
properties:
# ... (other properties)ephemeral_dashboard:
description: EphemeralDashboard contains the config about the ephemeral dashboard featureproperties:
cleanup_interval:
description: The interval at which to trigger the cleanup of ephemeral dashboards, based on their TTLs.format: int64 # This indicates that Kubernetes expects an integertype: integer# ... (other properties)# ... (other properties that use model.Duration)# ... (rest of the schema)
As seen in the CRD definition, spec.config.ephemeral_dashboard.cleanup_interval is explicitly defined as an integer (format: int64, type: integer) showing the incompatibility. This issue needs to be addressed to ensure compatibility of the Perses controller for managing the time duration fields of the Perses Config .
The text was updated successfully, but these errors were encountered:
While working on updating the dependencies and go version on my fork and encountered an issue with the serialization of
model.Duration
in the Perses CRD.Some of the Perses CRD spec fields such as
spec.config.ephemeral_dashboard.cleanup_interval
,spec.config.provisioning.interval
usesmodel.Duration
from prometheus/common/time.go.prometheus/common/time.go has a custom JSON serialisation that converts implicitly to
type:string
. This conflicts with the Kubernetes API's expectation of atype: integer
instead. This mismatch prevents the perses_controller from updating Perses resources, resulting in validation errors like:This occurs because the prometheus/common
package marshals
model.Duration` to a string:Perses CRD definition (config/crd/bases/perses.dev_perses.yaml)
As seen in the CRD definition,
spec.config.ephemeral_dashboard.cleanup_interval
is explicitly defined as an integer (format: int64
,type: integer
) showing the incompatibility. This issue needs to be addressed to ensure compatibility of the Perses controller for managing the time duration fields of the Perses Config .The text was updated successfully, but these errors were encountered: