1package v1
2
3import (
4 "strings"
5 "time"
6)
7
8// Kustomization is the Schema for the kustomizations API.
9#Kustomization: {
10 _embeddedResource
11
12 // APIVersion defines the versioned schema of this representation of an object.
13 // Servers should convert recognized schemas to the latest internal value, and
14 // may reject unrecognized values.
15 // More info:
16 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
17 apiVersion?: string
18
19 // Kind is a string value representing the REST resource this object represents.
20 // Servers may infer this from the endpoint the client submits requests to.
21 // Cannot be updated.
22 // In CamelCase.
23 // More info:
24 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
25 kind?: string
26 metadata?: {}
27
28 // KustomizationSpec defines the configuration to calculate the desired state
29 // from a Source using Kustomize.
30 spec?: {
31 // BuildMetadata specifies which kustomize build metadata should be added
32 // to the built resources. The allowed values are 'originAnnotations' to
33 // annotate resources with their source origin, and 'transformerAnnotations'
34 // to annotate resources with the transformers that produced them.
35 buildMetadata?: [..."originAnnotations" | "transformerAnnotations"]
36
37 // CommonMetadata specifies the common labels and annotations that are
38 // applied to all resources. Any existing label or annotation will be
39 // overridden if its key matches a common one.
40 commonMetadata?: {
41 // Annotations to be added to the object's metadata.
42 annotations?: [string]: string
43
44 // Labels to be added to the object's metadata.
45 labels?: [string]: string
46 }
47
48 // Components specifies relative paths to kustomize Components.
49 components?: [...string]
50
51 // Decrypt Kubernetes secrets before applying them on the cluster.
52 decryption?: {
53 // Provider is the name of the decryption engine.
54 provider!: "sops"
55
56 // The secret name containing the private OpenPGP keys used for decryption.
57 // A static credential for a cloud provider defined inside the Secret
58 // takes priority to secret-less authentication with the ServiceAccountName
59 // field.
60 secretRef?: {
61 // Name of the referent.
62 name!: string
63 }
64
65 // ServiceAccountName is the name of the service account used to
66 // authenticate with KMS services from cloud providers. If a
67 // static credential for a given cloud provider is defined
68 // inside the Secret referenced by SecretRef, that static
69 // credential takes priority.
70 serviceAccountName?: string
71 }
72
73 // DeletionPolicy can be used to control garbage collection when this
74 // Kustomization is deleted. Valid values are ('MirrorPrune', 'Delete',
75 // 'WaitForTermination', 'Orphan'). 'MirrorPrune' mirrors the Prune field
76 // (orphan if false, delete if true). Defaults to 'MirrorPrune'.
77 deletionPolicy?: "MirrorPrune" | "Delete" | "WaitForTermination" | "Orphan"
78
79 // DependsOn may contain a DependencyReference slice
80 // with references to Kustomization resources that must be ready before this
81 // Kustomization can be reconciled.
82 dependsOn?: [...{
83 // Name of the referent.
84 name!: string
85
86 // Namespace of the referent, defaults to the namespace of the resource
87 // object that contains the reference.
88 namespace?: string
89
90 // ReadyExpr is a CEL expression that can be used to assess the readiness
91 // of a dependency. When specified, the built-in readiness check
92 // is replaced by the logic defined in the CEL expression.
93 // To make the CEL expression additive to the built-in readiness check,
94 // the feature gate `AdditiveCELDependencyCheck` must be set to `true`.
95 readyExpr?: string
96 }]
97
98 // Force instructs the controller to recreate resources
99 // when patching fails due to an immutable field change.
100 force?: bool
101
102 // HealthCheckExprs is a list of healthcheck expressions for evaluating the
103 // health of custom resources using Common Expression Language (CEL).
104 // The expressions are evaluated only when Wait or HealthChecks are specified.
105 healthCheckExprs?: [...{
106 // APIVersion of the custom resource under evaluation.
107 apiVersion!: string
108
109 // Current is the CEL expression that determines if the status
110 // of the custom resource has reached the desired state.
111 current!: string
112
113 // Failed is the CEL expression that determines if the status
114 // of the custom resource has failed to reach the desired state.
115 failed?: string
116
117 // InProgress is the CEL expression that determines if the status
118 // of the custom resource has not yet reached the desired state.
119 inProgress?: string
120
121 // Kind of the custom resource under evaluation.
122 kind?: string
123 }]
124
125 // A list of resources to be included in the health assessment.
126 healthChecks?: [...{
127 // API version of the referent, if not specified the Kubernetes preferred version will be used.
128 apiVersion?: string
129
130 // Kind of the referent.
131 kind!: string
132
133 // Name of the referent.
134 name!: string
135
136 // Namespace of the referent, when not specified it acts as LocalObjectReference.
137 namespace?: string
138 }]
139
140 // Ignore is a list of rules for specifying which changes to ignore
141 // during drift detection. These rules are applied to the resources managed
142 // by the Kustomization and are used to exclude specific JSON pointer paths
143 // from the drift detection and apply process.
144 ignore?: [...{
145 // Paths is a list of JSON Pointer (RFC 6901) paths to be excluded from
146 // consideration in a Kubernetes object.
147 paths!: [...string]
148
149 // Target is a selector for specifying Kubernetes objects to which this
150 // rule applies.
151 // If Target is not set, the Paths will be ignored for all Kubernetes
152 // objects within the manifest of the Kustomization.
153 target?: {
154 // AnnotationSelector is a string that follows the label selection expression
155 // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
156 // It matches with the resource annotations.
157 annotationSelector?: string
158
159 // Group is the API group to select resources from.
160 // Together with Version and Kind it is capable of unambiguously identifying
161 // and/or selecting resources.
162 // https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
163 group?: string
164
165 // Kind of the API Group to select resources from.
166 // Together with Group and Version it is capable of unambiguously
167 // identifying and/or selecting resources.
168 // https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
169 kind?: string
170
171 // LabelSelector is a string that follows the label selection expression
172 // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
173 // It matches with the resource labels.
174 labelSelector?: string
175
176 // Name to match resources with.
177 name?: string
178
179 // Namespace to select resources from.
180 namespace?: string
181
182 // Version of the API Group to select resources from.
183 // Together with Group and Kind it is capable of unambiguously identifying
184 // and/or selecting resources.
185 // https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
186 version?: string
187 }
188 }]
189
190 // IgnoreMissingComponents instructs the controller to ignore Components paths
191 // not found in source by removing them from the generated kustomization.yaml
192 // before running kustomize build.
193 ignoreMissingComponents?: bool
194
195 // Images is a list of (image name, new name, new tag or digest)
196 // for changing image names, tags or digests. This can also be achieved with a
197 // patch, but this operator is simpler to specify.
198 images?: [...{
199 // Digest is the value used to replace the original image tag.
200 // If digest is present NewTag value is ignored.
201 digest?: string
202
203 // Name is a tag-less image name.
204 name!: string
205
206 // NewName is the value used to replace the original name.
207 newName?: string
208
209 // NewTag is the value used to replace the original tag.
210 newTag?: string
211 }]
212
213 // The interval at which to reconcile the Kustomization.
214 // This interval is approximate and may be subject to jitter to ensure
215 // efficient use of resources.
216 interval!: =~"^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
217
218 // The KubeConfig for reconciling the Kustomization on a remote cluster.
219 // When used in combination with KustomizationSpec.ServiceAccountName,
220 // forces the controller to act on behalf of that Service Account at the
221 // target cluster.
222 // If the --default-service-account flag is set, its value will be used as
223 // a controller level fallback for when KustomizationSpec.ServiceAccountName
224 // is empty.
225 kubeConfig?: {
226 // ConfigMapRef holds an optional name of a ConfigMap that contains
227 // the following keys:
228 //
229 // - `provider`: the provider to use. One of `aws`, `azure`, `gcp`, or
230 // `generic`. Required.
231 // - `cluster`: the fully qualified resource name of the Kubernetes
232 // cluster in the cloud provider API. Not used by the `generic`
233 // provider. Required when one of `address` or `ca.crt` is not set.
234 // - `address`: the address of the Kubernetes API server. Required
235 // for `generic`. For the other providers, if not specified, the
236 // first address in the cluster resource will be used, and if
237 // specified, it must match one of the addresses in the cluster
238 // resource.
239 // If audiences is not set, will be used as the audience for the
240 // `generic` provider.
241 // - `ca.crt`: the optional PEM-encoded CA certificate for the
242 // Kubernetes API server. If not set, the controller will use the
243 // CA certificate from the cluster resource.
244 // - `audiences`: the optional audiences as a list of
245 // line-break-separated strings for the Kubernetes ServiceAccount
246 // token. Defaults to the `address` for the `generic` provider, or
247 // to specific values for the other providers depending on the
248 // provider.
249 // - `serviceAccountName`: the optional name of the Kubernetes
250 // ServiceAccount in the same namespace that should be used
251 // for authentication. If not specified, the controller
252 // ServiceAccount will be used.
253 //
254 // Mutually exclusive with SecretRef.
255 configMapRef?: {
256 // Name of the referent.
257 name!: string
258 }
259
260 // SecretRef holds an optional name of a secret that contains a key with
261 // the kubeconfig file as the value. If no key is set, the key will default
262 // to 'value'. Mutually exclusive with ConfigMapRef.
263 // It is recommended that the kubeconfig is self-contained, and the secret
264 // is regularly updated if credentials such as a cloud-access-token expire.
265 // Cloud specific `cmd-path` auth helpers will not function without adding
266 // binaries and credentials to the Pod that is responsible for reconciling
267 // Kubernetes resources. Supported only for the generic provider.
268 secretRef?: {
269 // Key in the Secret, when not specified an implementation-specific default key is used.
270 key?: string
271
272 // Name of the Secret.
273 name!: string
274 }
275 }
276
277 // NamePrefix will prefix the names of all managed resources.
278 namePrefix?: strings.MaxRunes(
279 200,
280 ) & strings.MinRunes(
281 1,
282 )
283
284 // NameSuffix will suffix the names of all managed resources.
285 nameSuffix?: strings.MaxRunes(
286 200,
287 ) & strings.MinRunes(
288 1,
289 )
290
291 // Strategic merge and JSON patches, defined as inline YAML objects,
292 // capable of targeting objects based on kind, label and annotation selectors.
293 patches?: [...{
294 // Patch contains an inline StrategicMerge patch or an inline JSON6902 patch with
295 // an array of operation objects.
296 patch!: string
297
298 // Target points to the resources that the patch document should be applied to.
299 target?: {
300 // AnnotationSelector is a string that follows the label selection expression
301 // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
302 // It matches with the resource annotations.
303 annotationSelector?: string
304
305 // Group is the API group to select resources from.
306 // Together with Version and Kind it is capable of unambiguously identifying
307 // and/or selecting resources.
308 // https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
309 group?: string
310
311 // Kind of the API Group to select resources from.
312 // Together with Group and Version it is capable of unambiguously
313 // identifying and/or selecting resources.
314 // https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
315 kind?: string
316
317 // LabelSelector is a string that follows the label selection expression
318 // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
319 // It matches with the resource labels.
320 labelSelector?: string
321
322 // Name to match resources with.
323 name?: string
324
325 // Namespace to select resources from.
326 namespace?: string
327
328 // Version of the API Group to select resources from.
329 // Together with Group and Kind it is capable of unambiguously identifying
330 // and/or selecting resources.
331 // https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md
332 version?: string
333 }
334 }]
335
336 // Path to the directory containing the kustomization.yaml file, or the
337 // set of plain YAMLs a kustomization.yaml should be generated for.
338 // Defaults to 'None', which translates to the root path of the SourceRef.
339 path?: string
340
341 // PostBuild describes which actions to perform on the YAML manifest
342 // generated by building the kustomize overlay.
343 postBuild?: {
344 // Substitute holds a map of key/value pairs.
345 // The variables defined in your YAML manifests that match any of the keys
346 // defined in the map will be substituted with the set value.
347 // Includes support for bash string replacement functions
348 // e.g. ${var:=default}, ${var:position} and ${var/substring/replacement}.
349 substitute?: [string]: string
350
351 // SubstituteFrom holds references to ConfigMaps and Secrets containing
352 // the variables and their values to be substituted in the YAML manifests.
353 // The ConfigMap and the Secret data keys represent the var names, and they
354 // must match the vars declared in the manifests for the substitution to
355 // happen.
356 substituteFrom?: [...{
357 // Kind of the values referent, valid values are ('Secret', 'ConfigMap').
358 kind!: "Secret" | "ConfigMap"
359
360 // Name of the values referent. Should reside in the same namespace as the
361 // referring resource.
362 name!: strings.MaxRunes(
363 253,
364 ) & strings.MinRunes(
365 1,
366 )
367
368 // Optional indicates whether the referenced resource must exist, or whether to
369 // tolerate its absence. If true and the referenced resource is absent, proceed
370 // as if the resource was present but empty, without any variables defined.
371 optional?: bool
372 }]
373
374 // SubstituteStrategy defines the strategy for substituting variables in the YAML manifests.
375 // Valid values are:
376 //
377 // - WithVariables (the default): require at least one variable to be defined,
378 // either through the inline map or through the resolved references to ConfigMaps
379 // and Secrets.
380 // - Always: perform the substitution even if no variables are defined.
381 substituteStrategy?: "WithVariables" | "Always"
382 }
383
384 // Prune enables garbage collection.
385 prune!: bool
386
387 // The interval at which to retry a previously failed reconciliation.
388 // When not specified, the controller uses the KustomizationSpec.Interval
389 // value to retry failures.
390 retryInterval?: =~"^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
391
392 // The name of the Kubernetes service account to impersonate
393 // when reconciling this Kustomization.
394 serviceAccountName?: string
395
396 // Reference of the source where the kustomization file is.
397 sourceRef!: {
398 // API version of the referent.
399 apiVersion?: string
400
401 // Kind of the referent.
402 kind!: "OCIRepository" | "GitRepository" | "Bucket" | "ExternalArtifact"
403
404 // Name of the referent.
405 name!: string
406
407 // Namespace of the referent, defaults to the namespace of the Kubernetes
408 // resource object that contains the reference.
409 namespace?: string
410 }
411
412 // This flag tells the controller to suspend subsequent kustomize executions,
413 // it does not apply to already started executions. Defaults to false.
414 suspend?: bool
415
416 // TargetNamespace sets or overrides the namespace in the
417 // kustomization.yaml file.
418 targetNamespace?: strings.MaxRunes(
419 63,
420 ) & strings.MinRunes(
421 1,
422 )
423
424 // Timeout for validation, apply and health checking operations.
425 // Defaults to 'Interval' duration.
426 timeout?: =~"^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
427
428 // Wait instructs the controller to check the health of all the reconciled
429 // resources. When enabled, the HealthChecks are ignored. Defaults to false.
430 wait?: bool
431 }
432
433 // KustomizationStatus defines the observed state of a kustomization.
434 status?: {
435 conditions?: [...{
436 // lastTransitionTime is the last time the condition transitioned from one status to another.
437 // This should be when the underlying condition changed. If that is not known,
438 // then using the time when the API field changed is acceptable.
439 lastTransitionTime!: time.Time
440
441 // message is a human readable message indicating details about the transition.
442 // This may be an empty string.
443 message!: strings.MaxRunes(
444 32768,
445 )
446
447 // observedGeneration represents the .metadata.generation that the condition was set based upon.
448 // For instance, if .metadata.generation is currently 12, but the
449 // .status.conditions[x].observedGeneration is 9, the condition is out of date
450 // with respect to the current state of the instance.
451 observedGeneration?: int64 & int & >=0
452
453 // reason contains a programmatic identifier indicating the reason for the
454 // condition's last transition.
455 // Producers of specific condition types may define expected values and meanings for this field,
456 // and whether the values are considered a guaranteed API.
457 // The value should be a CamelCase string.
458 // This field may not be empty.
459 reason!: strings.MaxRunes(
460 1024,
461 ) &
462 strings.MinRunes(
463 1,
464 ) &
465 =~"^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$"
466
467 // status of the condition, one of True, False, Unknown.
468 status!: "True" | "False" | "Unknown"
469
470 // type of condition in CamelCase or in foo.example.com/CamelCase.
471 type!: strings.MaxRunes(
472 316,
473 ) &
474 =~"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$"
475 }]
476
477 // History contains a set of snapshots of the last reconciliation attempts
478 // tracking the revision, the state and the duration of each attempt.
479 history?: [...{
480 // Digest is the checksum in the format `<algo>:<hex>` of the resources in this snapshot.
481 digest!: string
482
483 // FirstReconciled is the time when this revision was first reconciled to the cluster.
484 firstReconciled!: time.Time
485
486 // LastReconciled is the time when this revision was last reconciled to the cluster.
487 lastReconciled!: time.Time
488
489 // LastReconciledDuration is time it took to reconcile the resources in this revision.
490 lastReconciledDuration!: string
491
492 // LastReconciledStatus is the status of the last reconciliation.
493 lastReconciledStatus!: string
494
495 // Metadata contains additional information about the snapshot.
496 metadata?: [string]: string
497
498 // TotalReconciliations is the total number of reconciliations that have occurred for this snapshot.
499 totalReconciliations!: int64 & int
500 }]
501
502 // Inventory contains the list of Kubernetes resource object references that
503 // have been successfully applied.
504 inventory?: {
505 // Entries of Kubernetes resource object references.
506 entries!: [...{
507 // ID is the string representation of the Kubernetes resource object's metadata,
508 // in the format '<namespace>_<name>_<group>_<kind>'.
509 id!: string
510
511 // Version is the API version of the Kubernetes resource object's kind.
512 v!: string
513 }]
514 }
515
516 // The last successfully applied origin revision.
517 // Equals the origin revision of the applied Artifact from the referenced Source.
518 // Usually present on the Metadata of the applied Artifact and depends on the
519 // Source type, e.g. for OCI it's the value associated with the key
520 // "org.opencontainers.image.revision".
521 lastAppliedOriginRevision?: string
522
523 // The last successfully applied revision.
524 // Equals the Revision of the applied Artifact from the referenced Source.
525 lastAppliedRevision?: string
526
527 // LastAttemptedRevision is the revision of the last reconciliation attempt.
528 lastAttemptedRevision?: string
529
530 // LastHandledReconcileAt holds the value of the most recent
531 // reconcile request value, so a change of the annotation value
532 // can be detected.
533 lastHandledReconcileAt?: string
534
535 // ObservedGeneration is the last reconciled generation.
536 observedGeneration?: int64 & int
537 }
538
539 _embeddedResource: {
540 apiVersion!: string
541 kind!: string
542 metadata?: {...}
543 }
544 apiVersion: "kustomize.toolkit.fluxcd.io/v1"
545 kind: "Kustomization"
546 metadata!: {
547 name!: string
548 namespace!: string
549 labels?: [string]: string
550 annotations?: [string]: string
551 ...
552 }
553}