The Interval field default is not correctly applied in SylvaUnitsReleaseSpec
The CRD defines the Interval fields as
// Interval at which the FluxCD resources are reconciled
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
// +kubebuilder:default="30m"
// +optional
Interval metav1.Duration `json:"interval"`
However, when left unset like in this example
By("Creating empty SylvaUnitsRelease"Template"")
sylvaUnitsRelease := &surv1alpha1.SylvaUnitsRelease{
ObjectMeta: metav1.ObjectMeta{
Name: "sur1",
Namespace: "default",
},
Spec: surv1alpha1.SylvaUnitsReleaseSpec{
ClusterType: surv1alpha1.WorkloadClusterType,
SylvaUnitsSource: &surv1alpha1.SylvaUnitsSource{
Type: "git",
URL: "https://bob.io",
Tag: "dummy",
},
},
}
truc, _ := json.Marshal(sylvaUnitsRelease)
fmt.Println(string(truc))
Expect(k8sClient.Create(ctx, sylvaUnitsRelease)).Should(Succeed())
By("Checking that default values are set")
Eventually(func(g Gomega) {g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(sylvaUnitsRelease), sylvaUnitsRelease)).To(Succeed())}, timeout, interval).Should(Succeed())
truc, _ = json.Marshal(sylvaUnitsRelease)
fmt.Println(string(truc))
The printed values are
{"metadata":{"name":"sur1","namespace":"default","creationTimestamp":null},"spec":{"clusterType":"workload","sylvaUnitsSource":{"type":"git","url":"https://bob.io","tag":"dummy"},"interval":"0s"},"status":{"helmReleaseStatus":{}}}
{"metadata":{"name":"sur1","namespace":"default","uid":"472d5deb-e059-4134-8905-877d2f3e0b3a","resourceVersion":"233","generation":1,"creationTimestamp":"2025-11-13T13:39:02Z","managedFields":[{"manager":"controller.test","operation":"Update","apiVersion":"unitsoperator.sylva/v1alpha1","time":"2025-11-13T13:39:02Z","fieldsType":"FieldsV1","fieldsV1":{"f:spec":{".":{},"f:clusterType":{},"f:interval":{},"f:suspend":{},"f:sylvaUnitsSource":{".":{},"f:tag":{},"f:type":{},"f:url":{}}}}}]},"spec":{"clusterType":"workload","sylvaUnitsSource":{"type":"git","url":"https://bob.io","tag":"dummy"},"interval":"0s"},"status":{"observedGeneration":-1,"helmReleaseStatus":{}}}
Therefore, the default values is not 30m as expected, but 0s
Edited by vladimir braquet