Skip to content

Commit

Permalink
runtime: Update Fake CRD with interval & rec req
Browse files Browse the repository at this point in the history
Add spec.interval and status.lastHandledReconcileAt in the Fake CRD for
testing object helper that return interval and last reconcile at values.

Signed-off-by: Sunny <[email protected]>
  • Loading branch information
darkowlzz committed Oct 10, 2022
1 parent 7d22930 commit d7f0b99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ spec:
type: object
spec:
properties:
interval:
type: string
suspend:
type: boolean
value:
type: string
required:
- interval
type: object
status:
properties:
Expand Down Expand Up @@ -81,6 +85,9 @@ spec:
- type
type: object
type: array
lastHandledReconcileAt:
description: LastHandledReconcileAt holds the value of the most recent reconcile request value, so a change of the annotation value can be detected.
type: string
observedGeneration:
format: int64
type: integer
Expand Down
14 changes: 8 additions & 6 deletions runtime/conditions/testdata/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package testdata

import (
"github.com/fluxcd/pkg/apis/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -44,14 +45,16 @@ var (
)

type FakeSpec struct {
Suspend bool `json:"suspend,omitempty"`
Value string `json:"value,omitempty"`
Suspend bool `json:"suspend,omitempty"`
Value string `json:"value,omitempty"`
Interval metav1.Duration `json:"interval"`
}

type FakeStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
ObservedValue string `json:"observedValue,omitempty"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
ObservedValue string `json:"observedValue,omitempty"`
meta.ReconcileRequestStatus `json:",inline"`
}

func (f Fake) GetConditions() []metav1.Condition {
Expand Down Expand Up @@ -169,7 +172,6 @@ type FakeList struct {
Items []Fake `json:"items"`
}


func init() {
FakeSchemeBuilder.Register(&Fake{}, &FakeList{})
}

0 comments on commit d7f0b99

Please sign in to comment.