Skip to content

Commit afdc58c

Browse files
committed
Add .spec.ignoreMissingComponents field to Kustomization API
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 9c41b06 commit afdc58c

File tree

6 files changed

+65
-20
lines changed

6 files changed

+65
-20
lines changed

api/v1/kustomization_types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,16 @@ type KustomizationSpec struct {
177177
// +optional
178178
Wait bool `json:"wait,omitempty"`
179179

180-
// Components specifies relative paths to specifications of other Components.
180+
// Components specifies relative paths to kustomize Components.
181181
// +optional
182182
Components []string `json:"components,omitempty"`
183183

184+
// IgnoreMissingComponents instructs the controller to ignore Components paths
185+
// not found in source by removing them from the generated kustomization.yaml
186+
// before running kustomize build.
187+
// +optional
188+
IgnoreMissingComponents bool `json:"ignoreMissingComponents,omitempty"`
189+
184190
// HealthCheckExprs is a list of healthcheck expressions for evaluating the
185191
// health of custom resources using Common Expression Language (CEL).
186192
// The expressions are evaluated only when Wait or HealthChecks are specified.

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ spec:
7171
type: object
7272
type: object
7373
components:
74-
description: Components specifies relative paths to specifications
75-
of other Components.
74+
description: Components specifies relative paths to kustomize Components.
7675
items:
7776
type: string
7877
type: array
@@ -218,6 +217,12 @@ spec:
218217
- name
219218
type: object
220219
type: array
220+
ignoreMissingComponents:
221+
description: |-
222+
IgnoreMissingComponents instructs the controller to ignore Components paths
223+
not found in source by removing them from the generated kustomization.yaml
224+
before running kustomize build.
225+
type: boolean
221226
images:
222227
description: |-
223228
Images is a list of (image name, new name, new tag or digest)

docs/api/v1/kustomize.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,21 @@ resources. When enabled, the HealthChecks are ignored. Defaults to false.</p>
392392
</td>
393393
<td>
394394
<em>(Optional)</em>
395-
<p>Components specifies relative paths to specifications of other Components.</p>
395+
<p>Components specifies relative paths to kustomize Components.</p>
396+
</td>
397+
</tr>
398+
<tr>
399+
<td>
400+
<code>ignoreMissingComponents</code><br>
401+
<em>
402+
bool
403+
</em>
404+
</td>
405+
<td>
406+
<em>(Optional)</em>
407+
<p>IgnoreMissingComponents instructs the controller to ignore Components paths
408+
not found in source by removing them from the generated kustomization.yaml
409+
before running kustomize build.</p>
396410
</td>
397411
</tr>
398412
<tr>
@@ -1011,7 +1025,21 @@ resources. When enabled, the HealthChecks are ignored. Defaults to false.</p>
10111025
</td>
10121026
<td>
10131027
<em>(Optional)</em>
1014-
<p>Components specifies relative paths to specifications of other Components.</p>
1028+
<p>Components specifies relative paths to kustomize Components.</p>
1029+
</td>
1030+
</tr>
1031+
<tr>
1032+
<td>
1033+
<code>ignoreMissingComponents</code><br>
1034+
<em>
1035+
bool
1036+
</em>
1037+
</td>
1038+
<td>
1039+
<em>(Optional)</em>
1040+
<p>IgnoreMissingComponents instructs the controller to ignore Components paths
1041+
not found in source by removing them from the generated kustomization.yaml
1042+
before running kustomize build.</p>
10151043
</td>
10161044
</tr>
10171045
<tr>

docs/spec/v1/kustomizations.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,13 +663,19 @@ metadata:
663663
namespace: flux-system
664664
spec:
665665
# ...omitted for brevity
666+
ignoreMissingComponents: false
666667
components:
667668
- ../ingress
668669
- ../tls
669670
```
670671

671672
**Note:** The components paths must be local and relative to the path specified by `.spec.path`.
672673

674+
With `.spec.ignoreMissingComponents` you can specify whether the controller
675+
should ignore the component paths that are missing from the source. By default,
676+
it is set to `false`, meaning that the controller will fail the reconciliation
677+
if any of the specified paths are missing from the source.
678+
673679
**Warning:** Components are an alpha feature in Kustomize and are therefore
674680
considered experimental in Flux. No guarantees are provided as the feature may
675681
be modified in backwards incompatible ways or removed without warning.

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ require (
2323
github.com/fluxcd/pkg/apis/acl v0.9.0
2424
github.com/fluxcd/pkg/apis/event v0.19.0
2525
github.com/fluxcd/pkg/apis/kustomize v1.12.0
26-
github.com/fluxcd/pkg/apis/meta v1.20.0
27-
github.com/fluxcd/pkg/auth v0.29.0
26+
github.com/fluxcd/pkg/apis/meta v1.21.0
27+
github.com/fluxcd/pkg/auth v0.30.0
2828
github.com/fluxcd/pkg/cache v0.11.0
2929
github.com/fluxcd/pkg/http/fetch v0.19.0
30-
github.com/fluxcd/pkg/kustomize v1.20.0
31-
github.com/fluxcd/pkg/runtime v0.82.0
30+
github.com/fluxcd/pkg/kustomize v1.21.0
31+
github.com/fluxcd/pkg/runtime v0.83.0
3232
github.com/fluxcd/pkg/ssa v0.53.0
3333
github.com/fluxcd/pkg/tar v0.14.0
3434
github.com/fluxcd/pkg/testserver v0.13.0
@@ -119,7 +119,7 @@ require (
119119
github.com/containerd/continuity v0.4.5 // indirect
120120
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
121121
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
122-
github.com/docker/cli v28.2.2+incompatible // indirect
122+
github.com/docker/cli v28.3.3+incompatible // indirect
123123
github.com/docker/docker v28.3.3+incompatible // indirect
124124
github.com/docker/docker-credential-helpers v0.9.3 // indirect
125125
github.com/docker/go-connections v0.5.0 // indirect

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
157157
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
158158
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
159159
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
160-
github.com/docker/cli v28.2.2+incompatible h1:qzx5BNUDFqlvyq4AHzdNB7gSyVTmU4cgsyN9SdInc1A=
161-
github.com/docker/cli v28.2.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
160+
github.com/docker/cli v28.3.3+incompatible h1:fp9ZHAr1WWPGdIWBM1b3zLtgCF+83gRdVMTJsUeiyAo=
161+
github.com/docker/cli v28.3.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
162162
github.com/docker/docker v28.3.3+incompatible h1:Dypm25kh4rmk49v1eiVbsAtpAsYURjYkaKubwuBdxEI=
163163
github.com/docker/docker v28.3.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
164164
github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8=
@@ -195,20 +195,20 @@ github.com/fluxcd/pkg/apis/event v0.19.0 h1:ZJU2voontkzp5rNYA4JMOu40S4tRcrWi4Do5
195195
github.com/fluxcd/pkg/apis/event v0.19.0/go.mod h1:deuIyUb6lh+Z1Ccvwwxhm1wNM3kpSo+vF1IgRnpaZfQ=
196196
github.com/fluxcd/pkg/apis/kustomize v1.12.0 h1:KvZN6xwgP/dNSeckL4a/Uv715XqiN1C3xS+jGcPejtE=
197197
github.com/fluxcd/pkg/apis/kustomize v1.12.0/go.mod h1:OojLxIdKm1JAAdh3sL4j4F+vfrLKb7kq1vr8bpyEKgg=
198-
github.com/fluxcd/pkg/apis/meta v1.20.0 h1:l9h0kWoDZTcYV0WJkFMgDXq6Q4tSojrJ+bHpFJSsaW0=
199-
github.com/fluxcd/pkg/apis/meta v1.20.0/go.mod h1:XUAEUgT4gkWDAEN79E141tmL+v4SV50tVZ/Ojpc/ueg=
200-
github.com/fluxcd/pkg/auth v0.29.0 h1:lLc63zjodqIqg5ydlU/Kp3Qa+wvh6G2khjop5MHALvk=
201-
github.com/fluxcd/pkg/auth v0.29.0/go.mod h1:bjZ+6RMSGgsQQK+aPfVP8HWuBbb+FLlFxMiqd8ywzik=
198+
github.com/fluxcd/pkg/apis/meta v1.21.0 h1:R+bN02chcs0HUmyVDQhqe/FHmYLjipVDMLnyYfNX850=
199+
github.com/fluxcd/pkg/apis/meta v1.21.0/go.mod h1:XUAEUgT4gkWDAEN79E141tmL+v4SV50tVZ/Ojpc/ueg=
200+
github.com/fluxcd/pkg/auth v0.30.0 h1:7JMnY1ClArvOsadt6hOxceu8Q2hLsYHFMt0DV3BQl4Q=
201+
github.com/fluxcd/pkg/auth v0.30.0/go.mod h1:me38o1nDfSLw6YvnkT9Ce/zqJZICZSA7j5pNMR3JUbc=
202202
github.com/fluxcd/pkg/cache v0.11.0 h1:fsE8S+una21fSNw4MDXGUIf0Gf1J+pqa4RbsVKf2aTI=
203203
github.com/fluxcd/pkg/cache v0.11.0/go.mod h1:2RTIU6PsJniHmfnllQWFEo7fa5V8KQlnMgn4o0sme40=
204204
github.com/fluxcd/pkg/envsubst v1.5.0 h1:S07mo+MkGhptdHA4pRze5HPKlc8tHxKswNdcMZi1WDY=
205205
github.com/fluxcd/pkg/envsubst v1.5.0/go.mod h1:c3a8DYI855sZUubHFYQbjfjop6Wu4/zg1cLyf7SnCes=
206206
github.com/fluxcd/pkg/http/fetch v0.19.0 h1:dRdErv8X2t/VKnh5kFRZrlqKzbq9Gh0n/z3XArjdLho=
207207
github.com/fluxcd/pkg/http/fetch v0.19.0/go.mod h1:z32w8nezoBvQfMogCkhAoqKToOZzPSbIW0PeN2fKXqA=
208-
github.com/fluxcd/pkg/kustomize v1.20.0 h1:NU1p3PxyOz1LAsPWhmmObzP5EA+LTh9DT+6Tu9+LgCw=
209-
github.com/fluxcd/pkg/kustomize v1.20.0/go.mod h1:drVtmqUCJc/0a178vjl67DSePQahOBI+aO4x1kzV13M=
210-
github.com/fluxcd/pkg/runtime v0.82.0 h1:VdPPRJtj8/rcBdqY7GZSffoxe5elFHt+ymwQHNbPOlc=
211-
github.com/fluxcd/pkg/runtime v0.82.0/go.mod h1:rIDynMhU5upbn8ce3bXQhH5L6vtDw5MELycvtJG/+og=
208+
github.com/fluxcd/pkg/kustomize v1.21.0 h1:J+OcRTBWJcOwqhNW2oZyPHN7u54qBpScYLYnqTiM3gE=
209+
github.com/fluxcd/pkg/kustomize v1.21.0/go.mod h1:drVtmqUCJc/0a178vjl67DSePQahOBI+aO4x1kzV13M=
210+
github.com/fluxcd/pkg/runtime v0.83.0 h1:XzpwKzo7GqfBE/BKpxG5B4U7cUnojnB407S9Dpp6oLU=
211+
github.com/fluxcd/pkg/runtime v0.83.0/go.mod h1:r8KLvXRguKtpLAa66fA19rIbwPViXm8az038IUabYvw=
212212
github.com/fluxcd/pkg/sourceignore v0.14.0 h1:ZiZzbXtXb/Qp7I7JCStsxOlX8ri8rWwCvmvIrJ0UzQQ=
213213
github.com/fluxcd/pkg/sourceignore v0.14.0/go.mod h1:E3zKvyTyB+oQKqm/2I/jS6Rrt3B7fNuig/4bY2vi3bg=
214214
github.com/fluxcd/pkg/ssa v0.53.0 h1:EtKFAYWXohIGkzPhIrv8NbV5zYr4iZHY6DaNxMR9+bU=

0 commit comments

Comments
 (0)