Skip to content

Commit 6ffaf83

Browse files
committed
Update controller to OCIRepository v1 (GA)
Signed-off-by: Stefan Prodan <[email protected]>
1 parent f2db6a2 commit 6ffaf83

File tree

7 files changed

+9
-14
lines changed

7 files changed

+9
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ the controller performs actions to reconcile the cluster current state with the
4141

4242
* [Get started with Flux](https://fluxcd.io/flux/get-started/)
4343
* [Setup Notifications](https://fluxcd.io/flux/guides/notifications/)
44-
* [Manage Kubernetes secrets with Flux and Mozilla SOPS](https://fluxcd.io/flux/guides/mozilla-sops/)
44+
* [Manage Kubernetes secrets with Flux and SOPS](https://fluxcd.io/flux/guides/mozilla-sops/)
4545
* [How to build, publish and consume OCI Artifacts with Flux](https://fluxcd.io/flux/cheatsheets/oci-artifacts/)
4646
* [Flux and Kustomize FAQ](https://fluxcd.io/flux/faq/#kustomize-questions)
4747

config/default/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
namespace: kustomize-system
44
resources:
5-
- https://github.com/fluxcd/source-controller/releases/download/v1.5.0/source-controller.crds.yaml
6-
- https://github.com/fluxcd/source-controller/releases/download/v1.5.0/source-controller.deployment.yaml
5+
- https://github.com/fluxcd/source-controller/releases/download/v1.6.0/source-controller.crds.yaml
6+
- https://github.com/fluxcd/source-controller/releases/download/v1.6.0/source-controller.deployment.yaml
77
- ../crd
88
- ../rbac
99
- ../manager

config/testdata/oci/podinfo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: source.toolkit.fluxcd.io/v1beta2
1+
apiVersion: source.toolkit.fluxcd.io/v1
22
kind: OCIRepository
33
metadata:
44
name: oci

docs/spec/v1/kustomizations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Artifact containing the YAML manifests. It has two required fields:
115115

116116
- `kind`: The Kind of the referred Source object. Supported Source types:
117117
+ [GitRepository](https://github.com/fluxcd/source-controller/blob/main/docs/spec/v1/gitrepositories.md)
118-
+ [OCIRepository](https://github.com/fluxcd/source-controller/blob/main/docs/spec/v1beta2/ocirepositories.md)
118+
+ [OCIRepository](https://github.com/fluxcd/source-controller/blob/main/docs/spec/v1/ocirepositories.md)
119119
+ [Bucket](https://github.com/fluxcd/source-controller/blob/main/docs/spec/v1/buckets.md)
120120
- `name`: The Name of the referred Source object.
121121

internal/controller/kustomization_controller.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ import (
7070
ssautil "github.com/fluxcd/pkg/ssa/utils"
7171
"github.com/fluxcd/pkg/tar"
7272
sourcev1 "github.com/fluxcd/source-controller/api/v1"
73-
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
7473

7574
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
7675
intcache "github.com/fluxcd/kustomize-controller/internal/cache"
@@ -129,7 +128,7 @@ func (r *KustomizationReconciler) SetupWithManager(ctx context.Context, mgr ctrl
129128

130129
// Index the Kustomizations by the OCIRepository references they (may) point at.
131130
if err := mgr.GetCache().IndexField(ctx, &kustomizev1.Kustomization{}, ociRepositoryIndexKey,
132-
r.indexBy(sourcev1b2.OCIRepositoryKind)); err != nil {
131+
r.indexBy(sourcev1.OCIRepositoryKind)); err != nil {
133132
return fmt.Errorf("failed setting index fields: %w", err)
134133
}
135134

@@ -154,7 +153,7 @@ func (r *KustomizationReconciler) SetupWithManager(ctx context.Context, mgr ctrl
154153
predicate.Or(predicate.GenerationChangedPredicate{}, predicates.ReconcileRequestedPredicate{}),
155154
)).
156155
Watches(
157-
&sourcev1b2.OCIRepository{},
156+
&sourcev1.OCIRepository{},
158157
handler.EnqueueRequestsFromMapFunc(r.requestsForRevisionChangeOf(ociRepositoryIndexKey)),
159158
builder.WithPredicates(SourceRevisionChangePredicate{}),
160159
).
@@ -597,8 +596,8 @@ func (r *KustomizationReconciler) getSource(ctx context.Context,
597596
}
598597

599598
switch obj.Spec.SourceRef.Kind {
600-
case sourcev1b2.OCIRepositoryKind:
601-
var repository sourcev1b2.OCIRepository
599+
case sourcev1.OCIRepositoryKind:
600+
var repository sourcev1.OCIRepository
602601
err := r.Client.Get(ctx, namespacedName, &repository)
603602
if err != nil {
604603
if apierrors.IsNotFound(err) {

internal/controller/suite_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import (
4747
"github.com/fluxcd/pkg/runtime/testenv"
4848
"github.com/fluxcd/pkg/testserver"
4949
sourcev1 "github.com/fluxcd/source-controller/api/v1"
50-
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
5150

5251
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
5352
)
@@ -77,7 +76,6 @@ func runInContext(registerControllers func(*testenv.Environment), run func() int
7776
var err error
7877
utilruntime.Must(kustomizev1.AddToScheme(scheme.Scheme))
7978
utilruntime.Must(sourcev1.AddToScheme(scheme.Scheme))
80-
utilruntime.Must(sourcev1b2.AddToScheme(scheme.Scheme))
8179

8280
if debugMode {
8381
controllerLog.SetLogger(zap.New(zap.WriteTo(os.Stderr), zap.UseDevMode(false)))

main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ import (
5151
"github.com/fluxcd/pkg/runtime/pprof"
5252
"github.com/fluxcd/pkg/runtime/probes"
5353
sourcev1 "github.com/fluxcd/source-controller/api/v1"
54-
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
5554

5655
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
5756
"github.com/fluxcd/kustomize-controller/internal/controller"
@@ -70,7 +69,6 @@ func init() {
7069
_ = clientgoscheme.AddToScheme(scheme)
7170

7271
_ = sourcev1.AddToScheme(scheme)
73-
_ = sourcev1b2.AddToScheme(scheme)
7472
_ = kustomizev1.AddToScheme(scheme)
7573
// +kubebuilder:scaffold:scheme
7674
}

0 commit comments

Comments
 (0)