Skip to content

Commit

Permalink
api: prepare v2beta1 status for v2beta2
Browse files Browse the repository at this point in the history
This allows users to delay updating their `apiVersion` declarations,
as the fields will be known in the previous version.

If we would not do this, the fields would get wiped when the `v2beta1`
resource is applied, potentially causing spurious upgrades.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
  • Loading branch information
hiddeco committed Nov 21, 2023
1 parent 9bb8f02 commit 04350dd
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 0 deletions.
34 changes: 34 additions & 0 deletions api/v2beta1/helmrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (

"github.com/fluxcd/pkg/apis/kustomize"
"github.com/fluxcd/pkg/apis/meta"

"github.com/fluxcd/helm-controller/api/v2beta2"
)

const HelmReleaseKind = "HelmRelease"
Expand Down Expand Up @@ -905,6 +907,38 @@ type HelmReleaseStatus struct {
// state. It is reset after a successful reconciliation.
// +optional
UpgradeFailures int64 `json:"upgradeFailures,omitempty"`

// StorageNamespace is the namespace of the Helm release storage for the
// current release.
//
// Note: this field is provisional to the v2beta2 API, and not actively used
// by v2beta1 HelmReleases.
// +optional
StorageNamespace string `json:"storageNamespace,omitempty"`

// History holds the history of Helm releases performed for this HelmRelease
// up to the last successfully completed release.
//
// Note: this field is provisional to the v2beta2 API, and not actively used
// by v2beta1 HelmReleases.
// +optional
History v2beta2.Snapshots `json:"history,omitempty"`

// LastAttemptedReleaseAction is the last release action performed for this
// HelmRelease. It is used to determine the active remediation strategy.
//
// Note: this field is provisional to the v2beta2 API, and not actively used
// by v2beta1 HelmReleases.
// +optional
LastAttemptedReleaseAction string `json:"lastAttemptedReleaseAction,omitempty"`

// LastAttemptedConfigDigest is the digest for the config (better known as
// "values") of the last reconciliation attempt.
//
// Note: this field is provisional to the v2beta2 API, and not actively used
// by v2beta1 HelmReleases.
// +optional
LastAttemptedConfigDigest string `json:"lastAttemptedConfigDigest,omitempty"`
}

// GetHelmChart returns the namespace and name of the HelmChart.
Expand Down
12 changes: 12 additions & 0 deletions api/v2beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 110 additions & 0 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,99 @@ spec:
description: HelmChart is the namespaced name of the HelmChart resource
created by the controller for the HelmRelease.
type: string
history:
description: "History holds the history of Helm releases performed
for this HelmRelease up to the last successfully completed release.
\n Note: this field is provisional to the v2beta2 API, and not actively
used by v2beta1 HelmReleases."
items:
description: Snapshot captures a point-in-time copy of the status
information for a Helm release, as managed by the controller.
properties:
apiVersion:
description: 'APIVersion is the API version of the Snapshot.
Provisional: when the calculation method of the Digest field
is changed, this field will be used to distinguish between
the old and new methods.'
type: string
chartName:
description: ChartName is the chart name of the release object
in storage.
type: string
chartVersion:
description: ChartVersion is the chart version of the release
object in storage.
type: string
configDigest:
description: ConfigDigest is the checksum of the config (better
known as "values") of the release object in storage. It has
the format of `<algo>:<checksum>`.
type: string
deleted:
description: Deleted is when the release was deleted.
format: date-time
type: string
digest:
description: Digest is the checksum of the release object in
storage. It has the format of `<algo>:<checksum>`.
type: string
firstDeployed:
description: FirstDeployed is when the release was first deployed.
format: date-time
type: string
lastDeployed:
description: LastDeployed is when the release was last deployed.
format: date-time
type: string
name:
description: Name is the name of the release.
type: string
namespace:
description: Namespace is the namespace the release is deployed
to.
type: string
status:
description: Status is the current state of the release.
type: string
testHooks:
additionalProperties:
description: TestHookStatus holds the status information for
a test hook as observed to be run by the controller.
properties:
lastCompleted:
description: LastCompleted is the time the test hook last
completed.
format: date-time
type: string
lastStarted:
description: LastStarted is the time the test hook was
last started.
format: date-time
type: string
phase:
description: Phase the test hook was observed to be in.
type: string
type: object
description: TestHooks is the list of test hooks for the release
as observed to be run by the controller.
type: object
version:
description: Version is the version of the release object in
storage.
type: integer
required:
- chartName
- chartVersion
- configDigest
- digest
- firstDeployed
- lastDeployed
- name
- namespace
- status
- version
type: object
type: array
installFailures:
description: InstallFailures is the install failure count against
the latest desired state. It is reset after a successful reconciliation.
Expand All @@ -890,6 +983,18 @@ spec:
description: LastAppliedRevision is the revision of the last successfully
applied source.
type: string
lastAttemptedConfigDigest:
description: "LastAttemptedConfigDigest is the digest for the config
(better known as \"values\") of the last reconciliation attempt.
\n Note: this field is provisional to the v2beta2 API, and not actively
used by v2beta1 HelmReleases."
type: string
lastAttemptedReleaseAction:
description: "LastAttemptedReleaseAction is the last release action
performed for this HelmRelease. It is used to determine the active
remediation strategy. \n Note: this field is provisional to the
v2beta2 API, and not actively used by v2beta1 HelmReleases."
type: string
lastAttemptedRevision:
description: LastAttemptedRevision is the revision of the last reconciliation
attempt.
Expand All @@ -911,6 +1016,11 @@ spec:
description: ObservedGeneration is the last observed generation.
format: int64
type: integer
storageNamespace:
description: "StorageNamespace is the namespace of the Helm release
storage for the current release. \n Note: this field is provisional
to the v2beta2 API, and not actively used by v2beta1 HelmReleases."
type: string
upgradeFailures:
description: UpgradeFailures is the upgrade failure count against
the latest desired state. It is reset after a successful reconciliation.
Expand Down

0 comments on commit 04350dd

Please sign in to comment.