Skip to content

Commit 9b02d83

Browse files
authored
Merge pull request #117 from fluxcd/disable-remote-bases
Disable Kustomize remote bases
2 parents 266c957 + 39968f5 commit 9b02d83

File tree

3 files changed

+37
-15
lines changed

3 files changed

+37
-15
lines changed

README.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,14 @@ To enforce tenant isolation, cluster admins must configure Flux to reconcile
224224
the `Kustomization` and `HelmRelease` kinds by impersonating a service account
225225
from the namespace where these objects are created.
226226

227-
[Flux v0.26] introduced built-in [multi-tenancy lockdown] features which enables tenant isolation
227+
Flux has built-in [multi-tenancy lockdown] features which enables tenant isolation
228228
at Control Plane level without the need of external admission controllers (e.g. Kyverno). The
229229
recommended patch:
230230

231231
- Enforce controllers to block cross namespace references.
232+
Meaning that a tenant can’t use another tenant’s sources or subscribe to their events.
233+
- Deny accesses to Kustomize remote bases, thus ensuring all resources refer to local files.
234+
Meaning that only approved Flux Sources can affect the cluster-state.
232235
- Sets a default service account via `--default-service-account` to `kustomize-controller` and `helm-controller`.
233236
Meaning that, if a tenant does not specify a service account in a Flux `Kustomization` or
234237
`HelmRelease`, it would automatically default to said account.
@@ -243,19 +246,26 @@ This repository applies this patch automatically via
243246
apiVersion: kustomize.config.k8s.io/v1beta1
244247
kind: Kustomization
245248
resources:
246-
- gotk-components.yaml
247-
- gotk-sync.yaml
249+
- gotk-components.yaml
250+
- gotk-sync.yaml
248251
patches:
249252
- patch: |
250253
- op: add
251-
path: /spec/template/spec/containers/0/args/0
254+
path: /spec/template/spec/containers/0/args/-
252255
value: --no-cross-namespace-refs=true
253256
target:
254257
kind: Deployment
255258
name: "(kustomize-controller|helm-controller|notification-controller|image-reflector-controller|image-automation-controller)"
256259
- patch: |
257260
- op: add
258-
path: /spec/template/spec/containers/0/args/0
261+
path: /spec/template/spec/containers/0/args/-
262+
value: --no-remote-bases=true
263+
target:
264+
kind: Deployment
265+
name: "kustomize-controller"
266+
- patch: |
267+
- op: add
268+
path: /spec/template/spec/containers/0/args/-
259269
value: --default-service-account=default
260270
target:
261271
kind: Deployment
@@ -362,7 +372,6 @@ Other policies to explore:
362372
- For `HelmRepository` and `GitRepository` consider which protocols should be allowed.
363373
- For `Bucket`, consider restrictions on providers and regions.
364374

365-
366375
#### Make serviceAccountName mandatory
367376

368377
The lockdown patch sets a default service account that is applied to any `Kustomization` and `HelmRelease`
@@ -602,5 +611,4 @@ This repository contains the following GitHub CI workflows:
602611
and tests the staging setup by running Flux in Kubernetes Kind
603612

604613

605-
[Flux v0.26]: https://github.com/fluxcd/flux2/releases/tag/v0.26.0
606614
[multi-tenancy lockdown]: https://fluxcd.io/flux/installation/configuration/multitenancy/

clusters/production/flux-system/kustomization.yaml

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
4-
- gotk-components.yaml
5-
- gotk-sync.yaml
4+
- gotk-components.yaml
5+
- gotk-sync.yaml
66
patches:
77
- patch: |
88
- op: add
9-
path: /spec/template/spec/containers/0/args/0
9+
path: /spec/template/spec/containers/0/args/-
1010
value: --no-cross-namespace-refs=true
1111
target:
1212
kind: Deployment
1313
name: "(kustomize-controller|helm-controller|notification-controller|image-reflector-controller|image-automation-controller)"
1414
- patch: |
1515
- op: add
16-
path: /spec/template/spec/containers/0/args/0
16+
path: /spec/template/spec/containers/0/args/-
17+
value: --no-remote-bases=true
18+
target:
19+
kind: Deployment
20+
name: "kustomize-controller"
21+
- patch: |
22+
- op: add
23+
path: /spec/template/spec/containers/0/args/-
1724
value: --default-service-account=default
1825
target:
1926
kind: Deployment

clusters/staging/flux-system/kustomization.yaml

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
4-
- gotk-components.yaml
5-
- gotk-sync.yaml
4+
- gotk-components.yaml
5+
- gotk-sync.yaml
66
patches:
77
- patch: |
88
- op: add
9-
path: /spec/template/spec/containers/0/args/0
9+
path: /spec/template/spec/containers/0/args/-
1010
value: --no-cross-namespace-refs=true
1111
target:
1212
kind: Deployment
1313
name: "(kustomize-controller|helm-controller|notification-controller|image-reflector-controller|image-automation-controller)"
1414
- patch: |
1515
- op: add
16-
path: /spec/template/spec/containers/0/args/0
16+
path: /spec/template/spec/containers/0/args/-
17+
value: --no-remote-bases=true
18+
target:
19+
kind: Deployment
20+
name: "kustomize-controller"
21+
- patch: |
22+
- op: add
23+
path: /spec/template/spec/containers/0/args/-
1724
value: --default-service-account=default
1825
target:
1926
kind: Deployment

0 commit comments

Comments
 (0)