Skip to content

Commit c31bb0f

Browse files
authored
Merge pull request #495 from fluxcd/acl-api
2 parents e15e0ac + 058a016 commit c31bb0f

14 files changed

+243
-5
lines changed

api/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ 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.10.0
78
k8s.io/apimachinery v0.21.3
89
sigs.k8s.io/controller-runtime v0.9.5

api/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMi
9191
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
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.10.0 h1:N7wVGHC1cyPdT87hrDC7UwCwRwnZdQM46PBSLjG2rlE=
9597
github.com/fluxcd/pkg/apis/meta v0.10.0/go.mod h1:CW9X9ijMTpNe7BwnokiUOrLl/h13miwVr/3abEQLbKE=
9698
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=

api/v1beta1/bucket_types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"github.com/fluxcd/pkg/apis/meta"
2120
apimeta "k8s.io/apimachinery/pkg/api/meta"
2221
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
23+
"github.com/fluxcd/pkg/apis/acl"
24+
"github.com/fluxcd/pkg/apis/meta"
2325
)
2426

2527
const (
@@ -74,6 +76,10 @@ type BucketSpec struct {
7476
// This flag tells the controller to suspend the reconciliation of this source.
7577
// +optional
7678
Suspend bool `json:"suspend,omitempty"`
79+
80+
// AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
81+
// +optional
82+
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
7783
}
7884

7985
const (

api/v1beta1/gitrepository_types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"github.com/fluxcd/pkg/apis/meta"
2120
apimeta "k8s.io/apimachinery/pkg/api/meta"
2221
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
23+
"github.com/fluxcd/pkg/apis/acl"
24+
"github.com/fluxcd/pkg/apis/meta"
2325
)
2426

2527
const (
@@ -90,6 +92,10 @@ type GitRepositorySpec struct {
9092

9193
// Extra git repositories to map into the repository
9294
Include []GitRepositoryInclude `json:"include,omitempty"`
95+
96+
// AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
97+
// +optional
98+
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
9399
}
94100

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

api/v1beta1/helmchart_types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"github.com/fluxcd/pkg/apis/meta"
2120
apimeta "k8s.io/apimachinery/pkg/api/meta"
2221
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
23+
"github.com/fluxcd/pkg/apis/acl"
24+
"github.com/fluxcd/pkg/apis/meta"
2325
)
2426

2527
// HelmChartKind is the string representation of a HelmChart.
@@ -72,6 +74,10 @@ type HelmChartSpec struct {
7274
// This flag tells the controller to suspend the reconciliation of this source.
7375
// +optional
7476
Suspend bool `json:"suspend,omitempty"`
77+
78+
// AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
79+
// +optional
80+
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
7581
}
7682

7783
const (

api/v1beta1/helmrepository_types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20-
"github.com/fluxcd/pkg/apis/meta"
2120
apimeta "k8s.io/apimachinery/pkg/api/meta"
2221
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
23+
"github.com/fluxcd/pkg/apis/acl"
24+
"github.com/fluxcd/pkg/apis/meta"
2325
)
2426

2527
const (
@@ -66,6 +68,10 @@ type HelmRepositorySpec struct {
6668
// This flag tells the controller to suspend the reconciliation of this source.
6769
// +optional
6870
Suspend bool `json:"suspend,omitempty"`
71+
72+
// AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
73+
// +optional
74+
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
6975
}
7076

7177
// 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)