Skip to content

Commit 4c38aed

Browse files
committed
Update Flux dependencies.
This imports the newer versions of GitRepository etc so that we dont' get logged warnings about needing to upgrade.
1 parent 49afb5a commit 4c38aed

11 files changed

Lines changed: 43 additions & 77 deletions

File tree

config/crd/bases/sets.gitops.pro_gitopssets.yaml

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.14.0
6+
controller-gen.kubebuilder.io/version: v0.16.1
77
name: gitopssets.sets.gitops.pro
88
spec:
99
group: sets.gitops.pro
@@ -67,7 +67,6 @@ spec:
6767
description: |-
6868
Body is set as the body in a POST request.
6969
70-
7170
If set, this will configure the Method to be POST automatically.
7271
x-kubernetes-preserve-unknown-fields: true
7372
endpoint:
@@ -79,7 +78,6 @@ spec:
7978
HeadersRef allows optional configuration of a Secret or ConfigMap to add
8079
additional headers to an outgoing request.
8180
82-
8381
For example, a Secret with a key Authorization: Bearer abc123 could be
8482
used to configure an authorization header.
8583
properties:
@@ -105,7 +103,6 @@ spec:
105103
JSONPath is string that is used to modify the result of the API
106104
call.
107105
108-
109106
This can be used to extract a repeating element from a response.
110107
https://kubernetes.io/docs/reference/kubectl/jsonpath/
111108
type: string
@@ -133,7 +130,6 @@ spec:
133130
SingleElement means generate a single element with the result of the API
134131
call.
135132
136-
137133
When true, the response must be a JSON object and will be returned as a
138134
single element, i.e. only one element will be generated containing the
139135
entire object.
@@ -150,7 +146,6 @@ spec:
150146
description: |-
151147
Selector is used to filter the clusters that you want to target.
152148
153-
154149
If no selector is provided, no clusters will be matched.
155150
properties:
156151
matchExpressions:
@@ -293,7 +288,6 @@ spec:
293288
description: |-
294289
Body is set as the body in a POST request.
295290
296-
297291
If set, this will configure the Method to be POST automatically.
298292
x-kubernetes-preserve-unknown-fields: true
299293
endpoint:
@@ -305,7 +299,6 @@ spec:
305299
HeadersRef allows optional configuration of a Secret or ConfigMap to add
306300
additional headers to an outgoing request.
307301
308-
309302
For example, a Secret with a key Authorization: Bearer abc123 could be
310303
used to configure an authorization header.
311304
properties:
@@ -333,7 +326,6 @@ spec:
333326
JSONPath is string that is used to modify the result of the API
334327
call.
335328
336-
337329
This can be used to extract a repeating element from a response.
338330
https://kubernetes.io/docs/reference/kubectl/jsonpath/
339331
type: string
@@ -361,7 +353,6 @@ spec:
361353
SingleElement means generate a single element with the result of the API
362354
call.
363355
364-
365356
When true, the response must be a JSON object and will be returned as a
366357
single element, i.e. only one element will be generated containing the
367358
entire object.
@@ -378,7 +369,6 @@ spec:
378369
description: |-
379370
Selector is used to filter the clusters that you want to target.
380371
381-
382372
If no selector is provided, no clusters will be matched.
383373
properties:
384374
matchExpressions:
@@ -613,7 +603,6 @@ spec:
613603
SingleElement means generate a single element with the result of the
614604
merged generator elements.
615605
616-
617606
When true, the matrix elements will be merged to a single element, with
618607
whatever prefixes they have.
619608
It's recommended that you use the Name field to separate out elements.
@@ -753,16 +742,8 @@ spec:
753742
conditions:
754743
description: Conditions holds the conditions for the GitOpsSet
755744
items:
756-
description: "Condition contains details for one aspect of the current
757-
state of this API Resource.\n---\nThis struct is intended for
758-
direct use as an array at the field path .status.conditions. For
759-
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
760-
observations of a foo's current state.\n\t // Known .status.conditions.type
761-
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
762-
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
763-
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
764-
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
765-
\ // other fields\n\t}"
745+
description: Condition contains details for one aspect of the current
746+
state of this API Resource.
766747
properties:
767748
lastTransitionTime:
768749
description: |-
@@ -803,12 +784,7 @@ spec:
803784
- Unknown
804785
type: string
805786
type:
806-
description: |-
807-
type of condition in CamelCase or in foo.example.com/CamelCase.
808-
---
809-
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
810-
useful (see .node.status.conditions), the ability to deconflict is important.
811-
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
787+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
812788
maxLength: 316
813789
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
814790
type: string

config/rbac/role.yaml

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ rules:
88
- ""
99
resources:
1010
- configmaps
11+
- secrets
1112
verbs:
1213
- get
1314
- list
@@ -22,19 +23,27 @@ rules:
2223
- apiGroups:
2324
- ""
2425
resources:
25-
- secrets
26+
- serviceaccounts
27+
verbs:
28+
- impersonate
29+
- apiGroups:
30+
- gitops.weave.works
31+
resources:
32+
- gitopsclusters
2633
verbs:
2734
- get
2835
- list
2936
- watch
3037
- apiGroups:
31-
- ""
38+
- image.toolkit.fluxcd.io
3239
resources:
33-
- serviceaccounts
40+
- imagepolicies
3441
verbs:
35-
- impersonate
42+
- get
43+
- list
44+
- watch
3645
- apiGroups:
37-
- gitops.pro
46+
- sets.gitops.pro
3847
resources:
3948
- gitopssets
4049
verbs:
@@ -46,46 +55,23 @@ rules:
4655
- update
4756
- watch
4857
- apiGroups:
49-
- gitops.pro
58+
- sets.gitops.pro
5059
resources:
5160
- gitopssets/finalizers
5261
verbs:
5362
- update
5463
- apiGroups:
55-
- gitops.pro
64+
- sets.gitops.pro
5665
resources:
5766
- gitopssets/status
5867
verbs:
5968
- get
6069
- patch
6170
- update
62-
- apiGroups:
63-
- gitops.weave.works
64-
resources:
65-
- gitopsclusters
66-
verbs:
67-
- get
68-
- list
69-
- watch
70-
- apiGroups:
71-
- image.toolkit.fluxcd.io
72-
resources:
73-
- imagepolicies
74-
verbs:
75-
- get
76-
- list
77-
- watch
7871
- apiGroups:
7972
- source.toolkit.fluxcd.io
8073
resources:
8174
- gitrepositories
82-
verbs:
83-
- get
84-
- list
85-
- watch
86-
- apiGroups:
87-
- source.toolkit.fluxcd.io
88-
resources:
8975
- ocirepositories
9076
verbs:
9177
- get

controllers/gitopsset_controller.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import (
1313
"github.com/fluxcd/pkg/runtime/conditions"
1414
runtimeCtrl "github.com/fluxcd/pkg/runtime/controller"
1515
"github.com/fluxcd/pkg/runtime/predicates"
16-
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
16+
sourcev1 "github.com/fluxcd/source-controller/api/v1"
17+
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
1718
"github.com/gitops-tools/pkg/sets"
1819
"github.com/go-logr/logr"
1920
corev1 "k8s.io/api/core/v1"
@@ -83,9 +84,9 @@ func (r *GitOpsSetReconciler) event(obj *templatesv1.GitOpsSet, severity, msg st
8384
r.EventRecorder.Event(obj, eventType, reason, msg)
8485
}
8586

86-
//+kubebuilder:rbac:groups=gitops.pro,resources=gitopssets,verbs=get;list;watch;create;update;patch;delete
87-
//+kubebuilder:rbac:groups=gitops.pro,resources=gitopssets/status,verbs=get;update;patch
88-
//+kubebuilder:rbac:groups=gitops.pro,resources=gitopssets/finalizers,verbs=update
87+
//+kubebuilder:rbac:groups=sets.gitops.pro,resources=gitopssets,verbs=get;list;watch;create;update;patch;delete
88+
//+kubebuilder:rbac:groups=sets.gitops.pro,resources=gitopssets/status,verbs=get;update;patch
89+
//+kubebuilder:rbac:groups=sets.gitops.pro,resources=gitopssets/finalizers,verbs=update
8990
//+kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=gitrepositories,verbs=get;list;watch
9091
//+kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=ocirepositories,verbs=get;list;watch
9192
//+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch
@@ -380,7 +381,7 @@ func (r *GitOpsSetReconciler) SetupWithManager(mgr ctrl.Manager) error {
380381

381382
if r.Generators["OCIRepository"] != nil {
382383
builder.Watches(
383-
&sourcev1.OCIRepository{},
384+
&sourcev1beta2.OCIRepository{},
384385
handler.EnqueueRequestsFromMapFunc(r.ociRepositoryToGitOpsSet),
385386
)
386387
}

controllers/gitopsset_controller_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1beta2"
1212
"github.com/fluxcd/pkg/apis/meta"
1313
fluxMeta "github.com/fluxcd/pkg/apis/meta"
14+
sourcev1 "github.com/fluxcd/source-controller/api/v1"
1415
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
1516
"github.com/google/go-cmp/cmp"
1617
"github.com/google/go-cmp/cmp/cmpopts"
@@ -77,6 +78,7 @@ func TestReconciliation(t *testing.T) {
7778
test.AssertNoError(t, clientgoscheme.AddToScheme(scheme))
7879
test.AssertNoError(t, templatesv1.AddToScheme(scheme))
7980
test.AssertNoError(t, sourcev1beta2.AddToScheme(scheme))
81+
test.AssertNoError(t, sourcev1.AddToScheme(scheme))
8082

8183
k8sClient, err := client.New(cfg, client.Options{Scheme: scheme})
8284
test.AssertNoError(t, err)

examples/apiclient/api-client-generator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
templates:
1717
- content:
1818
kind: Kustomization
19-
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
19+
apiVersion: kustomize.toolkit.fluxcd.io/v1
2020
metadata:
2121
name: "{{ .Element.env }}-demo"
2222
labels:

examples/base/go-demo-gitrepository.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/v1beta1
1+
apiVersion: source.toolkit.fluxcd.io/v1
22
kind: GitRepository
33
metadata:
44
name: go-demo-repo

examples/pull-requests/pull-requests-generator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
forks: false
2020
templates:
2121
- content:
22-
apiVersion: source.toolkit.fluxcd.io/v1beta2
22+
apiVersion: source.toolkit.fluxcd.io/v1
2323
kind: GitRepository
2424
metadata:
2525
name: "pr-{{ .Element.Number }}-gitrepository"

pkg/generators/gitrepository/git_repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"time"
77

8-
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
8+
sourcev1 "github.com/fluxcd/source-controller/api/v1"
99
templatesv1 "github.com/gitops-tools/gitopssets-controller/api/v1alpha1"
1010
"github.com/gitops-tools/gitopssets-controller/pkg/generators"
1111
"github.com/gitops-tools/gitopssets-controller/pkg/parser"

pkg/generators/gitrepository/git_repository_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"github.com/fluxcd/pkg/http/fetch"
88
"github.com/fluxcd/pkg/tar"
99
sourcev1 "github.com/fluxcd/source-controller/api/v1"
10-
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
1110
"github.com/go-logr/logr"
1211
"github.com/google/go-cmp/cmp"
1312
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -199,8 +198,8 @@ func TestGenerate_errors(t *testing.T) {
199198
}
200199
}
201200

202-
func withArchiveURLAndChecksum(archiveURL, xsum string) func(*sourcev1beta2.GitRepository) {
203-
return func(gr *sourcev1beta2.GitRepository) {
201+
func withArchiveURLAndChecksum(archiveURL, xsum string) func(*sourcev1.GitRepository) {
202+
return func(gr *sourcev1.GitRepository) {
204203
gr.Status.Artifact = &sourcev1.Artifact{
205204
URL: archiveURL,
206205
Digest: xsum,
@@ -211,7 +210,7 @@ func withArchiveURLAndChecksum(archiveURL, xsum string) func(*sourcev1beta2.GitR
211210
func newFakeClient(t *testing.T, objs ...runtime.Object) client.WithWatch {
212211
t.Helper()
213212
scheme := runtime.NewScheme()
214-
if err := sourcev1beta2.AddToScheme(scheme); err != nil {
213+
if err := sourcev1.AddToScheme(scheme); err != nil {
215214
t.Fatal(err)
216215
}
217216
if err := templatesv1.AddToScheme(scheme); err != nil {

pkg/setup/generators.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import (
99
_ "k8s.io/client-go/plugin/pkg/client/auth"
1010

1111
imagev1 "github.com/fluxcd/image-reflector-controller/api/v1beta2"
12-
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
12+
sourcev1 "github.com/fluxcd/source-controller/api/v1"
13+
sourcev1beta2 "github.com/fluxcd/source-controller/api/v1beta2"
1314
clustersv1 "github.com/weaveworks/cluster-controller/api/v1alpha1"
1415
"k8s.io/apimachinery/pkg/runtime"
1516
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
@@ -42,6 +43,7 @@ func NewSchemeForGenerators(enabledGenerators []string) (*runtime.Scheme, error)
4243
builder := runtime.SchemeBuilder{
4344
clientgoscheme.AddToScheme,
4445
sourcev1.AddToScheme,
46+
sourcev1beta2.AddToScheme,
4547
templatesv1.AddToScheme,
4648
}
4749

0 commit comments

Comments
 (0)