Skip to content

Commit a0c79e1

Browse files
authored
Merge pull request #754 from klausenbusk/components
Add support for Kustomize components
2 parents e7e42e9 + b25dea8 commit a0c79e1

File tree

7 files changed

+68
-3
lines changed

7 files changed

+68
-3
lines changed

api/v1beta2/kustomization_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ type KustomizationSpec struct {
153153
// +kubebuilder:validation:Enum=none;client;server
154154
// +optional
155155
Validation string `json:"validation,omitempty"`
156+
157+
// Components specifies relative paths to specifications of other Components
158+
// +optional
159+
Components []string `json:"components,omitempty"`
156160
}
157161

158162
// Decryption defines how decryption is handled for Kubernetes manifests.

api/v1beta2/zz_generated.deepcopy.go

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,12 @@ spec:
585585
description: KustomizationSpec defines the configuration to calculate
586586
the desired state from a Source using Kustomize.
587587
properties:
588+
components:
589+
description: Components specifies relative paths to specifications
590+
of other Components
591+
items:
592+
type: string
593+
type: array
588594
decryption:
589595
description: Decrypt Kubernetes secrets before applying them on the
590596
cluster.

docs/api/kustomize.md

+24
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,18 @@ string
367367
<p>Deprecated: Not used in v1beta2.</p>
368368
</td>
369369
</tr>
370+
<tr>
371+
<td>
372+
<code>components</code><br>
373+
<em>
374+
[]string
375+
</em>
376+
</td>
377+
<td>
378+
<em>(Optional)</em>
379+
<p>Components specifies relative paths to specifications of other Components</p>
380+
</td>
381+
</tr>
370382
</table>
371383
</td>
372384
</tr>
@@ -816,6 +828,18 @@ string
816828
<p>Deprecated: Not used in v1beta2.</p>
817829
</td>
818830
</tr>
831+
<tr>
832+
<td>
833+
<code>components</code><br>
834+
<em>
835+
[]string
836+
</em>
837+
</td>
838+
<td>
839+
<em>(Optional)</em>
840+
<p>Components specifies relative paths to specifications of other Components</p>
841+
</td>
842+
</tr>
819843
</tbody>
820844
</table>
821845
</div>

docs/spec/v1beta2/kustomization.md

+26
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ offering support for the following Kustomize directives:
556556
- [namespace](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/namespace/)
557557
- [patches](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patches/)
558558
- [images](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/images/)
559+
- [components](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/components/)
559560

560561
### Target namespace
561562

@@ -654,6 +655,31 @@ spec:
654655
digest: sha256:24a0c4b4a4c0eb97a1aabb8e29f18e917d05abfe1b7a7c07857230879ce7d3d3
655656
```
656657

658+
### Components
659+
660+
To add [Kustomize `components` entries](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/components/)
661+
to the configuration, and use reusable pieces of configuration logic that can
662+
be included from multiple overlays, `spec.components` can be defined:
663+
664+
```yaml
665+
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
666+
kind: Kustomization
667+
metadata:
668+
name: podinfo
669+
namespace: flux-system
670+
spec:
671+
# ...omitted for brevity
672+
components:
673+
- ingress
674+
- tls
675+
```
676+
677+
**Note:** The component paths must be local and relative.
678+
679+
**Warning:** Components are a alpha feature in Kustomize and are therefore
680+
considered experimental in Flux. No guarantees are provided and the feature may
681+
be modified in backwards incompatible ways or removed without warning.
682+
657683
## Variable substitution
658684

659685
With `spec.postBuild.substitute` you can provide a map of key/value pairs holding the

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/fluxcd/pkg/apis/kustomize v0.7.0
2626
github.com/fluxcd/pkg/apis/meta v0.18.0
2727
github.com/fluxcd/pkg/http/fetch v0.3.0
28-
github.com/fluxcd/pkg/kustomize v0.10.0
28+
github.com/fluxcd/pkg/kustomize v0.11.0
2929
github.com/fluxcd/pkg/runtime v0.24.0
3030
github.com/fluxcd/pkg/ssa v0.22.0
3131
github.com/fluxcd/pkg/tar v0.2.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ github.com/fluxcd/pkg/apis/meta v0.18.0 h1:s0LeulWcQ4DxVX6805vgDTxlA6bAYk+Lq1QHS
236236
github.com/fluxcd/pkg/apis/meta v0.18.0/go.mod h1:pYvXRFi1UKNNrGR34jw3uqOnMXw9X6dTkML8j5Z7tis=
237237
github.com/fluxcd/pkg/http/fetch v0.3.0 h1:/mLj0IzTx+GhR09etzMJsBoNQ0qeOx9cSdeUgRB+oqM=
238238
github.com/fluxcd/pkg/http/fetch v0.3.0/go.mod h1:dHTDYIeL0ZAQ9mHM6ZS4VProxho+Atm73MHJ55yj0Sg=
239-
github.com/fluxcd/pkg/kustomize v0.10.0 h1:EG5MbYrLtxeCiZxeFUgvyBhFZaXnKfeqqpg7O+J7o3s=
240-
github.com/fluxcd/pkg/kustomize v0.10.0/go.mod h1:awHID4OKe2/WAfTFg4u0fURXZPUkrIslSZNSPX9MEFQ=
239+
github.com/fluxcd/pkg/kustomize v0.11.0 h1:zseS9LRUuzhP/7KamccmsOgYpJAdhqtsf+2wN/CHF3I=
240+
github.com/fluxcd/pkg/kustomize v0.11.0/go.mod h1:awHID4OKe2/WAfTFg4u0fURXZPUkrIslSZNSPX9MEFQ=
241241
github.com/fluxcd/pkg/runtime v0.24.0 h1:rQmm5Xq8K7f8xcPj1oNOInM1x4YwmgTucZJOP51Xmr4=
242242
github.com/fluxcd/pkg/runtime v0.24.0/go.mod h1:I2T+HWVNzX0cxm9TgH+SVNHTwqlmEDiSke43JXsq9iY=
243243
github.com/fluxcd/pkg/ssa v0.22.0 h1:HvJTuiYLZMxCjin7bAqBgnc2RjSqEfYrMbV5yINoM64=

0 commit comments

Comments
 (0)