Skip to content

Commit 525be38

Browse files
stefanprodanhiddeco
authored andcommitted
Add ACL optional field to Source API
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 5980619 commit 525be38

15 files changed

+240
-6
lines changed

api/go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ module github.com/fluxcd/source-controller/api
33
go 1.16
44

55
require (
6+
github.com/fluxcd/pkg/apis/acl v0.0.1
67
github.com/fluxcd/pkg/apis/meta v0.11.0-rc.1
78
// TODO(hidde): introduction of the runtime package is temporary, and the dependency should be removed as soon as
89
// all APIs have been updated to the runtime standards (more specifically; have dropped their condition modifying
910
// functions).
10-
github.com/fluxcd/pkg/runtime v0.13.0-rc.2
11+
github.com/fluxcd/pkg/runtime v0.13.0-rc.3
1112
k8s.io/apimachinery v0.21.3
1213
sigs.k8s.io/controller-runtime v0.9.3
1314
)

api/go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi
9191
github.com/evanphx/json-patch v4.11.0+incompatible h1:glyUF9yIYtMHzn8xaKw5rMhdWcwsYV8dZHIq5567/xs=
9292
github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
9393
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
94+
github.com/fluxcd/pkg/apis/acl v0.0.1 h1:biCgZMjpDSv3Q4mZPikUJILx3t2MuNXR4Oa5jRQxaNQ=
95+
github.com/fluxcd/pkg/apis/acl v0.0.1/go.mod h1:y3qOXUFObVWk7jzOjubMnr/u18j1kCeSi6olycnxr/E=
9496
github.com/fluxcd/pkg/apis/meta v0.11.0-rc.1 h1:RHHrztAFv9wmjM+Pk7Svt1UdD+1SdnQSp76MWFiM7Hg=
9597
github.com/fluxcd/pkg/apis/meta v0.11.0-rc.1/go.mod h1:yUblM2vg+X8TE3A2VvJfdhkGmg+uqBlSPkLk7dxi0UM=
96-
github.com/fluxcd/pkg/runtime v0.13.0-rc.2 h1:+4uTEg+CU++hlr7NpOP4KYp60MtHDOgYvpz/74tbATg=
97-
github.com/fluxcd/pkg/runtime v0.13.0-rc.2/go.mod h1:TmvE2cJl1QkgZNmmlr7XUKoWDQwUiM5/wTUxXsQVoc8=
98+
github.com/fluxcd/pkg/runtime v0.13.0-rc.3 h1:VxtmEL/m3/9wJBhhhWQ48fz8m93B7UiyVi5cXYbiy3E=
99+
github.com/fluxcd/pkg/runtime v0.13.0-rc.3/go.mod h1:5ioX9wb63+RUvHBdjRsFG4uYn6Ll/Yoa7Ema6XKIIuQ=
98100
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
99101
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
100102
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=

api/v1beta1/bucket_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1beta1
1919
import (
2020
"time"
2121

22+
"github.com/fluxcd/pkg/apis/acl"
2223
"github.com/fluxcd/pkg/apis/meta"
2324
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2425
)
@@ -80,6 +81,10 @@ type BucketSpec struct {
8081
// This flag tells the controller to suspend the reconciliation of this source.
8182
// +optional
8283
Suspend bool `json:"suspend,omitempty"`
84+
85+
// AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
86+
// +optional
87+
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
8388
}
8489

8590
// BucketStatus defines the observed state of a bucket

api/v1beta1/gitrepository_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1beta1
1919
import (
2020
"time"
2121

22+
"github.com/fluxcd/pkg/apis/acl"
2223
"github.com/fluxcd/pkg/apis/meta"
2324
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2425
)
@@ -100,6 +101,10 @@ type GitRepositorySpec struct {
100101
// Include defines a list of GitRepository resources which artifacts should be included in the artifact produced for
101102
// this resource.
102103
Include []GitRepositoryInclude `json:"include,omitempty"`
104+
105+
// AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
106+
// +optional
107+
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
103108
}
104109

105110
func (in *GitRepositoryInclude) GetFromPath() string {

api/v1beta1/helmchart_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1beta1
1919
import (
2020
"time"
2121

22+
"github.com/fluxcd/pkg/apis/acl"
2223
"github.com/fluxcd/pkg/apis/meta"
2324
"github.com/fluxcd/pkg/runtime/conditions"
2425
apimeta "k8s.io/apimachinery/pkg/api/meta"
@@ -66,6 +67,10 @@ type HelmChartSpec struct {
6667
// This flag tells the controller to suspend the reconciliation of this source.
6768
// +optional
6869
Suspend bool `json:"suspend,omitempty"`
70+
71+
// AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
72+
// +optional
73+
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
6974
}
7075

7176
// LocalHelmChartSourceReference contains enough information to let you locate

api/v1beta1/helmrepository_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1beta1
1919
import (
2020
"time"
2121

22+
"github.com/fluxcd/pkg/apis/acl"
2223
"github.com/fluxcd/pkg/apis/meta"
2324
"github.com/fluxcd/pkg/runtime/conditions"
2425
apimeta "k8s.io/apimachinery/pkg/api/meta"
@@ -69,6 +70,10 @@ type HelmRepositorySpec struct {
6970
// This flag tells the controller to suspend the reconciliation of this source.
7071
// +optional
7172
Suspend bool `json:"suspend,omitempty"`
73+
74+
// AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
75+
// +optional
76+
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
7277
}
7378

7479
// HelmRepositoryStatus defines the observed state of the HelmRepository.

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/source.toolkit.fluxcd.io_buckets.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@ spec:
4545
spec:
4646
description: BucketSpec defines the desired state of an S3 compatible bucket
4747
properties:
48+
accessFrom:
49+
description: AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
50+
properties:
51+
namespaceSelectors:
52+
description: NamespaceSelectors is the list of namespace selectors to which this ACL applies. Items in this list are evaluated using a logical OR operation.
53+
items:
54+
description: NamespaceSelector selects the namespaces to which this ACL applies. An empty map of MatchLabels matches all namespaces in a cluster.
55+
properties:
56+
matchLabels:
57+
additionalProperties:
58+
type: string
59+
description: MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
60+
type: object
61+
type: object
62+
type: array
63+
required:
64+
- namespaceSelectors
65+
type: object
4866
bucketName:
4967
description: The bucket name.
5068
type: string

config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ spec:
4747
spec:
4848
description: GitRepositorySpec defines the desired state of a Git repository.
4949
properties:
50+
accessFrom:
51+
description: AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
52+
properties:
53+
namespaceSelectors:
54+
description: NamespaceSelectors is the list of namespace selectors to which this ACL applies. Items in this list are evaluated using a logical OR operation.
55+
items:
56+
description: NamespaceSelector selects the namespaces to which this ACL applies. An empty map of MatchLabels matches all namespaces in a cluster.
57+
properties:
58+
matchLabels:
59+
additionalProperties:
60+
type: string
61+
description: MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
62+
type: object
63+
type: object
64+
type: array
65+
required:
66+
- namespaceSelectors
67+
type: object
5068
gitImplementation:
5169
default: go-git
5270
description: Determines which git client library to use. Defaults to go-git, valid values are ('go-git', 'libgit2').

config/crd/bases/source.toolkit.fluxcd.io_helmcharts.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@ spec:
5656
spec:
5757
description: HelmChartSpec defines the desired state of a Helm chart.
5858
properties:
59+
accessFrom:
60+
description: AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
61+
properties:
62+
namespaceSelectors:
63+
description: NamespaceSelectors is the list of namespace selectors to which this ACL applies. Items in this list are evaluated using a logical OR operation.
64+
items:
65+
description: NamespaceSelector selects the namespaces to which this ACL applies. An empty map of MatchLabels matches all namespaces in a cluster.
66+
properties:
67+
matchLabels:
68+
additionalProperties:
69+
type: string
70+
description: MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
71+
type: object
72+
type: object
73+
type: array
74+
required:
75+
- namespaceSelectors
76+
type: object
5977
chart:
6078
description: The name or path the Helm chart is available at in the SourceRef.
6179
type: string

0 commit comments

Comments
 (0)