Add repository sync interval to API

This commit is contained in:
stefanprodan 2020-04-05 18:10:30 +03:00
parent 2fadfbd6fc
commit f740d434dc
6 changed files with 23 additions and 3 deletions

View File

@ -25,7 +25,10 @@ type GitRepositorySpec struct {
// +kubebuilder:validation:MinLength=4
// The repository address
Url string `json:"url,omitempty"`
Url string `json:"url"`
// The interval at which to check for repository updates
Interval metav1.Duration `json:"interval"`
}
// GitRepositoryStatus defines the observed state of GitRepository

View File

@ -25,7 +25,10 @@ type HelmRepositorySpec struct {
// +kubebuilder:validation:MinLength=4
// The repository address
Url string `json:"url,omitempty"`
Url string `json:"url"`
// The interval at which to check for repository updates
Interval metav1.Duration `json:"interval"`
}
// HelmRepositoryStatus defines the observed state of HelmRepository

View File

@ -86,6 +86,7 @@ func (in *GitRepositoryList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GitRepositorySpec) DeepCopyInto(out *GitRepositorySpec) {
*out = *in
out.Interval = in.Interval
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepositorySpec.
@ -182,6 +183,7 @@ func (in *HelmRepositoryList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelmRepositorySpec) DeepCopyInto(out *HelmRepositorySpec) {
*out = *in
out.Interval = in.Interval
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmRepositorySpec.

View File

@ -49,10 +49,16 @@ spec:
spec:
description: GitRepositorySpec defines the desired state of GitRepository
properties:
interval:
description: The interval at which to check for repository updates
type: string
url:
description: The repository address
minLength: 4
type: string
required:
- interval
- url
type: object
status:
description: GitRepositoryStatus defines the observed state of GitRepository

View File

@ -49,10 +49,16 @@ spec:
spec:
description: HelmRepositorySpec defines the desired state of HelmRepository
properties:
interval:
description: The interval at which to check for repository updates
type: string
url:
description: The repository address
minLength: 4
type: string
required:
- interval
- url
type: object
status:
description: HelmRepositoryStatus defines the observed state of HelmRepository

View File

@ -101,7 +101,7 @@ func (r *HelmRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
return ctrl.Result{}, err
}
return ctrl.Result{RequeueAfter: time.Minute}, nil
return ctrl.Result{RequeueAfter: repo.Spec.Interval.Duration}, nil
}
func (r *HelmRepositoryReconciler) SetupWithManager(mgr ctrl.Manager) error {