This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
adapters.go
88 lines (68 loc) · 1.93 KB
/
adapters.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package clustersserver
import (
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta1"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
type reconcilable interface {
runtime.Object
GetAnnotations() map[string]string
SetAnnotations(map[string]string)
GetStatusConditions() *[]metav1.Condition
GetLastHandledReconcileRequest() string
DeepCopyObject() runtime.Object
asRuntimeObject() runtime.Object
}
type apiType struct {
kind, humanKind string
}
type reconcileWrapper struct {
apiType
object reconcilable
}
type gitRepositoryAdapter struct {
*sourcev1.GitRepository
}
func (o gitRepositoryAdapter) GetLastHandledReconcileRequest() string {
return o.Status.GetLastHandledReconcileRequest()
}
func (o gitRepositoryAdapter) asRuntimeObject() runtime.Object {
return o.GitRepository
}
type bucketAdapter struct {
*sourcev1.Bucket
}
func (obj bucketAdapter) GetLastHandledReconcileRequest() string {
return obj.Status.GetLastHandledReconcileRequest()
}
func (obj bucketAdapter) asRuntimeObject() runtime.Object {
return obj
}
type helmRepoAdapter struct {
*sourcev1.HelmRepository
}
func (obj helmRepoAdapter) GetLastHandledReconcileRequest() string {
return obj.Status.GetLastHandledReconcileRequest()
}
func (obj helmRepoAdapter) asRuntimeObject() runtime.Object {
return obj.HelmRepository
}
type helmChartAdapter struct {
*sourcev1.HelmChart
}
func (obj helmChartAdapter) GetLastHandledReconcileRequest() string {
return obj.Status.GetLastHandledReconcileRequest()
}
func (obj helmChartAdapter) asRuntimeObject() runtime.Object {
return obj.HelmChart
}
type kustomizationAdapter struct {
*kustomizev1.Kustomization
}
func (o kustomizationAdapter) GetLastHandledReconcileRequest() string {
return o.Status.GetLastHandledReconcileRequest()
}
func (o kustomizationAdapter) asRuntimeObject() runtime.Object {
return o.Kustomization
}