This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jordan Pellizzari <jordan@weave.works>
- Loading branch information
1 parent
0273427
commit 5f24634
Showing
9 changed files
with
1,080 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.