@@ -431,6 +431,19 @@ func (in InstallRemediation) RetriesExhausted(hr HelmRelease) bool {
431
431
return in .Retries >= 0 && in .GetFailureCount (hr ) > int64 (in .Retries )
432
432
}
433
433
434
+ // CRDsUpgradePolicy defines the upgrade approach to use for CRDs when upgrading
435
+ // a HelmRelease.
436
+ type CRDsChangePolicy string
437
+
438
+ const (
439
+ // Create CRDs which do not already exist, do not replace already existing CRDs
440
+ // and keep (do not delete) CRDs which no longer exist in the current release.
441
+ Create CRDsChangePolicy = "Create"
442
+ // Create CRDs which do not already exist, Replace already existing CRDs
443
+ // and keep (do not delete) CRDs which no longer exist in the current release.
444
+ CreateReplace CRDsChangePolicy = "CreateReplace"
445
+ )
446
+
434
447
// Upgrade holds the configuration for Helm upgrade actions for this
435
448
// HelmRelease.
436
449
type Upgrade struct {
@@ -473,6 +486,24 @@ type Upgrade struct {
473
486
// upgrade action when it fails.
474
487
// +optional
475
488
CleanupOnFail bool `json:"cleanupOnFail,omitempty"`
489
+
490
+ // UpgradeCRDs upgrade CRDs from the Helm Chart's crds directory according
491
+ // to the CRD upgrade policy provided here. Valid values are `Create` or
492
+ // `CreateReplace`. If omitted (the default) CRDs
493
+ // are not upgraded.
494
+ //
495
+ // Create: new CRDs are created, existing CRDs are neither updated nor deleted.
496
+ //
497
+ // CreateReplace: new CRDs are created, existing CRDs are updated (replaced)
498
+ // but not deleted.
499
+ //
500
+ // By default, CRDs are not applied during Helm upgrade action. With this
501
+ // option users can opt-in to CRD upgrade, which is not (yet) natively supported by Helm.
502
+ // https://helm.sh/docs/chart_best_practices/custom_resource_definitions.
503
+ //
504
+ // +kubebuilder:validation:Enum=Create;CreateReplace
505
+ // +optional
506
+ UpgradeCRDs CRDsChangePolicy `json:"upgradeCRDs,omitempty"`
476
507
}
477
508
478
509
// GetTimeout returns the configured timeout for the Helm upgrade action, or the
0 commit comments